You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:
First mentioned in this comment, issue #2
The text was updated successfully, but these errors were encountered: