Still continuing on about my AppWeek game, another bit that really helped me out was leveraging existing code for pieces of the game I didn’t really know how to make in a short time. While I do have a decent amount of generic code I’ve accumulated over the years, there are some pieces that I pulled together to make some aspects of the game easier.

The first piece of code was to grab my EasyConfig library, which is a simple three-class library for parsing INI files. I used these INI files to define how each gun behaved, what it looked like, and what sounds it made. The files contained things like damage done, rounds per clip, max ammo, and, for the grenade, the damage falloff exponent so the damage decreased over time. While this code is code I’ve written, I mention it here because it is publicly available to anyone that wants to quickly drop in support for INI files.

The next piece I grabbed was the BoxCollider library from Fabio Policarpo’s FPS demo (available as a download on this page: BoxCollider is a great little library for handling collisions between boxes, rays, and triangulated meshes. I used the library for the character movement collision as well as to handle raycasting for the guns and the collision portion of my grenade physics (I handled the dynamics myself and just did bouncing; the grenades actually never rotate or roll). I did do a few passes over the code base to optimize some of the methods and remove a few parts that created garbage, but it’s still a very valuable library without those changes.

I also needed to make my grenades go boom, so I snagged the Particle 3D sample and dropped that in. With minor changes just to the size of the particles, the built in explosion effect quickly became the look for my grenades. Is it realistic? No, but then again a giant fireball is way cooler to watch than a bunch of tiny pieces of metal flying around.

What’s the moral here? If you’re trying to actually finish a game, I recommend taking a bit to search around for pieces of code you can leverage to make your development quicker and smoother.