OBB brings back feature-creep nightmares
After spending all day yesterday implementing collision detection using oriented bounding boxes (OBB), I woke up this morning and started thinking if it’s really that necessary for my game. The practical difference between OBB and AABB (axis-aligned bounding boxes) is that AABB remains static on rotations and therefore you can’t have rotated collision checking on your objects. The technical differences though are surprisingly huge. Where for AABB checking it takes a couple of transformations and a few simple checks, there is only one way that OBB collision detection works and that’s using the axis separation theorem, resulting in a much more complicated and computational intense algorithm.
Nevertheless I’ve pushed myself a lot this morning and after reading a lot of hard maths and physics books, I’ve managed to complete the OBB collision detection implementation. But then I sadly realized that having things rotating with their bounding structures makes things much more complicated. That’s because in that case, collisions don’t just occur on moving but also on rotation bringing into play rotational dynamics and much more advanced physics.
My game actually doesn’t have any rotational mechanics. The initial design (as I’ve defined it during the first days of writing to this blog) was to allow for fast action with move-per-key controls, meaning when you press a key, the character automatically rotates and moves towards that direction. The other system is moving only forwards and backwards and rotate left and right, which is not what represents fast-paced action RPG games.
Eventually, after playing around with the prototype I’ve concluded that this is how I really want my game so I’ve decided to use the simpler AABB algorithm instead. So I’ve removed the complex OBB code, easily implemented the AABB collision detection and I’ve already moved to collision response which I’m currently tweaking. Getting collision response working properly is quite hard as well and there are not many alternatives other than using the proper physics for it.
Thinking about the whole OBB situation though I realized that I’ve lost important time and energy for my project. Trying to get OBB working was a classic example of falling into the feature-creep trap and over-engineering the problem. I can totally imagine my game using OBB and that would also improve the gameplay in a million ways. But it’s really easy losing track by adding new features in and that’s not how successful projects really work. Implementing OBB, brings rotation in, then rotation brings rotational dynamics and this brings full-scale rigid bodies physics in, ending up writing a full scale 3D physics engine. That would probably take a few months alone and all I would have would be a really hard to tweak and work with engine resulting in a broken uncreative game that I can’t show to anybody.
Getting the initial idea working is the essential point here because it’s really easy to get tired and lost and end up doing nothing at all. It has happened numerous times to me before and I won’t let it happen again. In fact almost every single of my previous programming projects (at least 20) have ended in exactly that way. I think this is the most important aspect in whatever project - getting the thing to work before altering or adding anything else to the original specification. OBB was a good lesson so from now on I should be more careful and just get my job done the easy simple way so I’ll have a nice demo game to show-off.