Deep Plaid

May 08

Achieving DEADLOCK in 868-HACK

I’m not always into roguelikes, and it took several attempts for 868-HACK to get under my skin, but when it did, it stuck. (It’s a good thing it did, since it had gotten under Adam’s skin too, and we’re now making a game together that takes a lot of influence from it.)

I’m a gameplay programmer by trade, so I think a lot about “edge cases”… ways to put a program into a rare and unexpected state, a state that maybe the game wasn’t coded to handle.

For instance, early on in playing 868, I noticed:

  • The .DEBUG() prog destroys enemies who are inside walls
  • The .STEP() prog lets me step inside walls

So what happens if you use .DEBUG() after you .STEP()ed inside a wall? The next time I got both of those progs, I tried it… and it killed me.

I was thrilled! The .DEBUG() prog works consistently, and arbitrarily, the way a real program would: it just kills every creature that’s overlapping something else, and is indifferent to whether or not that creature is the player. That was the moment I came to really respect the game.

But there was another edge case that started bugging me.

What if I .STEP()’ed to a position where I was surrounded by walls, and couldn’t afford to .STEP() back out? I would be stuck… right? Would the game handle this? 868’s creator Michael Brough is known for making games that you can “break” in interesting ways (my favorite is still Corrypt)… was there a chance he didn’t anticipate this edge case and I could truly break his game by getting stuck with no way to proceed?

I sat down one evening and played the game just attempting to create this scenario. It seemed like the game almost never generated a map where this was possible. After at least 20 minutes of trying, I gave up.

But when you stop looking for something, sometimes that’s when it pops up. This morning, I loaded up the game, stared at this map deciding what to do next, and realized it had a solid mass of tiles, and I also had .STEP():

(Yes, I immediately started taking screenshots, sensing the potential importance of this experiment.)

So, I .STEP()ed into a wall, leaving me with 5 energy:

…And then I .STEP()ed once more, leaving myself with just 2 energy (not enough to .STEP() back out) and surrounded by walls on all 4 sides:

…And, yes, I was stuck. I couldn’t move in any direction. The only thing I would be able to do at this point was siphon.

Some thoughts went through my head at this point. “I think I actually broke a Michael Brough game! I’m stuck and just have to quit my run!” I was excited but vaguely disappointed. Brough’s games usually break in more elegant ways.

Then I did a siphon, which of course spawned 14 creatures……. and then…

…The screen started flickering, the colors started shifting. A warp effect went across the screen. Yellow turned to red.

And the game ended, and I got this:


It was the most brilliant way for the game to handle that situation… it’s a game about hacking and I’m just a hacker that painted themselves into a corner. (Deadlocking, by the way, is the real programming term for a similar situation.)

And of course the game had to wait for me to do a siphon before it considered me deadlocked… because there were several ways that siphoning could have gotten me out of that situation (giving me a .EXCH() so that I could produce enough energy points to .STEP() again, for instance). The game correctly waited until it was a 100% certainty that I was stuck.

The best thing is that after some googling, I can’t find anyone else talking about this. (References to “deadlock code” appear twice in the game’s patch notes, but it seems like no one knows what that referred to?)

I would like to apologize to Michael for thinking that he might not have put in a brilliant and elegant way of handling this edge case… and thank Michael for making me feel like I was the first person to discover this feature/bug/experience (even though I probably wasn’t).

What a great game.

  1. webfroot reblogged this from deep-plaid and added:
    Always fun to be first
  2. ungaming reblogged this from deep-plaid
  3. lukechinworth reblogged this from deep-plaid and added:
    Epic blog post.
  4. gamearchitect reblogged this from deep-plaid
  5. deep-plaid posted this