What it does
Each character in the rows means a cell: floor, wall, door, secret wall or switch, with a picture name for whatever draws it, a key for a locked door, an action for a switch, or a thing standing on the floor with a facing. The map keeps the moving parts going. Doors slide open when used, stay open a while and close again, but wait while any body is in them. A pushed secret wall slides straight away from you for a few cells and settles as an ordinary wall.
It also answers the questions a game asks constantly. Collision moves a round body along walls without ever trapping it in a door that closed on it. A ray reports the cell, the side and the position along the face, which is what a raycaster needs to texture a column. Sight checks an unbroken line, hearing floods through open floor and open doors, and paths find the shortest walk with doors open, unlocked or all.
A map can carry its own lighting too: lamps, torches and glows placed by position, with colour, brightness, reach and flicker, each on or off and switchable by tag. They are plain data beside the walls, so a level and its mood travel together; the presenter turns them into real lights and draws a fitting for each.
Features
- Rows and a legend — maps you can read and write by hand, or generate, with things placed by position.
- Sliding doors — speed and hold time are settings, and a door never closes on someone in it.
- Locks and keys — a door can need a named key; using it without one says which.
- Secret walls — pushed walls slide back a set number of cells and settle where they stop.
- Switches — report their action, such as ending the floor.
- Lights in the map — lamps, torches and glows with colour, reach and flicker, switched on and off by tag.
- Collision, rays and sight — sliding movement, textured-column rays and line of sight.
- Hearing and paths — how far a noise carries through open doors, and shortest walks for enemies.
Good for
- A first-person corridor shooter —
corridor-shooteris built on it. - A raycaster — rays give the cell, side and texture position.
- A grid dungeon crawler in real time — doors, keys, secrets and switches are all there.
- A stealth game — sight lines and hearing for guards.
Make it yours
Any characters, any pictures, doors with or without keys, door speed and hold, how far secrets slide and how fast, and as many lights as the level wants. A hand-written maze with a gold door and no lights at all is one use; a generated floor of lamp-lit rooms with torches in the corridors and a glow spilling out of each hidden closet is another.
A quick look
Build a map, move a body, and use what is ahead.
const map = cellDungeon.createCellDungeon({ rows, legend });
const to = map.collide(x, z, dx, dz, 0.3);
map.use(to.x, to.z, yaw, ['gold']);
map.tick(dt, (cx, cz) => someoneIn(cx, cz));
Works with
corridor-shooter— a whole shooter on top of it.fps-enemies— enemies that walk its paths and open its doors.levelgen— rooms and corridors to turn into a map.raycast-view— draws it the 1992 way.sector-map— for levels with floors at different heights.
Good to know
- One level of square cells: no heights or angled walls.
- Up to 128 by 128 cells; ask for paths a few times a second, not every frame for every enemy.
- It draws nothing; read its cells, doors, moving walls and lights to draw them.
- Lights cast no shadows, and a renderer shades only so many at once, so spread them through the rooms.






