There's a dungeon under this blog
There's a hidden dungeon beneath this blog, accessible through every page. When you enter, you find yourself in a sunlit village square, with a pixel character – a knight, wizard, or princess depending on your unique peer ID – standing before you. As you explore the stone arch north of the well, you encounter a procedural dungeon filled with monsters, potions, and occasionally, chests containing teeth.
If other people are reading the blog at the same time, they can join you in the same village and dungeon. Since the blog is static, there's no game server, websocket backend, or database involved. Multiplayer is instead handled peer-to-peer using WebRTC, which allows two browsers to open a data channel directly to each other.
However, before peers can communicate, they must exchange connection offers through something they can both reach – traditionally, a signaling server. Trystero, the creator of this dungeon, found a clever workaround by utilizing infrastructure that doesn't belong to anyone. By default, it uses public Nostr relays, but it can also leverage BitTorrent trackers or MQTT brokers.
Anyone who opens the dungeon joins a room named after the current UTC date, announces themselves through the relays, and completes the handshake. From that point on, the relays are no longer necessary, and game traffic is transmitted peer-to-peer.
Instead of having one person create the dungeon and send it to everyone else, every client derives the day's date, hashes it into a seed, and feeds it into a Mulberry32 PRNG. With the same seed, every client generates identical rooms, corridors, and monsters that stand in the same spots on every machine that opens the dungeon that day.
The depth of the dungeon is generated from the day seed XORed with the depth multiplied by a golden-ratio constant. As soon as you reach it, the whole descent is implied by a constant number, without the need for anyone to transmit it.
The only data transmitted over the wire are live state updates, such as positions, hit points, and occasional messages indicating when a chest is opened, preventing loot from respawning for the next visitor. A full update is under 100 bytes. The world resets at midnight UTC, and anyone still in the middle of their crawl becomes a ghost from the previous day. New arrivals join tomorrow's room, and the two eras cannot see each other. Gold earned during a run stays with you, even if you die.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.