GioCities

blogs by Gio

Hack ‘n’ Slash is awe inspiring

Hack ‘n’ Slash is a game about hacking (and comparatively little slashing) published by DoubleFine (of Psychonauts fame) in 2014. It features art by Raz Mavlian and it’s directed by absolute madman Brandon Dillon. It’s not a “programming” game (like 7 Billion Humans, a Zachtronics game, or even Quadrilateral Cowboy), and it’s not at all the action-adventure game it pretends to be at the beginning. It’s very much a game about game hacking, and that goes to some fascinating places.

I’m looking now and of the ~16 games DoubleFine has on Steam, Hack ‘n’ slash is the only one with “Mixed” reviews. This is a tragedy, as Hack ‘n’ slash is most interesting games I’ve ever seen in my life. It’s a strange case, though. Although I have an overwhelming amount of praise to give the game, there are a few oddities that make it hard for me to directly recommend everyone buy and play it. I’ll get to that later.

Why Hack 'n' Slash is incredible🔗

or, the ride the game takes you on

I’ve been trying to figure out the best way to explain why Hack ‘n’ Slash is so brilliant, and I think I’m going to have to go with a walkthrough of the mechanical progression of the game.

This is because:

  • Hack ‘n’ Slash has like 8(!) distinct mechanical tiers and
  • It’s very difficult to convey how crazy the later tiers are without going through the path to them

I’m also going to skip over any mention of the game’s plot, because the mesanarrative is almost completely secondary to the real adventure, which is the mechanical progression.

I mentioned earlier that, at the beginning of the game, it pretends to be a Zelda-inspired action game, complete with a nameable hero in a green cap and their fairy friend. She also starts by finding a sword.

The sword is a farce, and breaks the first time it hits anything. It’s really a USB interface that lets you adjust parameters of objects in the world with USB ports. Live variable manipulation, in other words.

There are a few different puzzles using this mechanic in the first grassy area, mostly involving pushable blocks (which you usually have to hack to push at all) and swamp turtles. This is generally just to progress, although there are several puzzles to find optional artifact items that set specific global variables.

Hackable entities have more complex parameters, and even have structured behaviour loops that can be fully rewritten with the sword.

Even with just variables, there are a few interesting ways to exploit enemies. For instance, you can set birds to keep following you and attacking, but set their strength to a negative number to keep yourself healed. Stuff like that.

Tree

Another artifact the game gives you early on is the amulet, which lets you rewind the game state to an earlier point. The game actually stores a full state tree; if you rewind to an earlier point and continue from there, it will create two parallel branches you can jump between using the amulet. This is also what happens if you die, or if the game crashes.

This visual save tree is the most robust anti-softlock mechanism I’ve ever seen in a game. It turns out this is very important, as there are a number of ways to softlock the game and trap yourself. Later on it’s also possible (actually, a common fail state) to crash the game if you make an error, and the amulet serves as (the only) exception handler.

checkDay

There’s also a stone tablet labelled “checkDay” that shows the checkDay function and its definition. This is written in byte-compiled Lua; note the base instructions on the left, the use of continue in place of control flow structures, and the use of coloured diamonds as ephemeral registers.

You can’t do anything with this code yet, but if you read it you learn that you can use an artifact to manipulate days to spawn a chest.

And then there are more puzzles and you’re thrown in prison and lose your sword for a little while, but you get a cool hat.

The invisibility hat shows you the internal state debugging information for the room you’re in: the name, size, and position of each object in the room, as well as hitboxes for floor areas and pits, and FOVs of enemies. (Note the white lines that act as event triggers.)

The names, though, are in an unreadable glyph font. Until you find the font room.

The font room has a puzzle to align an english pangram overtop the glyph font, which when completed also effects your view with the hat. This lets you see names of objects, and also talk to a few characters whose dialogue would otherwise be illegible.

This isn’t a giant mechanical leap, but one of the puzzles in the dungeon area is this giant working cylindrical lock, which you have to open by looking at how the pins are placed on the hitbox of the the cross-section and manually rotating the center ring. Love it.

There are two new major artifacts in the dungeon: a location-finding pyramid and a genie lamp. The pyramid takes a user-input value and tries to locate the identifier of the variable that currently has that value, and fails if you search for a value held by more than one variable. (It also seems to work if you give it the exact name of a variable.) The genie lamp takes whatever identifier the pyramid last found and lets the player write an arbitrary value to that location.

