Skip to main content

Faces and drawing order

The dungeon view · Where each face goes on the screen · Screen coordinates

In brief​

Of the four faces of each of the 18 visible blocks, the game draws only those the party could see: the front face of a block ahead, the side face of a block off to one side. It draws them from the farthest to the nearest, so nearer walls cover farther ones, then draws the objects of each block in a fixed order. A corridor three blocks long shows how these faces make up the view.

Which faces are drawn​

A block has four faces, one per side. The game only ever draws the faces the party could see:

  • the front face, the side of the block turned towards the party, for the blocks that are ahead of it;
  • a side face for the blocks off to one side: a block on the left shows its right-hand face (direction d + 1), a block on the right its left-hand face (direction d − 1).
Top-down map, party facing north: solid blue lines mark the front faces that can be drawn, dashed orange lines the side faces; each line is drawn inside the block it belongs to.
The block faces the game can draw, for a party facing north.

Blocks 00, 06, 07, 11, 15 and 17 show only a side face, and the blocks straight ahead, 03, 09 and 13, only their front face. None of the faces of the party's own block, 16, is drawn: the walls beside the party are the side faces of its neighbors 15 and 17.1

Putting it together​

The sketch below shows the view from inside a straight corridor three blocks long that ends in a wall. The corridor's own blocks, 16, 13 and 09, are open; the walls the party sees are the side faces of the blocks beside it and the front face of block 03.

Sketch of the view in a corridor: the left walls are the right-hand faces of blocks 15, 12 and 08, the right walls the left-hand faces of blocks 17, 14 and 10, the end wall the front face of block 03; the floor areas of blocks 16, 13 and 09 are labeled. A small top-down key shows the same blocks.
A corridor three blocks long: the block faces that form its walls and the floor areas between them.

Each wall of the sketch lies inside the tile rectangle of its face, given under where each face goes on the screen: the right-hand face of block 15 inside columns 0 to 2, that of block 12 inside columns 3 to 5, and so on. The near edge of each side wall meets the edge of the front face one row closer, which is how the fixed rectangles give the impression of depth. The exact pixel positions are listed under screen coordinates.

Drawing order​

The walls are drawn into the tile grid in a fixed order: the farthest row first, and in each row the outer faces before the inner ones and the side faces before the front faces. Nearer walls therefore cover farther ones. The game then draws the objects of each visible block, in this order:

PassBlocks
Three steps ahead00, 06, 01, 05, 02, 04, 03
Two steps ahead07, 11, 08, 10, 09
One step ahead12, 14, 13
Party's row15, 17, 16

For every block it draws the wall decorations and the items on the floor. For the 15 blocks ahead of the party it then draws doors, the monsters of occupied blocks and temporary walls; for every block, the flying objects and teleporters. Each block's objects are clipped to the columns where the block can be seen.2

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references. The figures are drawn from the values listed on these pages, with no game graphics, by make_view_figures.py.

Footnotes​

  1. Set up the view and its view sides; the VMP area copy and the wall-to-VMP mapping. Comparative source: REF-SCUMM-016, generateBlockDrawingBuffer and hasWall. ↩

  2. Draw the objects of the visible blocks with its drawing order, called by the scene redraw. ↩