Bouncy Boar 3 now available to play online
After 10(!) years of its source code sitting there bit-rotting on my hard drive, Bouncy Boar 3 (2009) has been ported and can finally be played online!
Try it out online!
Bouncy Boar 3 was a short 3d platforming game that I wrote in 2009 for a school project. It was my first foray into 3d computer graphics and one of the first "complex" projects that I have ever done and one of the milestones of my programming adventure.
However, if one tries to run it now, one simply gets this:
It turns out that the world of technology has changed drastically since then. When it comes to preserving it and sharing it with others, the choice of programming language and libraries turns out to be a problem. For one, it is written in Visual Basic.NET, which, at that time, produced executables that could only run on Windows. Secondly, it can't run in web browsers, so it is hard to share it with other people. Thirdly, it uses the OGRE 3d rendering engine for graphics and SDL_mixer for audio. These libraries still exist, but to interop with VB.Net, the MOGRE bindings and Tao framework bindings were used, but nowadays these bindings are not maintained anymore, and compiled versions can't easily be found.
So, with no way to run it, the code base just sat there rotting in my hard drive :-(.
Till now, of course.
Goals of the port
The recent development of bpat provided an opportunity for me to get the software running again, while porting it to the web and mobile as well.
The main goal of the port is to get it off Visual Basic.NET, OGRE and SDL onto bpat to allow it to run on different operating systems (especially Linux --- the one I'm currently using), as well as the web so that I can easily share it with others.
In addition, I wanted the port to be easily maintainable as well, so that it would never bit-rot again :-).
Changes from the original version
Originally, I planned to port the code as faithfully as possible, recreating all of its cringe-worthiness in full glory. However, it turned out to be more effort than its worth --- the me of 10 years ago wrote code that was extremely verbose --- if I tried to replicate the verbose-ness, the resulting code would not be easily maintainable, which goes against the reason why I wanted to do this port in the first place. As such, I settled with just ensuring that the port replicated the original behavior of the game where feasible.
Altogether, the following changes were made:
Custom OpenGL 3d engine. Rather than using the OGRE 3d rendering engine, the ported Bouncy Boar 3 uses its own custom 3d engine. To be compatible with WebGL (and to not have to ship a Cg compiler), all of the shaders have been re-written into GLSL.
Logic tick rate. 10-years-ago me thought that it would be a smart idea to run the game logic at 120 ticks per second, even though the game would never be rendered at more than 60 FPS due to vsync. The game logic in the port now runs at 60 ticks per second, and constants were adjusted (using a bit of math) so that the port would produce the same behavior.
ECS Architecture. The old code used a basic "one class per game object type" architecture, which led to duplicate code in some areas where inheritance couldn't be used to share code due to the inflexibility of the inheritance hierarchy used. For example, the player, coins and boulders each had their own code for drawing shadows. This has been changed by doing away with inheritance and using the Entity-Component-System pattern, and shadows are now implemented via a single "Shadow" component.
Directional Lights only. To simplify implementation, the lighting model was simplified to just using a single static directional light, as opposed to the original game which used point light sources everywhere. The end result still looks mostly the same since the original game didn't really take advantage of lighting.
Touch controls added. Given that the game can now be played on the web, which most players would be accessing via their mobile phones, touch controls are needed.
At first, I allowed the user to precisely control the direction of the player character. However, it turns out that the original game wasn't really designed for that --- the platforms are quite small and the player would easily fall off as long as their jumps were a few degrees off. Also, it exposed some bugs in the player physics code, preserving the character's speed and making the character go zooming off even at tight turns :-P. As such, I adjusted the touch controls to snap the direction to 45-degree angles.
Gameplay prompts added. Play testing showed that players didn't know what the goal of the game was. This was fine with the original game since it was meant to be played in an exhibition-style setting, where there would be people on hand to tell the player what to do. Now that the game can be played on the web without any guidance, however, additional prompts are needed.
Modified title screen. Play testing showed that players didn't know how to start the game as the title screen was... cryptic. There's now a pretty prominent "Start Game" pad that you can now stand on.
New music. Due to uh... copyright issues :-P the game now uses CC0 music.
I'm pretty excited about this reason for two reasons.
Firstly, the success of this port means that bpat has matured enough that it can be used on (small-ish) video games, and I can't wait to use it on more complex projects in the future.
Secondly, even though in this present age of ready-made 3d game engines Bouncy Boar 3 may not seem like much, it was one of my first few milestones since I started doing this programming thing, which is why I remember it pretty fondly. It's also probably my oldest code base that has been preserved till now, and a great look into my thought patterns and code style when I was first starting out. With this port, I'm glad that I can finally easily share it with the rest of the world.