1983 · Cosmi

Aztec Challenge

This minisite was contributed by air, Nico-van-der-Zijden. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/aztec-challenge with me to Gold.

Everything that moves is a sprite, and the hero is always two of them stacked, because one sprite is too short for a running man. The scenery is two character sets of 256 shapes each, and the Bridge's rocky gorge is built from the same characters as Cosmi's spinning logo.

01 · Sprites

Every moving thing, as the game animates it

The program keeps 64 sprite shapes at $2000-$2FFF, 64 bytes each. A sprite on the Commodore 64 is a 24 by 21 pixel picture that the video chip draws over the screen wherever it is told, and a byte at the end of the screen, the sprite pointer, picks its shape: shape $80 is the 64 bytes at $2000, $81 the next, up to $BF. Each level animates by writing new numbers into those pointers. The game has no tables of animation: each sequence is a few instructions in the level's code that add 2 to the pointer and wrap it round, so the pictures below play the sequences those instructions make, at the speed they run in the game.

Drawn from the listing's bytes in each level's own colours (the sprite colour registers $D027-$D02E and the two shared colours $D025/$D026 as the level's set-up writes them). Speeds are counted in video frames: a runner's pose lasts about 5 frames, the climber's 8, the swimmer's stroke 15. The game paces itself with delay loops, not the frame, so these are measurements, not constants of the code.

02 · Two sprites to a hero

The hero is two sprites, one on top of the other

A sprite is 21 pixels tall, too short for a running figure, so on every level the hero is sprites 0 and 1: the upper half and the lower half, kept 21 lines apart and moved together. Every move in the code changes both: the Gauntlet's jump moves both up 9 lines a step ($6250), the Piranha's swimmer moves both a pixel ($1DF4). The split matters to the rules too. The Temple kills the runner only when the lower half touches a trap and the upper half does not ($79F0), the Stairs only when a block hits the upper half ($70E0), and the Vermin's bite counts only on the lower half ($6BE0).

The side-view runner (shapes $90 and $91) in the Temple's colours. The two boxes are the sprites' 24 by 21 frames.

03 · Every shape by number

All 64 shapes, two of them never used

Shapes $B2 (a fish turning) and $BA (a spear on the slant) are drawn in the data, but no instruction in the program writes either number into a sprite pointer. The Vermin's green snake, $9C in sprite 6, is used and still never seen: Discoveries says why.

Multicolour shapes pair their bits: 01 is the first shared colour, 10 the sprite's own and 11 the second shared one. The single-colour view shows the raw bits of the same 63 bytes, which is how the spears, the falling things and the creatures are drawn.

04 · Character sets

Two character sets draw all the scenery

The screen is 40 by 25 characters, each an 8 by 8 picture from a character set: 256 shapes of 8 bytes, 2 KB. The game carries two. Set A at $3000 draws the logo, the title, the Temple, Hopaztec, the Piranha's lake and the Bridge; set B at $3800 draws the Gauntlet, the Stairs and the Vermin. The menu and the scorecard use the machine's own letters from ROM. A level picks its set with the register $D018 (ORA #$0C for A, ORA #$0E for B, as at $7205 and $60C7), and most turn on multicolour text, where a character whose colour has bit 3 set is drawn with double-wide pixels in four colours.

Click a character to see what draws with it.

Drawn in neutral colours (black, grey, white and red for the four bit pairs), since each level gives the same character different colours.

05 · Pictures built from characters

The logo, the title and the scenery, from their screen data

A picture made of characters is a list of character numbers, one byte a cell, copied to the screen. The program keeps these lists beside the code and draws each with a loop: the spiral at $4000 and the sun stone at $4200 are copied to $0528, the title's two words from $4600 and $4700, Hopaztec's room from $5800, the Bridge's gorge from $4C00.

The Bridge is the one that borrows. Its gorge uses characters 1-127 of set A, the same characters the spiral is drawn with, and the Bridge shows them in single colour where the spiral is multicolour, so the swirls of the logo turn into the grain of the rock. The switch under the Bridge's picture marks every cell that uses one of the spiral's characters.

06 · The Gauntlet's depth

Five frames of throwers and a growing temple make the Gauntlet's 3D

The first level looks like a run into the screen, and none of it is 3D. Two rows of spear throwers are five pictures of six rows each ($5000, 240 bytes a frame) drawn over rows 14-19 one after another ($60E3). Between frames the sand scrolls down and a trapezoid of ground is copied a row down ($616B). Every 88 steps the temple on the horizon is drawn a stage larger ($62E0), from rows at $5500 and $5600; after its eighth stage the runner has arrived.

The throwers' frames and the temple drawn from the listing's bytes by a port of $62E0. The sand below the throwers is the game's three sand characters in a fixed pattern; the game picks each at random as it scrolls.

07 · How each level sets up the screen

One screen mode a level, with no split in the frame

The game never changes the video chip in the middle of a frame: it has no raster interrupt at all, only the KERNAL's timer for the music. Each level writes its registers once at its start, and a frame recorded in play is drawn exactly by reading them once (the Levels tab shows each). The table is what each level's start writes.

From each level's set-up code. In phase 4 the levels that use the phase's two colours ($5E/$5F) darken: the Gauntlet, the Piranha, the Bridge and Hopaztec's doorway.