stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Space Baby

    Space Baby - Stage 5

    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:

    1. Introduce a new mechanism
    2. Have a win condition
    3. Be publicly available online
    4. Be controllable (through keyboard at a minimum, so that trackpad users and RSI sufferers are spared)

    Space Baby - Stage One

    1. There is a Space Baby object
    2. There is a "Locomotive" object
    3. There is an Escort object
    4. The Escort object has at least two turrets
    5. The turrets fire projectiles on key press
    6. Projectiles move in the direction they were fired
    7. Turrets can be rotated through key presses
    8. The Escort object can be moved in any 2D direction
    9. Reaching the destination = win

    Play Stage One in the browser
    Arrow keys = move
    Z & X = rotate turrets
    SPACE = fire turrets

    The first delivery of the Space Baby game

    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

    1. Firing turrets have a sound effect
    2. WASD movements have a thruster visual
    3. Firing thrusters have a sound effect
    4. Escort fully disappearing from view = lose
    5. Enemies appear
    6. Enemies move in the opposite direction of the space baby
    7. Enemies shoot at the space baby
    8. Space baby 0 HP = loss
    9. Space baby has a shield
    10. Hits from the front are absorbed by the shield
    11. Shield depletes with each hit
    12. Enemies that are hit by Escort cannon fire are destroyed
    13. Enemy fire has a sound effect
    14. Enemy being destroyed has a sound effect
    15. Shield activation has a sound effect
    16. 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

    1. Escort ship can be damaged by enemy fire
    2. Escort ship disappears at 0 HP (but space baby can still survive)
    3. Getting close to destination, locomotive moves to top of space baby
    4. 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

    1. Image assets replace geometric shapes
    2. Thruster animations replace thruster triangles
    3. Explosion animation for destroyed enemies
    4. Explosion animations on the escort ship if destroyed
    5. 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

    1. Health and shield bars instead of status text
    2. Destination as large counter instead of status text
    3. Win and lose screens in large centrally aligned text
    4. 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.