Secondary menu

Post navigation

Bomb n Build

If you stalk back to my much earlier posts, you’ll find a few related to game development – this was one of the things that kept me sane in my pre-Software Engineer days. However, recently I realized I do miss the creative aspect and the original challenges presented by game dev.

A few weeks ago, I had a three-day weekend without much planned and hadn’t worked on much outside of work for a while, so I decided to see if I could make a project in a weekend. I had various ideas (e.g. bouldering tracker, morning routine timer), but eventually decided to make a simple multiplayer game (top tip: don’t ever think you can *complete* a multiplayer game in a weekend having never made a multiplayer game before). I immediately remembered one of my old unfinished games that had Bomberman-like gameplay, but with a destructible/upgradeable environment, so ever bomb you dropped killed enemies but also destroyed walls and floors, but separately you could repair floors and build new walls to block enemy progress. I figured the mechanics were pretty straightforward so it shouldn’t be too difficult.

Getting the core game working actually *wasn’t* too difficult. However, once I had implemented I decided I wanted to share it to get some feedback. At this point it occurred to me that my game was hugely exploitable: my client-side code was largely authoritative, so it would be fairly trivial for someone to hack it to enable them to, say, drop a bomb anywhere in the arena at any time, or not register themselves as having been killed by a blast.

I realized I needed to re-implement a large portion of the netcode to make it server-authoritative, which took quite a while because I kept trying to overcomplicate everything. Eventually, I went for a much simpler approach where the client was an almost dumb terminal that just sent keypresses to the server, and the server would calculate what happens next in the game and then update the clients with continuous updates. The drawback of this approach is that there is currently no lag compensation, so depending on the latency from client to server, there could be a noticeable delay between pressing a key and seeing an action.

The graphics are placeholders for now (the tiles are from one of my old games, so I may keep those, but the player characters are from the free kenney.nl packs), and there’s no sound or music, and it’s not too pretty, but it works!