What it does
You give it a map from cell-dungeon, a camera and a list of sprites, and view.draw paints a fresh picture: 320
by 200 pixels unless you choose otherwise. It walks a ray across the grid for each column, cell by cell, and draws the
wall it meets as a vertical strip of its texture, with faces along one axis shaded darker so corners read. Sliding
doors are drawn where their panels are, part way into the wall as they open, and a pushed secret wall is drawn
sliding back rather than jumping. The floor and ceiling are flat colours or textures cast row by row, and everything
fades toward a fog colour between two distances.
Sprites are flat pictures that always face you: enemies, pickups, shots. They are sorted far to near and drawn column by column only where they are nearer than the wall in that column, so a guard half behind a doorway shows half. Each sprite picks a frame from a strip, so walking, firing and dying poses are just frame numbers.
The picture is one live canvas the game shows with an ordinary sprite, stretched across the screen or sat in a window of the HUD. It costs the GPU a single quad, and it can be tinted, shaken or scaled like any other sprite. The caster and renderer underneath are pure and work without a canvas, so you can test what a column sees or draw into your own pixel buffer.
Features
- Column raycasting — one ray per column across the grid, with depths you can read back for aiming or effects.
- Textured, shaded walls — a picture per cell, faces along x darker by an amount you set, never mirrored.
- Doors and push-walls in place — door panels slide along their axis; pushed walls are drawn mid-slide.
- Door frames — an optional picture for the wall faces either side of a doorway.
- Floor and ceiling — flat colours, or textures cast row by row with a repeat per cell.
- Distance fog — fade toward any colour between a start and an end distance.
- Billboard sprites — frame strips, tint, full-bright shots, sorted and clipped against the walls per column.
- Canvas-painted textures — paint with the 2D canvas in the same callback shape as the engine's painter, or use an image or raw pixels.
- Headless-safe — in tests and replays the drawing calls do nothing, so the same game code runs there unchanged.
Good for
- A corridor shooter in the early-1990s style — textured mazes, sliding doors, secret walls and sprite enemies.
- A real-time dungeon crawler — the same map, a slower camera and pickups on the floor.
- A retro mode for a 3D game — the same map drawn the old way beside a mesh renderer, switchable from a menu.
- A maze or escape game — a small grid with fog to hide what is ahead.
- A minimal first-person prototype — no meshes or lighting to set up, just textures and a map.
Make it yours
Resolution, field of view, side shading, fog colour and distances, floor and ceiling colours or textures, wall
height, eye height, pixel shape and ray range are all options, and view.configure changes any of them but the
resolution while the game runs. A per-hit textureOf hook swaps pictures for used switches or animated walls, and
the camera takes a height and a walking bob. A classic 320 by 200 view with black fog and grey flats is one set-up;
a 160 by 120 crypt with walls two units tall, a low eye, a stone floor texture and green fog is another.
A quick look
Make a view, paint a wall, show the picture and draw it every frame.
const view = game.raycastView.create({ fog: '#0b0d12', fogStart: 4, fogEnd: 22 });
view.texture('stone', 64, 64, ctx => { ctx.fillStyle = '#6b6f78'; ctx.fillRect(0, 0, 64, 64); });
game.spawn({ id: 'view', texture: view.key, x: W / 2, y: H / 2, width: W, height: H });
game.frame('view', () => view.draw(run.map, { x: P.x, z: P.z, yaw: P.yaw }, sprites));
Works with
cell-dungeon— the map it draws: walls, doors, push-walls and switches.corridor-shooter— a whole shooter on that map; this pack draws it.fps-enemiesandfps-weapons— the enemies and guns whose poses become sprite frames.world-3d— the alternative: the same map as real 3D meshes with lighting.
Good to know
- It is a CPU renderer meant for low resolutions; it is not for full-screen pixel counts.
- One floor level, walls all one height, no looking up or down and no sky.
- One floor texture and one ceiling texture for the whole map.
- The stretched picture is smoothed unless the game turns on sharp pixel art in its screen settings.






