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:
Orkun ÇAKILKAYA 2026-09-29 16:18:42 +03:00
parent 031fcad641
commit b4af12025d
11 changed files with 95 additions and 52 deletions

View file

@ -42,6 +42,7 @@ export state PhysicsState {
ph_step: float = 0.016666668 # seconds a step
ph_sub: int = 1 # collision steps in each
ph_max_steps: int = 4 # a slow frame catches up this far and no further
ph_max: int = 0 # the bodies the world was opened for: one more is a failure, not a -1
ph_acc: float = 0.0
ph_steps: int = 0
ph_gen: int = 0 # how many worlds have been opened: an id from an older one is stale
@ -75,3 +76,9 @@ export function phys_config(physics_st: mut PhysicsState, step: float, sub: int,
physics_st.ph_hard = hard
}
function ph_facts__new() -> Queue<PhysFact> { return queue_new("physics.facts") }
# what moves, sized: touching pairs, contact constraints and the step's temp heap (KB). A valley's still
# things make no pairs between them; drops, boats and the walkers do. Past a size a step fails loudly
export const PH_PAIRS: int = 4096
export const PH_CONTACTS: int = 2048
export const PH_TEMP_KB: int = 4096