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
|
|
@ -16,7 +16,10 @@ export property PhysPose {
|
|||
function ph_add(physics_st: mut PhysicsState, shape: int, x: float, y: float, z: float, yaw: float, motion: int, layer: int, mass: float) -> int {
|
||||
let s = ph_shape(physics_st, shape)
|
||||
if physics_st.ph_world == null or s == null { return -1 }
|
||||
return jph_body_add(physics_st.ph_world, s, x, y, z, yaw, motion, layer, mass, 0.6, 0.1)
|
||||
let id = jph_body_add(physics_st.ph_world, s, x, y, z, yaw, motion, layer, mass, 0.6, 0.1)
|
||||
# 25.5a: a world full to the bodies it was opened for is a failure, never a thing quietly not there
|
||||
if id < 0 and jph_world_bodies(physics_st.ph_world) >= physics_st.ph_max { Mem.over("a physics body past phys_open's max_bodies") }
|
||||
return id
|
||||
}
|
||||
|
||||
# the ground: a heightfield or a mesh at the world's origin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue