physics: Jolt's floor sized for what moves - pairs 4096, contacts 2048 and a 4 MB temp heap by default (phys_open_sized for more), and a body past max_bodies or a step past the pairs or contacts is Mem.over, never a quiet -1; world.ludic split from shapes.ludic
An empty world at the game's size held 51839 KB of Jolt's heap (200000 bodies, 65536 pairs, 20480 contacts, a 32 MB temp heap), the jolt= floor under every walk. Pairs and contacts come from what moves - drops, boats, a few walkers - and a valley's still things make none. Now 11743 KB at 200000 bodies and 8461 KB at the 98304 the game opens for (jolt_floor_test holds it under 16 MB). The temp heap still falls back to malloc for a step that wants more. lib/macos-arm64 rebuilt; lib/windows-x64 needs native/build.sh on the PC (jph_world_new's new sizes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
031fcad641
commit
b4af12025d
11 changed files with 95 additions and 52 deletions
25
packages/ludic.physics/tests/jolt_floor_test.ludic
Normal file
25
packages/ludic.physics/tests/jolt_floor_test.ludic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# jolt_floor_test.ludic - what an empty world costs in Jolt's own heap at the game's size (plan 25):
|
||||
# the floor under every body, from the body table, the broad phase, the contact caches and the temp heap
|
||||
import "ludic.physics"
|
||||
import "ludic.base"
|
||||
program JoltFloorTest {
|
||||
numbers float
|
||||
function floor_at(physics_st: mut PhysicsState, bodies: int) -> long {
|
||||
expect(phys_open(physics_st, 64, 1))
|
||||
phys_close(physics_st)
|
||||
let before = phys_heap_bytes()
|
||||
expect(phys_open(physics_st, bodies, 0))
|
||||
let f = phys_heap_bytes() - before
|
||||
phys_close(physics_st)
|
||||
return f
|
||||
}
|
||||
|
||||
# it was 51839 KB at 200000 bodies with 65536 pairs, 20480 contacts and a 32 MB temp heap
|
||||
test "an empty world at the game's size costs under 16 MB" (physics_st: mut PhysicsState) {
|
||||
let a = floor_at(physics_st, 200000)
|
||||
let b = floor_at(physics_st, 98304)
|
||||
print(`jolt floor: {a / long(1024)} KB at 200000 bodies, {b / long(1024)} KB at 98304`)
|
||||
expect(b < long(16 * 1024 * 1024))
|
||||
expect(a > b)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue