feat(ludic.physics): phys_own - a body owns a shape made for it alone, and phys_remove frees it with the body
A chunk's trunks and boulders put in and taken out made a new shape each time and freed none. The table is by the body's index, made once at the world's size. tests/reuse_test: 1000 owned bodies put and removed hold no more shapes and 32 bytes of heap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
404ee2ee3b
commit
5cd53d4024
6 changed files with 54 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ export state PhysicsState {
|
|||
ph_world: pointer = null
|
||||
ph_shapes: []pointer = new []pointer # a shape id is its place here; null once freed
|
||||
ph_spare: []int = new []int # the freed places, handed out again (shape_ids.ludic)
|
||||
ph_own: []int = new []int # by a body's index: the shape it owns, freed with it (owned.ludic)
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue