Space Baby
My hard drives are dystopian landscapes littered with abandoned construction sites, rusting tower cranes, collapsed structures, and slowly decomposing hand-drawn blueprints representing Django websites, Rails websites, coding exercises, desktop tools, testing tools, and other small applications created in versions of Python from 2.6 to 3.9 and Ruby 1.9 to 3.0, HTML/CSS/JS adventures from the late 90s onwards, and a scattering of other programming debris in PHP, Java, PowerBuilder, and C++.
This calls for a change.
I decided to start a new project, as I always do, but this time I would get with the times and start with the smallest possible version of it that works and actually publish it - and then iterate on it.
Space Baby is a Lua/LÖVE game. I started with the idea that an infant self-aware semi-organic space station would need to be moved to a new colony planet and escorted by a war ship that would need to fight off enemies until the destination is reached. The space baby would have sound effects recorded from my own daughter.
I set the objective that at each stage of development, the game should:
- Introduce a new mechanism
- Have a win condition
- Be publicly available online
- Be controllable (through keyboard at a minimum, so that trackpad users and RSI sufferers are spared)
Space Baby - Stage One
- There is a Space Baby object
- There is a "Locomotive" object
- There is an Escort object
- The Escort object has at least two turrets
- The turrets fire projectiles on key press
- Projectiles move in the direction they were fired
- Turrets can be rotated through key presses
- The Escort object can be moved in any 2D direction
- Reaching the destination = win
Play Stage One in the browser
Arrow keys = move
Z & X = rotate turrets
SPACE = fire turrets
I underestimated Stage One. I should have limited it further, perhaps by starting with just an escort ship in the centre of the screen firing a single turret. The first stage creates the skeleton for future development, so takes longer than it otherwise would.
It's very tempting if not irresistible to do more than the minimum required, to ignore the YAGNI principle. Making a ship shoot projectiles is one thing, but those projectiles would continue to fly outside of the viewable area - thereby affecting performance - unless you clean them up when they're out of bounds. The impact on performance is negligible for this first stage and performance itself is not a concern at this stage either, but I couldn't help myself.
Space Baby - Stage Two
- Firing turrets have a sound effect
- WASD movements have a thruster visual
- Firing thrusters have a sound effect
- Escort fully disappearing from view = lose
- Enemies appear
- Enemies move in the opposite direction of the space baby
- Enemies shoot at the space baby
- Space baby 0 HP = loss
- Space baby has a shield
- Hits from the front are absorbed by the shield
- Shield depletes with each hit
- Enemies that are hit by Escort cannon fire are destroyed
- Enemy fire has a sound effect
- Enemy being destroyed has a sound effect
- Shield activation has a sound effect
- Space baby being below 20 HP has a sound effect
Play Stage Two in the browser
Arrow keys = move
Z & X = rotate turrets
SPACE = fire turrets
The second stage was supposed to cover only sound effects and a visual effect for thrusters, to make the repeated play testing more enjoyable, plus a lose condition to meet the rule that a new mechanism should be introduced at each stage.
I ended up adding a lot more, because it seemed absurd that I wouldn't be adding any challenge yet. The change of plan is okay, what's less okay is that I didn't then move out what I had planned. Why would I make sure in a professional environment that when some work is added to the current load that other work moves out, but ignore that principle in my personal projects? The answer is that no-one else expects anything from it. The only consequence for failing to produce working versions of this personal mini project is my own mild disappointment.
For the stages that follow, however, I will introduce a new rule: no more than 5 items per stage. It's arbitrary, sure, and I could manipulate it to cover a lot of functionality with a single line, but I will take those shortcomings for granted because it's useful enough.
Space Baby - Stage Three
- Escort ship can be damaged by enemy fire
- Escort ship disappears at 0 HP (but space baby can still survive)
- Getting close to destination, locomotive moves to top of space baby
- Locomotive fires thrusters to slow down the space baby
Play Stage Three in the browser
Arrow keys = move
Z & X = rotate turrets
SPACE = fire turrets
This stage was created within an hour, a much faster increment than the previous two stages. I abided by the rule I set after stage two, and I avoided the overcommitment from stage one by noting down that I should - for example - ensure the ships (and stars) slow down when they get closer to the destination, instead of implementing it straight away.
Space Baby - Stage Four
- Image assets replace geometric shapes
- Thruster animations replace thruster triangles
- Explosion animation for destroyed enemies
- Explosion animations on the escort ship if destroyed
- Enemies can be on a diagonal trajectory
Play Stage Four in the browser
Arrow keys = move
Z & X = rotate turrets
SPACE = fire turrets
In this stage again I applied the rules of simplicity and deferral. Giving enemies random paths with changes in direction would have also meant adding appropriate rotation, thrusters, and acceleration to them, so I limited myself to giving them random diagonal trajectories. For the animations I initially tried using libraries to animate spritesheets, but they were causing more grief than good so I did simple animations myself.
Space Baby - Stage Five
- Health and shield bars instead of status text
- Destination as large counter instead of status text
- Win and lose screens in large centrally aligned text
- Slower travel once the locomotive engages reverse thrusters
Play Stage Five in the browser
Arrow keys = move
Z & X = rotate turrets
SPACE = fire turrets
This was an uncomplicated stage with a few last touches I thought were necessary to have a version that resembles a complete basic game. I did abandon my original idea of having my own baby's sounds added as sound effects the infant space station produces and there's an easily fixable bug where the win screen does not persist, but my goal has been reached of creating something that actually works, that is publicly available, and which I've iterated on in small increments. I could of course also keep going with additional stages, though with what I have learned from this project I have new ideas for projects I'd like to complete.