Could you please explain to me how the "On Collision Event" works internally?
For example, hypothetically, let's say that I have Event Sheet 1:
Obj1 On Collision Obj2 : Do some actions
Event Sheet 2:
Obj2 On Collision Obj1 : Do some actions
If I assume that the events in both sheets are run as a single concatenated logic loop, would it be correct to assume that the collision detection stores a dictionary of prior checked collisions for objects? In this manner, Event Sheet 2's collision check cost would be minimal.
The reason that I ask is because I have two ways of handling collision detection at this point.
My original way was more modular, all objects belong to EntityFamily which has a local var called CollidedFn, which is a link to a function. All collision detection was centralized in a single CollisionEventSheet which would do something along the lines of:
On EntityFamily Collided with EntityFamily : Call EntityFamily.CollidedFn which would hand off the collision to the object's collision routine.
However, each object (which is represented in my project by a single event sheet) could also have an:
On Object CollidedWith EntityFamily : Do something (note that this is Object-specific)
However, if we're not tracking existing checked collisions in a single "loop cycle", having this On Collision statement repeatedly could get very computationally expensive.
I'm just trying to look for best practices here.
P.S. I might be thinking about this the wrong way, are "On Events" different from regular events in the game loop? Are they maybe like delegate triggers?