Diary of a Game

BLaTTiX - Fri, 06 Aug 2021 15:35:10 GMT

It was a lot of fun making BLaTTiX. Well, the first 90% was at least. That’s when I got to solve lots of interesting technical problems. But then I hit a wall; I had a tech demo but no gameplay, and the only way forward involved lots of boring work. Yikes! Looking back at the many abandoned half-implemented hobby projects that litter my past, I realised that it was at this point, on the brink of the “dark pit of despair”, that I usually gave up.

Well, not this time! I rolled up my sleeves and forged ahead. Actually, no… I took a family holiday instead. Sitting in a beach house over a wintery five days, I read Klara and the Sun cover-to-cover while sipping beer and glancing out at the stormy surf. This self-imposed screen ban served its purpose. I returned to work to find myself on the other side of the dreaded pit; I could see the finish line and knew how to reach it.

Three weeks of crunch followed. I implemented everything needed to turn the tech demo into a playable, fun shoot-em-up. And it didn’t take as much effort as I thought, because I was building on top of a solid framework where all the hard problems (player controls, physics, UI, build and deployment… the list goes on) had already been solved. The majority of my time during this period was spent playing and tweaking until everything felt right.

Then, late one Sunday evening, I pushed the enter key and shipped the game to the world, where it is now available to millions of potential customers. And… nothing happened. Well, a few sympathetic purchases were made by friends, but, apart from that, I could almost hear the crickets chirping. I had discovered a second “dark pit of despair” laying beyond the first! And this one, I fear, is deeper, darker, and more treacherous to cross.

And that’s where I am now, and partly why I’m writing this. But, first, let me tell you the story of how all this came to be…

The Punk Collective

