A 7DRL (7-Day Roguelike) based on Steven L. Peck's A Short Stay in Hell, itself inspired by Borges' The Library of Babel.*

play in browser →

play in browser (simmode) →

what it is

I recently read A Short Stay in Hell, which is a fine little novella about how much it would suck to have to find a single book in the Borges' Library of Babel and how, really, Hell is other people. Casting around for ideas on what to make for 7drl I struck on this, held on tightly, and did not let go.

In Peck's version, the library is composed of books which have 410 pages, 40 lines of 80 characters, drawn from ASCII codepoints 32-126. There are 951,312,000 books which is roughly 102,594,773. The observable universe is made up of about 1080 atoms.

In the game you are spawned relatively close to your book and told, roughly, where it is. Other NPCs are spawned with the same general goal as you, except that they are not told where their book is and also they will never find it because the Library is larger than anything we could possibly compute. There are some simple survival mechanics, except you are also immortal and get resurrected at dawn. There's some psychological stuff that didn't get expanded on too much.

There is also social simulation system. This does not matter to play, because it takes decades of gameplay for people to start cracking. But it was interesting enough to me that I rolled out the simmode interface where you can watch all the NPCs walking around and fastforward until they all go catatonic.

the book

I wanted the game to be winnable in theory. The only way this happens is if you're close enough to your book that it fits in the precision range allowed by the underlying code. So: Generate the player's life story. Each story is a base-95 number with 1,312,000 digits. Convert that to base-10 and use that as your base offset. You can place the book at the origin but I added an origin offset so it wouldn't always be at (0,0).

Place the player far away from the book. It generally would take more than 10,000 years of continuous to get to the book, for us, but that's fine. It exists in the library. For NPCs we generate their stories as well and compare their story's number difference from the base offset. If it's within the bounds of the library, they got lucky and their book is findable. Otherwise their book is impossible to get. They don't know that, though.

Prior work made use of an invertible PRNG. I just used algebra; we needed a bijection from stories to locations and stories are already a kind of number. You can't do stuff like "find a book with a particular word" in this version but that's fine.

If I did this again I'd probably put a lot more emphasis on understanding and charting out this particular part of the project. It's the conceptually richest part and I feel like I got a better understanding of the shape of the Library. All books exist in the natural numbers.

notes on agentic programming

There's no way I could have built this without a coding agent. I did a few sweeping refactors of the whole codebase - I got rid of Twine in favor of my own SPA, I migrated to TypeScript, I moved all my numerical code to BigInt in order to expand the possible space of the library. And all that work was just kind of done for me, in parallel, as I worked on other stuff.

Tests are free in the new regime. Every single behavior, every interaction, can and should be subject to some annoying little test that you luckily do not have to write anymore.

I did end up using it for some of the writing copy, which I did not particularly enjoy but writing is hard and I am already using my language for other purposes. It's fine.