Skip to content

Perf/collision pair index - #467

Open
nickalreadyinuse wants to merge 3 commits into
GooberRF:masterfrom
nickalreadyinuse:perf/collision-pair-index
Open

nickalreadyinuse wants to merge 3 commits into
GooberRF:masterfrom
nickalreadyinuse:perf/collision-pair-index

Conversation

@nickalreadyinuse

Copy link
Copy Markdown
Contributor

No description provided.

Stock collide_stick2ground walks the entire global pair list for every
trace (O(all pairs) per entity per frame). Maintain a per-object index of
active pair nodes (filled in the object_pairs_add hook, drained in a hook on
ObjCollisionPairList::push when the destination is the free list) and
replace collide_stick2ground with a walk over the object's own pairs.
Per-pair dispatch mirrors stock exactly.
weapon_create (flag 0x20 weapons) walked the whole global pair list looking
for the new weapon's pairs. CodeInjection at 0x004C7F65 runs the same loop
over the weapon's own index entries (newest first, matching the head-pushed
stock list order) and jumps to the stock hit / no-hit continuations.
Names FUN_0049a420 as collide_object_object_spheres.
ObjInterp::set_next_pos_orient dead-reckons each remote entity per keyframe
via obj_process_physics(one-slot array, not_interp=false), which ran
object_pairs_check_all_collisions over the whole pair list on every call,
once per remote entity per keyframe. A FunHook on obj_process_physics
records the single entity and a CallHook on the pair check call site
iterates only that entity's indexed pairs with the stock per-pair dispatch
(no unlinking; the real substeps reap stale pairs).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant