As promised, here’s the source code for Button Battle. As everyone should expect, it’s not the cleanest code, but I do have plenty of experience and it is commented. I expect that the code might be a valuable resource for people who want to see how things were done. To that end, I also made a point to keep all networking code confined to a single file.
Button Battle is written in cross-platform C++. There are a few of my own libraries included in the source/Libraries directory. These handle things like the GUI, input, animation, fonts, I/O, and sound. The main dependencies are SDL, SDL_gpu, RakNet, SDL_image, SDL_mixer, and SDL_ttf. SDL is easy to come by with its add-on libraries. SDL_gpu can be found on Google Code. RakNet requires a license in order to build against, so you would have to get that for yourself. It’s free for hobbyists and poor indies. The code that uses RakNet should be very easy to replace if you have your own preferred networking library. The included Code::Blocks project will need to be modified in order for the compiler and linker to find the supporting libraries wherever you have them.
Interesting features of the code include networking (via RakNet), resolution-independent graphics (made easy by SDL_gpu), simple joint animation, and a list-driven tutorial.
The code and art are licensed under the MIT license. You can do anything you want with it, but keep my copyright notice, and if the code doesn’t do what you want it to, don’t blame me. I’d also appreciate hearing about anything you find useful in the code and what you do with it. If you build/package the game on another OS, I would happily host the binaries.
<Download the source>
<Download the game>
The art and sound are contained in the game archive, above. If you have any questions or contributions, send ’em in!