Perf/collision pair index - #467
Open
nickalreadyinuse wants to merge 3 commits into
Open
nickalreadyinuse wants to merge 3 commits into
nickalreadyinuse wants to merge 3 commits into
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.