The last major puzzle of the dungeon requires you to do this to change the player’s own name so they’re no longer identified as “wanted”. You have three wishes, so you can hack a global variable like this three times. Except, if you want, you can search for “wishes”, write “9999”, and you’ve got 9999 fresh wishes. This isn’t a sandboxed puzzle, this is a real inspector that will really overwrite any variable.

checkDay

And then you get the loupe. Remember the checkDay tablet that exposed a view into some Lua code? If you use the loupe on one of those tablets, you get dropped into a red algorithm room.

The algorithm room formats the Lua bytecode as discrete physical objects. Each operation is a different kind of machine. All hardcoded literals can be directly edited here, and machines can be hacked directly. When you leave the room, your changes are saved. It recompiles the function, replaces the source code file both on your disk and in memory, and objects immediately start using the new behaviour. Yes, really.

If the genie didn’t give it away, this is where the madness starts.

And then — and then — you get the breakpoint bombs.

You’ve had a few puzzles in this cave area with the loupe, but of course it only works on these exposed Lua functions.

The breakpoint bombs let you break into the algorithm rooms for all the functions of any object you can hit. All their functions are exposed as machines you can loupe into and edit.

And yes, breakpoint bombs work inside algorithm rooms. The last bomb puzzle has an algorithm room machine that’s “protected”, so you can’t loupe it. But if you bomb it, you can edit the machine to redefine how protection works, save the machine, and un-protect it that way.

Now, I said “last bomb puzzle”. You’re probably wondering how there could be a “last bomb puzzle”. Is the game over, or is there some cheap plot twist where they take your weapon away again? There isn’t really anywhere you can go from here, is there? Well,

Enter the final castle and you’ll gain access to the library of babel. The library of babel is an in-game interface to the full source code of the game. Each file is a book on one of the shelves, each floor is a folder, each staircase is a directory traversal.

The name of the library and the hexagonal shape of the rooms are an homage to the Jorge Luis Borges story of the same name.

You use the library to solve the last few puzzles of the game by finding where the logic you want to modify is in the library, taking the book, and manipulating arbitrary lua bytecode. And that, finally, is as powerful as you can get.

The last puzzle in the game is the roof. There’s a pedestal on the roof that encrypts books, making the file unreadable and any parts of the game that try to reference an encrypted file crash. The last room is on the right side of the roof, but its book is encrypted on the pedestal. Find the place in the game code that encrypted it, decrypt the book, and you win the game.

…There is one more puzzle in the postgame, though, and it sends me into a spiral every time I think about it. With enough items, you can change the root directory of the library to one folder higher, and access a book called SecretRoom.lua. Unfortunately, it’s encrypted, and it was encrypted outside the game — so you have to find the real password before you can read the book or enter the secret room. To date, no one has managed to do this, and someone has even put a $100 bounty on the challenge.

The problems🔗

The problem is that you can’t balance a game like this. I mean, really.

The early-game puzzles are very straightforward “change a property of a thing” affairs that I would expect out of a flash game. There’s a solid middle stretch in the dungeon area, but after you finish that there’s nothing to do but go straight for the loupe and bombs. The loupe tutorial is also a solid little programming challenge, but once you have the bombs and library you end up having almost too many options for how to solve things.

The items are also pretty quickly obviated. Once you finish their tutorials and learn how to use them effectively, you’re very quickly handed a new mechanic that takes the place of the old ones, just due to it being more powerful overall. Some mechanics (the lamp and genie1, among others) are really only useful one time in the whole game.

Because you’re interacting with Lua bytecode, there’s not really much you can do in terms of rewriting code, or manipulating control structures. Most of the algorithm room puzzles consist of reading the bytecode, figuring out what it does, and changing something basic (a boolean, a number, an operator…) to short-circuit it. I don’t really think they could have designed better puzzles, either; I think it’s just a constraint of this incredibly ambitious feature set.

I mentioned flash games earlier. There’s a lot about Hack ‘n’ slash that just feels a little bit unfinished. Lots of places with strange collision detection, or environments drawn such that it’s not clear what areas are walkable terrain and which are death. Bizarrely, death pits in this game have a slight magnetism to them, so if you’re standing on a ledge and not moving anywhere you’ll slowly slip into the abyss.

So, while the main ideas of the hacking mechanics are brilliant and generally well-implemented, it’s still hard to give this game an unqualified recommendation. As much as I love it, the overall “game experience” leaves something to be desired, but in an odd way where I don’t see any obvious way of improving things.

Other thinkings🔗

This is one of the games that’s stuck in the back of my head for years as something to aspire to as a creator. It opens up levels of introspection I haven’t seen any other game do before or since, and earned its place as a stand-out in the world of programming games.

Comments

Loading...