ludic.physics, ludic.character, ludic.vehicles: fact records reused, and phys_sink allocates nothing
The per-frame sweep over physics, character, vehicles and nav found three fact makers that made a record per fact: contacts and splashes, the character's and the vehicles'. Each keeps a pool now, as wildlife's and npc's do (q_unheld). phys_sink, asked on every removal, built two new lists each time; it filters into a kept spare pair and swaps. ludic.nav's paths and crowds already allocate nothing, and none of the four builds a string per call. What remains at load, reset or a world swap is not per frame. vehicle_feed takes its state mut. vehicles_test: 1000 fed facts, drained turn by turn, use at most 4 records. All packages 421. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fe2d2bacd7
commit
fffedf71d0
10 changed files with 92 additions and 11 deletions
|
|
@ -46,12 +46,17 @@ export state PhysicsState {
|
|||
ph_hard: float = 2.0 # metres a second: a contact under this is not a fact
|
||||
ph_floats: []int = new []int # buoyant bodies' ids
|
||||
ph_float_k: []float = new []float # and theirs: buoyancy, linear drag, angular drag, wet
|
||||
ph_floats2: []int = new []int # the spare pair phys_sink filters into
|
||||
ph_float_k2: []float = new []float
|
||||
ph_rx: float = 0.0 # where the last phys_resolve put a body
|
||||
ph_rz: float = 0.0
|
||||
ph_walkers: []pointer = new []pointer # a walker id is its place here; null once removed
|
||||
ph_ids: []int = words(PH_CAP * 2)
|
||||
ph_vals: []float = floats(PH_CAP * 4)
|
||||
ph_facts: Queue<PhysFact> = ph_facts__new()
|
||||
ph_fpool: []PhysFact = new []PhysFact # every fact record made, reused once no drain holds it
|
||||
ph_ffree: []PhysFact = new []PhysFact
|
||||
ph_fnext: int = 0
|
||||
}
|
||||
|
||||
# the facts, oldest first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue