1990 · Domark

Castle Master

This minisite was contributed by air, 64kramsystem. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/castle-master with me to Gold.

Every area of the castle drawn from the game's own database: the Wilderness, the Courtyard, 26 rooms and five caverns, the 100 shared objects that dress them, and every script that opens a door, pays a reward, or moves the player on.

01 · The areas

The castle, area by area

The database at $9D00 holds 34 areas: the Wilderness, the Courtyard, 26 rooms, five caverns, and one list of shared objects. Each is drawn here from its own object records.

Every object is drawn from its record: its position and size in bytes 1-6, in the game's units of 64, and the bytes of its own shape after them. From above puts X to the right and Z up the page, the way a heading of 0 faces up and a heading of 90° to the right. Turn it shows the same edges in three dimensions; drag to turn the area. Pyramids are built as QUEUE_PYRAMID_OBJECT ($2F21) builds them. The arrows are entrances, at their position with their heading; the dashed ones are the shared entrances that scripts in other areas send the player to. Point at an object to see its record and its script.

02 · Scripts in every area

Five scripts the game runs everywhere

Besides an area's own scripts, five global ones at the list $9D44 points to run in every area, after the object the player touched or shot and before the area's own (DISPATCH_FRAME_CONDITIONS, $4A58).

The first three put up or take down three shared objects each, whenever a sensor with the id 125, 126 or 127 is visible in the area. The fourth is the potion of revitalisation's: once flag 29 is set, by drinking the potion in the cavern at area 22, every tick of the 10-second timer adds a point of strength, until variable 24 has counted to 64. The fifth does nothing.

03 · Reading the scripts

The words the scripts are written in

The scripts above are the game's own tokens put into words. Each token waits for one of four events, and the page names it in the left margin.

EventWhen the token runs
moveThe player moved this frame ($6172). In an object's own script, the move ran into that object ($53CC names it).
timerThe 10-second timer ticked ($48B5).
shotA rock hit the object ($646D).
actionThe player pressed A at the object ($6598).

A test that fails skips every token after it until an else or an end if; there is no nesting, so two tests in a row must both pass. A flag is one bit of $2439 onward and a variable v one byte of $2438 onward, so the two overlap. An object named by its id alone is looked for among the shared objects first, then in the area. The full list of opcodes is in the Source tab's facts.