DOM-Walker

Turn any web page into a playable pixel-art dungeon crawler. DOM-Walker reads a page's HTML structure and converts headings, lists, links and paragraphs into rooms, treasure, portals and enemies — parsed entirely in your browser, with nothing uploaded.

Loading tool…

How a web page becomes a dungeon

Every HTML document is already a tree. A page has a root, branches for its sections and articles, and leaves for its paragraphs, list items and links. A dungeon map is also a tree — rooms connected by corridors, some rooms deeper in than others. DOM-Walker exploits that resemblance: it parses the page with the browser's own DOMParser, walks the result with a TreeWalker, and hands each element a role in a game world.

Structural tags become architecture. An <h1> becomes the boss chamber, <main> becomes the throne room, <section> and <div> become halls, <aside> becomes a secret room, <footer> becomes catacombs. Content tags become things inside those rooms: paragraphs spawn wandering enemies, list items and spans become collectible loot, blockquotes and captions become lore scrolls you can read, forms and tables become trap rooms, and every <a href> becomes a portal pointing at the URL it actually links to.

The layout itself is procedurally generated but not random. The seed is derived from the URL, so the same address always produces the same dungeon — you can share a seed and a friend will walk the identical map. Room size follows nesting depth, room count follows how many structural elements the page has, and the overall shape follows the page's character: a dense documentation page yields a sprawling labyrinth, an article yields a linear run of rooms, a link index yields a looping network, and a one-screen landing page yields a tight arena.

Why anyone would want this

Partly because it is fun, and partly because it makes structure visible in a way an outline never does. Load a page you wrote and you can see, at a glance, whether it is a coherent building or a warren of empty <div> wrappers. Pages with clean semantic markup produce maps that read like real dungeons; pages built from nested wrappers and no headings produce a handful of featureless boxes. That is an accessibility and SEO signal rendered as a game level.

It is also a demonstration of what the browser can do on its own. There is no game engine, no sprite sheet, no audio file and no server: the tiles and characters are drawn as 8×8 pixel bitmaps on a canvas, the chiptune sound effects are generated by Web Audio oscillators at the moment they play, and the saves live in your own localStorage. The only network request DOM-Walker ever makes is the one that fetches the page you asked for, and even that can be skipped by pasting HTML or loading a local .html file instead.

Getting more out of it

  • If a URL will not load, the site is blocking cross-origin requests. Open the page in another tab, view its source, copy the markup, and use paste mode — that route never touches the network at all.
  • Portals are real links. Stepping into one fetches that URL and generates the next dungeon, carrying your character, level and inventory with you, so you can chain a whole site into a campaign.
  • Hold on to consumables before entering a boss chamber. Bosses come from the page's <h1> and hit several times harder than the paragraph-spawned wanderers.
  • Elements matter in combat: fire beats nature, nature beats water, water beats fire, and shadow and arcane counter each other. Enemy element is shown in the combat panel before you commit.
  • Roguelike difficulty deletes your save on death. Use it deliberately, and export a .dwsave file first if you want an escape hatch.

How to play

  1. Type a URL into the field at the top, or press one of the sample buttons, and enter the dungeon.
  2. Move with the arrow keys or W A S D — or swipe and tap on a touch screen. Every step is a turn, and enemies move when you do.
  3. Walk into an enemy to start turn-based combat, then attack, defend, cast, use an item or run.
  4. Press Space to interact with chests, levers, statues and lore scrolls, and to enter portals.
  5. Save to one of three slots, or export a .dwsave file to carry your run to another browser.

Related: HTML Minifier for shrinking the markup you just explored, HTML to Markdown to extract a page's content, and URL Parser for picking apart the links that became portals.

What each tag becomes

The mapping is the whole trick, and it is deliberately literal rather than decorative:

In the markup In the dungeon
<h1> The boss chamber — the page's title is the boss
<h2>, <h3> Castle gates and guard rooms
<main> The throne room
<section>, <article>, <div> Halls, story nodes, chambers
<aside> A secret room
<footer> The catacombs
<p> A wandering enemy, named after its first word
<li>, <span> Collectible loot
<a href> A portal to that link's URL
<blockquote>, <figcaption>, <textarea> Lore scrolls you can read and keep
<form>, <table> Trap and puzzle rooms
<button>, <input> Levers and locked chests
<code>, <pre> Rune wraiths and rune stones

