LockerGnomeTech news and nostalgia for today's technology professionals
Subscribe

Search

Hacks & Builds

This 3D Library of Babel Lets You Wander Its Hexagon Rooms and Chat With Other Readers

A GitHub developer going by skorotkiewicz built the maze for the browser, with multiplayer tucked behind a switch that starts in the off position.

Chris, in a long scholar's coat, kneels in a hexagonal library and slides a book from a low shelf while another reader stands in a distant archway, all rendered in inlaid hardstone.
Illustration: LockerGnome

A developer who goes by skorotkiewicz has turned the Library of Babel into a place you can walk around. The name comes from Jorge Luis Borges’s story about a library of hexagonal rooms, and this version takes the floor plan seriously.

Short hallways join the reading rooms on each floor. Every fourth hallway has stairs going up and down, so you can take your confusion to a whole new level. Inside the rooms, you can open volumes and search pages.

The neat part is where the words come from. The project builds each page’s text from its address: room, wall, shelf, volume and page. The README puts it plainly: “Book text is generated from room, wall, shelf, volume, and page address.”

That turns the address into the recipe. The library is described as deterministic, meaning the same inputs are meant to produce the same result. Nobody has to type up the books or haul them into a database first (the world’s easiest acquisitions budget). A friend’s directions could be as exact as which wall and which shelf, assuming you both can follow directions.

The rooms sit on a hex grid using what programmers call axial coordinates. Two numbers, q and r, locate a room, and a third, s, is calculated. It’s graph-paper battleship for people who think squares have too few sides.

Under the hood are SvelteKit, a web app framework, and Three.js, a JavaScript library for 3D graphics in the browser. The repository lists a hosted copy on Vercel, or you can run your own. With Bun installed, bun i followed by bun run dev serves it at http://127.0.0.1:5173/. You could call that shelf-hosting.

Company costs extra, if you count one environment variable as a price. Multiplayer is off by default. Starting the server with BABEL_WEBSOCKET=1 bun run dev enables chat and reader presence over WebSockets, the persistent connections that let a server push updates to an open page. The same flag works with bun run preview.

Then comes the fine print for anyone putting it on Vercel. You set the same flag and enable Fluid compute, but two friends can still land in different copies of the server. The README says “Room presence, chat, and guestbook entries are shared by readers connected to the same Function instance.” Vercel can place readers on separate instances, and each instance’s memory is cleared when it stops.

So your friend may be in the right room of the wrong universe. Borges fans may consider this a feature. Anyone who wanted that guestbook entry to stick around may feel otherwise.

The design idea here travels well beyond imaginary librarians. When content can be rebuilt from coordinates, the server has far less to remember about the world itself. Game builders have good reason to like that bargain: spend the effort on rules, then let visitors go looking for places.

People are the harder part. A generated page can be made again from its address, while a chat message exists because somebody typed it. If this project grows a persistent guestbook or chat that spans instances, it will likely need some shared place to keep or pass along that information. That is a forecast from how the current setup works, and the README announces no such plan.

For now, it’s a wonderfully impractical place to send a coworker who says they want to get through more reading this year. Pick a hallway, pull down a volume and see what the address coughs up. If you split up, be specific about where to reunite. “The hexagon with the books” will not narrow it down.

Meet you by the stairs.

More Hacks & Builds

Every Hacks & Builds story →