In January 2021 I scaled back my work at a startup in order to focus on other things. I wasn’t getting any younger (I’d just turned 0x31, and had a list of projects that I wanted to try my hand at. And so I started work on building the web framework of my dreams. I reached out to three friends who were doing similar solo development work (but in games), and we started meeting up once a week for coffee, to chat and to motivate one another.

After a few weeks, we somehow landed on the idea of starting a co-op of sorts, which we named The Punk Collective. Punk in that we just wanted to build stuff without being held back by the system, man. And collective in that there were a bunch of us doing the same thing, with each of us doing our own thing. Together, but separate. A counterculture, not a company.

We challenged each other to build a game in three calendar months, thinking that, at the end of three months, we’d have four games. These could be released a month at a time, and would perhaps build up a small audience of followers, and we might be able to make enough money to justify making four more games. All a bit unspecific, but the punks in us weren’t deterred, they just wanted to create things. And so it was agreed.

Inspiration

I had always wanted to make an old-school racing game, like Pole Position or Outrun — I really wanted to do something with sprite scaling and a raster effect for a road, instead of using a proper 3D game engine. I also loved the “vectorball” effect in old C64 and Amiga demos, such as the Red Sector Mega Demo. In fact, about a year before all of this, I had hacked up a vectorball effect using Raylib. Here it is in action:

BallsUp! is available here: https://github.com/kranzky/ballsup

I realised that I could combine vectorball enemies with a rasterized checkerboard ground to create a game along the lines of Encounter, by the legendary Paul Woakes (RIP), on the C64, which I loved.

I had also been playing a lot of 1942 at The Palace Arcade. I liked the flow of the game; waves of enemies, picking up health, scoring bonus points based on your hit ratio, a brief respite between stages.

I thought all of these things would work in my favour. Few assets required and a focus on replayability instead of narrative would make it easier to create a fun, playable game in such a short period of time.

Diary of a Game

Back in the 80s Zzap!64 published several “diary of a game” features over multiple issues by the likes of Andrew Braybrook and Jeff Minter. I devoured these as a kid, and will utterly fail to reproduce anything like them here, because I simply did not keep track of what I was doing day-to-day. But here’s an attempt at reconstructing something from git commits and itch posts.

Week 1

Met with the punks at Greens, where I had a long mac and pistachio cheesecake. Decided to make a game each in three months. Bonkers. Back home I took the BallsUp! code and got it running again. Stripped it down to just render a single ball. Ahh, “modern” C and Makefiles… heaven.

Found a website showing how to render a checkerboard floor using shader code, so put that in. Needed to change things to work with Raylib, but looks neat. Hooked up keyboard and mouse to move the camera around; took some effort to make sure the ball and the checkerboard floor match up.

Put a ceiling in too, which involved a few changes to the shader code to replicate the floor. Kinda looks like there’s a wall in the distance until you realise it’s the thin sliver of sky between floor and ceiling.

Week 4

Where did the time go? Met up with the other punks and they’re making good progress. Committed to the wall idea by changing the shader code to render the sliver of sky so it looks a bit more solid like. I’ve decided to call the game “BLaTTiX”, abandoning my earlier choice of “Splattice” (because you run around in a lattice making things go splat… ok, not my finest hour).

Week 5

Burgers and beer with the other punks, and toured a nice co-working space. Think working together one day a week would be good instead of just meeting up for food. But then a COVID lockdown hit, which put that idea to bed.

Got some foundation work done: title screen, build system, versioning, deploying to itch… I always like to get this sorted early on.

Realised the ball looks a bit weird by itself, so rendered a shadow and a reflection, which was easy to fake. Then hooked up controls so you could add balls while flying around. Drew some interesting shapes.

Week 6

Continued the foundation work by getting a Windows (uppercase) build working. And got window (lowercase) resizing working, with the playfield either being letterboxed or pillarboxed so I can work with a fixed resolution regardless of the window size.

Bought some great music… ten tracks for $100 with a license to republish in a game, which is a right bargain. Spent the rest of the day listening to the tracks and deciding which would be for the title screen, which for blasting beasties in an arena, which for bonus rounds and so on. Can picture it all in my head.

Found Flecs which looks amazing and put it in. This broke mouse controls, reflections and shadows, but I’ll get them fixed. Invited a bunch of alpha testers by sending out download keys. Will be good to get some feedback.

Week 7

More foundation work, building managers to handle loading assets like textures, music, sfx and so on. Boring stuff, but much needed.

Flying around adding balls has become shooting bullets! Added some basic physics so balls would zap away from you, then rendered them all glowy so they’d look a bit more like fire. Then worked on collisions to get the balls bouncing off everything, which was tricky to get right, especially with the curved walls around the arena. But it controls well and feels fun. Celebrated with a glass of Dirty Dan’s.

Week 10

Finally finished the Flecs integration. I really should have added it at the start. But love using it; makes it so easy to add new effects or tweak a system without worrying about everything else. Linux build is working (one of the testers prefers to use it), pretty easy to do with Raylib. And lots more time with physics and collisions, which are a right beast to get working perfectly. Really should reconsider writing things from first principles sometimes. But with everything made from balls, I thought it’d be easier to do things myself. Oh well, you live and you learn!

First day at the co-working space. Weird, but putting headphones on and coding alongside three other punks is super productive compared with the distractions of a home office.

More boring foundation work; the UI system with basic menus is now in. Pretty painless thanks to Flecs. And I spent hours figuring out that I needed to add a .clang-format file to get VSCode not to screw up the formatting of the macros that Flecs uses. That had been annoying me for a while. Working on the strafing controls to get them feeling perfect, which was feedback from one of the alpha testers. He wanted an “invert y-axis” option, so bunged that in too.

Week 11

Got a HUD in and rendered a simple radar, like in Backlash on the Amiga. Looks great with some “enemies” based on my old BallsUp! demo scattered around the shop.

Decided that the game would consist of five planets, Neptune down to Mars, with three stages per planet and bonus warp stages in-between. Fleshed our that idea a bit by coding up screens to introduce each planet and get the player ready for some ball blasting action. Wa-hey!

Wrote a Ruby script to generate JSON data for a vectorball model, then integrated cJSON to get that loaded in game. Works well.

Week 15

Well, we should have finished out games by now. Been moving slowly over the last few weeks. Another lockdown didn’t help. Just can’t find our mojo. Met with the punks and decided to extend by another month.

Had to do a massive refactor to physics and collisions to nut out some bugs. It’s solid as a rock now, but I was crying blood forcing myself to work on it.

Once that was done I added a damage model, meaning the player can finally have their health depleted and be destroyed! Small victories. This means the balls can be destroyed too, so I added an explosion animation for that.

Worked on 2D and 3D starfields with trails during lockdown, which was fun.

Week 16

The last of the foundation work completed! Things like score and lives, extra lives, overlay screens with stats between stages, a player death sequence, win and lose screens. Feels great to play, but you’re only blasting balls. No challenge; nothing shoots back. Feel depressed; this is going to take forever.

Off on a family holiday for five days. No screens. Plan to read books and relax.

Returned from the holiday to add the warp sequence between planets, which is just for points and to give the player a rest.

Week 18

Got a basic UFO enemy in, nice to have something that shoots back! Made them avoid other UFOs and move towards the player. Scattered some balls around the place too; you can use them as cover or push them towards the enemies to get them to move somewhere.

Added health pickups to establish a simple economy; blast the enemies until your health is depleted, then switch to blasting balls to restore health, rinse and repeat. Feels like we have a game!

Worked on seven or eight other enemy types. Each based on the UFO but with different behaviour. A tank is stuck to the floor and tries to flank the player, a homing missile pursues them and kills on contact, a galaxian just hovers around randomly, another one runs away and takes pot-shots from a distance.

Week 19

Met with the punks and decided my game was most complete, so would be the first to ship. Happy with that. Added a credit sequence, displayed and persisted the high score, and spent most of the day playing and tweaking until everything felt tight.

One final bug with enemy damage, where some shots just weren’t getting counted. This turned out to be a problem with my mental model of how Flecs works, so sorted that out eventually.

Did a final release build and had a playthrough. After 45 minutes I barely scraped through and beat the game, so I reckon the balance is spot-on. Had a second bash later in the day and lost my last life on the penultimate level! Recorded that playthrough and cut a simple trailer from it.

After that I released the build to itch and posted an announcement to my socials before falling asleep. Really proud of what I’ve achieved and hope that peeps will have a blast playing the game!

What I Learned

I hope that’s given you a good overall impression of why I made BLaTTiX and how I went about making it. I thought I’d end with some lessons learned.

  1. Don’t write your own physics and collision system for your very first indie game project. Especially if you want to finish in three months.
  2. Be more aggressive cutting scope, and do so earlier in the project. I thought I was going to add boss fights right up to the last week.
  3. Choose your tech early and stick to it. Refactoring sucks, and even though Flecs is amazing, I wish I’d had it in week #1 instead of week #10.
  4. Get a release out early. I did manage this, and it really helps. Sorting out the build system and how to distribute is one less thing to worry about.
  5. Nail controls early. I also managed this. For most of its development, BLaTTiX was an empty space you could dart around in, but it felt good.
  6. Spend a lot of time playing your game. I would constantly play and tweak and then play again, without even waiting to write down a task to work on.
  7. Trick yourself to start working in the morning. This seems corny, but it’s so true. Motivation is a beast to tame, and you can do so by adding some simple thing to fix at the top of your to-do list, and knocking it off at the start of each day. That builds momentum to move on to something bigger.
  8. Work with others. This one surprised me, because I always hated working in a distraction-filled office. But working alongside other motivated people can be inspiring, even if you’re working on different things.
  9. Know that there will always be off days, where you’ll hate your game and think it’ll never be finished. This happens to all projects. When it happens to yours, take the hint and spend some time away from it.
  10. You’ll feel like you’re 90% done when there’s still 90% left to do, and when you’re 100% done you’ll realise you’re only halfway through. That’s life.

The Future

Over the coming months, The Punk Collective will release our other three games, and we’ll work together to figure out how best to get them noticed. I play to release a Raylib-Flecs starter kit to help others get started, and I will then build my next game using that starter kit.

My next game will be about 25% of the scope of BLaTTiX, and will hopefully take no more than a month to complete. Watch this space, and thanks for reading to the very bottom you absolute champion!

Check out the BLaTTiX gameplay trailer below: