Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Towards Bulk Collision / Separation / Solve Event Handling #8

Open
ilexp opened this issue Apr 8, 2017 · 0 comments
Open

Move Towards Bulk Collision / Separation / Solve Event Handling #8

ilexp opened this issue Apr 8, 2017 · 0 comments

Comments

@ilexp
Copy link

ilexp commented Apr 8, 2017

Right now, the way to handle physics events is by subscribing to event handlers on a per-body or even per-fixture basis. This has a high overhead-to-use ratio. One potential way to improve efficiency is to defer all events to the end of the update and deliver them in bulk with one callback per event type.

Besides reducing overhead of delegate calls, it will allow engines and games to do efficient batch processing of these events. It might also allow for secondary optimizations in Velcro, as these specific events will no longer cause user code to run during the simulation.

I don't have an API proposal fleshed out, but I'd imagine an array-of-structs approach, potentially even re-using a subsection of the same array across frames unless grown beyond its former size.

As @Genbox mentioned, this should be combined with a way to flag specific entities to be traced with this event:

If we save all the collisions, you would probably get a list of hundreds of events in scenarios where you have stacked objects (things on terrain etc.). This unfortunately will probably slow down the whole thing rather than speed it up. That being said, it could be sped up if this was implemented as a "tracer" - you mark your objects and the engine check for that mark, and if they are marked, their events are recorded for bulk consumption

First mentioned in this comment, issue #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants