4 Hugues Ross - Blog: DFEngine Update 6
Hugues Ross

8/26/14

DFEngine Update 6

Changelog:

  • Started rewriting some of the collision handling code.


With the collision bug fixed, I started thinking about the way collisions are handled right now. The current system works well enough, but it definitely creates issues. For instance, balls in AMAZE would sometimes 'tunnel' through multiple blocks. This usually happened because the blocks were destroyed immediately, so the ball might not have bounced when the block disappeared. To fix this, I'm going to add two new collision callbacks:
The first is only called when two objects start colliding. In other words, it's only called when two objects first touch, and won't be called again until after they stop touching. Not only does this give me a way to respond to a collision only once, it also ought to make things run faster, since it isn't called every frame.
The other callback is for when the objects stop colliding. Just like its counterpart, it only gets called once. This one will most likely be reserved for special cases, like the problem that I described above.

Overall, I think these new callbacks will give me a much greater level of control over how collisions are handled by the engine, and also help make games use cleaner, more efficient scripts. One last improvement is that the new setup should be expandable. I may be able to keep track of other things with this system in the future, like collision velocity for instance.
Post a Comment