Downland Unearthed: Backgrounds

This article is part of a series exploring the reverse engineered inner workings of Downland, a game for the Tandy Color Computer, released in 1983, written by Michael Aichlmayr.

Generating Downland’s backgrounds is easily the most complex part of the game’s code. It doesn’t store its backgrounds as tiles organized on a tile map like on a console, nor does it store the background as an image. In actuality, its backgrounds are built from a string of pre-defined shapes drawn end-to-end by a virtual plotter.

Shapes

Downland uses twenty-two different shapes to achieve its background layouts.

Since the original assembly doesn’t have any names for the shapes, here are the names I gave them in the C version.

Regular shapes

0 Stalactite
1 WallGoingDown
2 LeftHandCornerPiece
3 TopRightHandCornerPiece
4 TopRightHandCornerPiece2
5 BottomRightSideOfFloatingPlatforms
6 FloorPieceGoingRight
7 WallPieceGoingUp
8 CornerPieceGoingDownLef
9 FloorPieceGoingLeft
10 ShortLineGoingDown
11 ShortLineGoingUp

Vertical ropes

12 VeryShortRope
13 ShortRope
14 MidLengthRope
15 LongRope
16 VeryLongRope
17 SuperLongRope
18 ExcessivelyLongRope
19 RediculouslyLongRope

Horiziontal ropes

20 Horizontal RopeStartGoingRight
21 Horizontal RopeEndGoingRight
22 Horizontal RopeGoingRight

Parts & Segments

Shapes are made up from one or more smaller parts. And each part is made up of one or more segments. Each segment is a line with a direction and length. Most shapes are made up of just one part but the ropes are made out of multiple.

Here is a breakdown of the Stalactite shape.

The Stalactite is made out of one part, and that part is made out of three segments. Segments start from the previous segment’s ending position and so their start and end points overlap.

And here is a break down of the ShortRope shape.

The ShortRope, like all the rope shapes, is made out of three parts (A, B, C). Parts A and C are made up of one segment each while part B is made out of two.

Harry Plotter

The shapes are defined as a series of segments because the backgrounds are drawn using a plotter-like system. From a starting point the plotter goes through the segments of each shape, drawing into a buffer one line at a time. This is similar to how old arcade games like Asteroids and Tempest draw vectors to a CRT display.

Plotter Colors & Hidden Links

The plotter can be configured to draw blue, white, or black lines. Black lines are used to give the illusion of floating platforms or sub-rooms. Below are images of chambers with their hidden lines revealed in white.

Part Data

This is what the data for the Stalactite’s one and only part looks like. Each segment is made up of movements along the X and Y axes plus an orientation. The orientation determines which is the major axis between the two.

Shape Data

There’s no actual data that defines a shape. Each shape has a function that instructs the plotter which parts to draw and how to draw them.

Segment Drawing

Drawing a segment to the screen works similarly to sprite drawing wherein the data assumes a 128×192 resolution but the actual drawing is done in 256×192.

The segment is drawn with white double-wide pixels but a CRT mask is applied on top that makes it appear blue. Ropes are drawn without the CRT mask to appear fully white. No background shapes use orange.

Putting It All Together

Please enjoy this video of all the chambers being drawn one shape at a time.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *