|Lines of Code||6,092|
The last two weeks saw the most development time, but I paced things pretty well this time. The last day was spent packaging things up and writing documentation, rather than fixing bugs and panicking about missing features. That made a nice change.
What went right
It got done
The last game I released was back in March 2017, and even that was a half-hearted update to a flash game created in a couple of hours. Since then I've had a few tries but all have failed, so I was a little apprehensive about trying to release something this time.
Feature-wise I'm extremely happy with how things turned out. I would still like to add a fullscreen mode and an online score table, but everything else I wanted is in the game.
It got polished
Getting the core gameplay working early meant I could spend more time cleaning up the rough edges. Adding a title screen animation didn't make the game better, but I think it improved the experience and made it feel complete.
There are other little improvements like animated plants on the ocean floor, homing missiles from powerups, and a full morning-day-night cycle of backgrounds.
Entity component systems are really useful
Years ago I built an ECS for my game engine and it has been a huge time saver. Being able to modify the behaviour of a game entity by adding and removing components works really well, and keeping the actual behaviour code in systems makes it easier for me to organize things.
Data-driven entities are really useful too
At the start of the project a lot of data was hard-coded, but I slowly moved things to be loaded from template files. This had a couple of benefits:
- It was much easier to test out new ideas - I could modify how may explosions come from a depth charge, how often submarines fire missiles, how fast the ship moves, and a whole bunch of other things, all without recompiling.
- The template system uses inheritance - I created a base type of submarine that all others extend, so adding a new type of submarine could be done in a couple of minutes.
- Balancing the game took much less time. I was able to tweak individual levels and play the results within seconds.
Getting rapid feedback makes balancing much easier, and it also encourages experimentation with gameplay elements. I'm much more likely to test an idea if I can create it, test it, and then remove it within a span of 5 minutes
What went wrong
Early decisions came back to bite me
A few days into development I noticed some weird behaviour with powerup crates; they were being spawned correctly, but the second crate that dropped would wobble erratically. Picking up one of these wobbly crates would grant two or more powerups, and they would explode multiple times.
After some digging I found the problem. It was a pretty fundamental one.
The ECS system I built stored system associations in a 32 bit variable. This made it extremely fast to check if an entity had a component as it could be done with a single bitwise check.
However, once system 33 was added the bit wrapped back to its initial position and things got weird. The powerup crate handler was system 33.
Fixing this bug took a couple of days and involved a rewrite of some pretty fundamental code.
When I wrote things originally I took an "I'll cross that bridge when I get to it". Well I got to that bridge and had to cross it, so thanks for nothing past me.
Hardware is hard
Adding controller support was a pain. The same controller gives different input values on Windows and Linux, so each system needs its own mapping. And of course different controller also needs a different maps.
I also spent a couple of hours trying (and failing) to get Microsoft Windows to recognize Microsoft hardware. Good times.
I'm still not happy with how this turned out and I think I'll give it another go in the future.
Nobody played it
Splodey Boats 2000 has received a whopping 12 views and 7 downloads on itch.io. Considering it was part of a game jam with nearly 400 entrants I'm pretty disappointed with these stats.
Entity systems work really well
About a week from the deadline I decided to add boss submarines. I already had a
health component for the player ship, so I added that to the base
entity and tweaked the collision system to use it. It was a quick change and it
made me happy that it was so easy.
A small amount of customization goes a long way
Levels can choose which kinds of submarines they spawn, as well as how often and how many. These are all small variables, but it means I can have a level with 1 boss submarine, or a level with 10 speedy subs on screen at the same time. All with just a change of a level file.
Small amounts of polish go a long way
The title screen animations aren't going to win any awards, but they made the game feel finished.
Spend time making your game easier to test
I added keyboard shortcuts to skip levels, spawn entities, and test different powerups. This saved a tonne of time when balancing later levels.