Nothing is invented from nowhere. The enemy blocking your path in a Wikipedia dungeon is named after a paragraph on that article. The scroll you pick up contains that page's actual blockquote. Walk into a portal and it fetches the page it points to, generates the next dungeon, and carries your character across — a whole site becomes a campaign.

The map is procedural, not random

The seed comes from the URL. The same address always produces the same dungeon, so a seed is shareable: send someone the link and they walk your map, not a different one.

From the parsed tree, generation runs in a fixed order. Structural elements are ranked by importance and depth, the strongest become rooms, and rooms are placed with collision retries so they never overlap. A corridor chain connects them in document order, which guarantees the map is always fully traversable, and extra links are added on link-heavy pages so the layout loops instead of running in a line. Contents are then distributed in document order, so a list that sat under a heading in the page ends up as treasure in the room that heading created.

The result is that a page's shape survives into the game:

  • Documentation, dense and deeply nested → a sprawling multi-level labyrinth.
  • A blog article → a linear progression of rooms.
  • A link index or social feed → a looping network map.
  • A one-screen landing page → a tight arena with nowhere to hide.
  • A list-heavy or shop page → a treasure map.

Which makes it a slightly uncomfortable way to review your own HTML. Semantic, well-structured pages produce dungeons that read like buildings. Pages assembled from nested wrapper <div>s with no headings produce a few featureless boxes and almost nothing to do in them. The game is not judging you. It is just drawing what is there.

Everything is generated, nothing is downloaded

There is no game engine here, and no asset pipeline.

The sprites are 8×8 bitmaps written as arrays of strings in the source, painted onto a canvas one filled rectangle per pixel, with the palette swapped per entity so a fire enemy and a shadow enemy share a body and differ in colour. The tiles are two alternating floor shades with a lighter cap on wall tops. Fog of war is a per-tile explored array plus a Bresenham line-of-sight check, so you only see what your character could actually see, and previously explored tiles stay dimly visible.

The sound is Web Audio oscillators created and discarded at the moment each effect plays — a square wave blip for a step, a sawtooth sweep for a sword swing, filtered noise for an impact, an ascending arpeggio for a level-up. The background music is the same mechanism on a timer, walking a pentatonic scale chosen by the current theme, and switching to a faster, darker scale when combat starts. No audio file is ever fetched.

Combat, character, and loss

Combat is turn-based and modal: bump into an enemy and the map gives way to a panel with the enemy's portrait, its element, its stats and a log. Attack, defend, spend stamina on a special or a spell, drink a potion, or try to run — running is a speed check against the enemy, not a free exit.

Damage rolls against attack and defence with a random band, criticals scale with luck, and elements form a triangle: fire beats nature, nature beats water, water beats fire, with shadow and arcane countering each other. Spells inflict burn or poison that keeps ticking on the enemy's turn; elite enemies inflict the same on you.

Experience levels you up, raising health, stamina, attack, defence and speed, with luck and magic every third level. Equipment comes from the page — a weapon named after a list item, armour named after a link, an artifact named after a code block — and rarity, from common to legendary, scales its bonuses.

Death is not the end unless you choose it. On normal difficulty you wake at the entrance with half health and less gold. On roguelike difficulty, death deletes the save.

Saving, sharing, exporting

Three save slots live in localStorage, with slot one auto-saving every five minutes and again when you leave the page. A run can also be exported as a .dwsave file — the full map, entity state, fog, inventory and journal, base64-encoded — and imported into any other browser.

Maps themselves export too: a PNG of the whole floor plan with portals, loot and enemies marked, or a JSON dump of the room list and entity counts, which is a genuinely useful artefact if what you actually wanted was a picture of a page's structure.

Try it on your own site

Load your homepage. Count the rooms. See whether the boss chamber has your real <h1> in it, whether the secret room exists at all, and whether the portals lead where you expect.

If the dungeon is a maze full of scrolls and treasure, your markup is doing its job. If it is four empty halls and a locked door, you have found something worth fixing — and you found it by playing a game in a browser tab.