So I have been on a bit of hiatus towards the end of this summer.  No excuses, just not a lot of hobbyist programming going on at night.  Well that all changed today when I decided to take a 3 hour chunk of time and dedicate myself to finishing something important in the game.  The result?  Enemies which chase the player.

Of course, whenever I add something to the game I stress test it.  The result is a scary form of flocking behavior when several dozen spheres (the collision model used by Whirlygigs) come after my marble.  Their target is quite simple (seen as a small red dot), it is merely where my marble will be in the future, at their level.

As cool as this is, it is not 100% done yet.  The enemy behavior has little quirks in it, and they will happily roll right off an edge to get to you.  I believe I will have to make it a bit more complicated but it must be done…  If the path to the player is safe (no missing tiles), the target itself is a pass-through target, meaning the enemy can barrel ahead as fast as it wants.  If the path to the player is not safe then the target is a stop-at target similar to what Random Whirlygigs do.  I’m sure there are other problems with the system, but it works well at a basic level.

The only big problem I see with seeking enemies, is if they are all clumped together pushing against the wall or some other immovable object, the framerate of the game drops dramatically due to the physics engine.  I’m still trying to figure out how to remedy this through code, but for now the level designs will simply not contain the potential for this scenario (dozens of enemies pushing each other into a corner).

Comments are closed.