Docs Design

Contents

A top-down 2D tile world, with autotiles

The October audit's Wave 4 item "A top-down 2D tile world with autotiles" (docs/design/audit-2026-10.md): the storybook-RPG look. Before it, every world game was drawn in 3D (kit.world_tiles' chunks and kit.actors' models); 2D meant a platformer or a puzzle grid.

The idea: the same world, drawn flat

A top-down 2D game is not a new simulation. The world is still kit.world_tiles' grid (levels, grounds, water, props), bodies still walk by kit.move, fight by kit.melee, work props by kit.harvest and go through doors by kit.core's scenes. Only the drawing changes, so every kit, every template's rules, the Director's vocabulary, every check and every Playtest work in 2D as they are. examples/larkmead proves it: it is the adventure template's own errand with two documents replaced, and the template's Playtests pass on it unchanged.

A game is drawn flat when its Style's profile is flat_2d ([GwStyle.flat]). Its CameraRig should then be a topdown2d rig: viewHeightM (tiles of the world that fit the screen's height), followRate and snapTexels, as the platformer's rig reads them. kit.world_tiles' flat view (GwWorld2dView) draws the world and everything in it. The 3D world view, kit.actors and kit.move's click mark stand aside, and no 3D look is built (GwLitOrtho3d has none for flat_2d).

The ground (GwWorld2dTiles)

Painted a 32-tile chunk at a time round the camera, 16 art pixels a tile, every blit native (Image.blit_rect, blend_rect, blend_rect_mask). A tile's pixels depend only on it and its eight neighbours, so chunks join without a seam (a test paints a window whole and in part and compares the bytes). Pure: no random draws, only a hash of the tile.

  • Grounds. Each ground is a tile of its colour, textured by its Biome look's new optional pattern: speckle (the default), tufts, grain, flagstones, cracks or plain. There are four variants, picked by the hash. The Style's material families did not do for this: nearly every material is made.
  • Autotiles. Where grounds meet, the later ground in the Biome spills over the earlier one in a wobbly band three to five pixels deep with a darker rim. It makes an edge where a side's neighbour is at least that ground, and a rounded corner where only a diagonal neighbour is. Layers go in Biome order, so a third ground covers both bands below it. This is the layered transition many tile engines use, and it needs no hand-drawn 47-tile blob set. Masks are made once for each neighbour pattern and wobble.
  • Water. Wading water lets its bed show through. Deep water is the water's colour, darker with each level under the surface, with a few glints. Shallower water spills over deeper water in the same bands. Water laps over the land beside it, with foam along the band's rim, so a shore is never a straight tile edge.
  • Levels. The ground is drawn flat: no tile moves up the screen, so nothing ever has to hide a body. A step of one level is a walkable slope and draws nothing; drawn as lines, the noise terrain's many terraces read as a grid. A cliff (two or more levels) shows a rock face along the bottom of the higher tile, textured by the Biome's first cracks ground and with a light lip and a dark foot. Cliffs to the east or west cast a shadow, and so does a cliff's foot to the north. The face lies inside the higher tile, so a body below the cliff never stands on it.

Sprites (GwWorld2dArt)

Every standing prop and every body with art is a sprite, drawn in the order of its feet (north to south, then west to east), so what stands nearer covers what stands behind.

  • A Biome prop kind is its Model baked by kit.sprite's baker from 30° above, still. A prop is mirrored by its variant's low bit, as the 3D view turns it by its variant.
  • A body shows its archetype's sprite sheet when it names one, turned left or right. Otherwise its Model is baked three times, from the side (mirrored for left), the front and the back. Each bake has an idle frame and a six-frame walk, played while it moved last tick. Which bake shows comes from the body's facing ([GwWorld2dArt.turned]).
  • A body has a soft shadow on the ground under it, its move radius wide.
  • Bakes run at load through the stage's GwSpriteCache, kept by recipe, so a Model bakes once however many kinds show it. A game needs no new art to be drawn flat.

Camera, light, juice

The camera follows the player, or a Timeline's camera. It eases once per tick, so a shot at a named tick is always the same frame, and it is held inside the world and snapped to art pixels. Dusk warms the frame and night tints it moonlit, from the clock's nightfall, through a CanvasModulate. The game's juice (kit.vfx) shakes, squashes, lifts and flashes the sprites and draws its particles flat, as in the platformer. The first frame, and the first after a door, is painted whole, because a tool shot presents once. Later frames paint one new chunk each.

Clicks

GwPointerInput reaches a flat world through the view that drew it rather than a 3D ray: the stage service flat_pick is the view, and its pick_flat(frame_at, skip) returns the ground point under the pixel and the topmost sprite drawn there whose pixel there is not clear (an entity, or prop:<id>). It never returns the body the player drives. So click to walk, click to use and the hover hand work in a flat game as in a 3D one; tours' click verbs never needed a camera.

Not yet

  • Imported tilesets (an artist's autotile sheet in a standard layout) for a Biome's grounds.
  • Four- or eight-way sprite sheets an artist draws, and more poses from the actors' pose rules (swing, hurt, down). A flat body is idle or walking.
  • The click mark on the ground in 2D, lamps (kit.light_carried) as light in the dark, a body shown through what hides it (the 3D look stipples), animated water.
  • A one-level step drawn as a soft slope, if a game needs one.

From docs/design/topdown-2d.md in the Gamewright repository.