Monday, October 25, 2010

Collision Detection

After reading some comments about The Render Engine it became apparent that the engine doesn't offer any really good way to do narrow-phase collision detection.  The SpatialGrid gives developers a quick broad-phase method of finding potential collisions, but when two objects are determined to be possibly colliding, it's up to the developer to implement some sort of narrow-phase detection.  I figured with the engine being what it is, it should at least offer one implementation out-of-the-box, so I've been looking into the GJK algorithm to solve the problem.

In the trunk I have added a method to quickly determine an approximate convex hull from a set of points, and also a method to compute the Minkowski Difference of the two hulls.  Eventually, there will be a method to perform GJK on the two hulls so that the amount of interpenetration can be determined and the appropriate collision response performed.  There are other methods, which I may implement in the future, such as the Separating Axis Theorem since it really isn't that far off from what I'm doing with GJK.

As an engine, The Render Engine needs to provide these operations to make game development that much easier on a potential developer.  Even though the engine does resource loading and rendering, it has to provide a more robust feature set for all potential problems which must be solved.  With the scene graph being fairly solid, and resource loading working as it should, I can focus on adding features which developers can use to enhance their game experience.

To me it seems like I've done a lot already, but I've only just scratched the surface.  To be a complete engine, there needs to be at least one implementation of certain features such as:

  • Narrow-phase collision detection
  • AI/Pathfinding
  • Multiplayer/Networking
  • Tilemap management
  • UI Management
Of these, I was planning on everything except the collision detection.  As it stands now, the engine is already quite robust but it has a ways to go before it is truly a complete solution.

1 comment: