| 1 |
A description of the later AI UK game engine encoding. |
| 2 |
|
| 3 |
The basic design is superficially similar to the earlier games. Various |
| 4 |
technologies like the token based compressor and the bitmap graphics are |
| 5 |
reused, with the Seas Of Blood style graphics engine. |
| 6 |
|
| 7 |
Flags |
| 8 |
|
| 9 |
There are an unknown number of flags. They range in value from 0 to 255. |
| 10 |
Overflows result in 255, underflows in 0. Several flags have special roles. |
| 11 |
[256 flags ??] |
| 12 |
|
| 13 |
Flag 0 Location (Starts ?) |
| 14 |
Flag 1 Set means dark (Starts 0) |
| 15 |
Flag 2 Carried Room (Starts 253) |
| 16 |
Flag 3 Worn Room (Starts 254) |
| 17 |
Flag 4 (Starts 4) (max carried) |
| 18 |
Flag 5 Carried Count (Starts 0) |
| 19 |
Flag 6 Num Objects (Starts 150) (num items ??) |
| 20 |
|
| 21 |
|
| 22 |
Text |
| 23 |
|
| 24 |
All text is stored tokenised. Each token is stored as ascii with the top |
| 25 |
bit used to mark last character. Each string consists of a list of tokens |
| 26 |
ending in token 5e or 7e. Capitalisation is automatic following ".". The |
| 27 |
5E/7E may encode case or space information - I'm not sure yet. Various |
| 28 |
things autocase - such as ".". Early games encode end of text tokens into |
| 29 |
the compression stream - which makes them much slower to extract text. |
| 30 |
|
| 31 |
Messages |
| 32 |
|
| 33 |
Stored in the message table in Text format. The first messages are system |
| 34 |
used as follows |
| 35 |
|
| 36 |
0 . You can see (object listing) |
| 37 |
1-10 Directions |
| 38 |
11 That input contained no recognized words |
| 39 |
12 It is beyond my power to do that. |
| 40 |
13 . You can go |
| 41 |
14 what do you want to do now (not early games) |
| 42 |
15 you're carrying too much. |
| 43 |
16 you are carrying the following: |
| 44 |
17 nothing at all |
| 45 |
18 game's now over. Do you want to play again (Y/N) ? |
| 46 |
19 Ok. |
| 47 |
20 press any key to continue |
| 48 |
21 you already have it |
| 49 |
22 sorry, I don't see it here. |
| 50 |
23 you don't have it |
| 51 |
24 you can't go that way |
| 52 |
25 It is dark. You cannot see. |
| 53 |
26 do you want to restore a saved game ? |
| 54 |
27 |
| 55 |
28 you are not wearing it |
| 56 |
29 you are wearing it |
| 57 |
30 (worn), |
| 58 |
31 No help at this stage. |
| 59 |
32 I don't understand that verb |
| 60 |
33+ game text |
| 61 |
|
| 62 |
|
| 63 |
Locations |
| 64 |
0xFC destroyed |
| 65 |
0xFD default carried |
| 66 |
0xFE default worn |
| 67 |
|
| 68 |
Exits |
| 69 |
|
| 70 |
Exit data is in the form |
| 71 |
|
| 72 |
<bit7 + room number> |
| 73 |
<verb><location> repeated until a code with the top bit is |
| 74 |
found. The top bit indicates we passed the end. |
| 75 |
<0xFF> marks the final end (??) |
| 76 |
|
| 77 |
Verbs 1-10 are exits |
| 78 |
|
| 79 |
Pictures |
| 80 |
|
| 81 |
Each picture script is delimited by an 0xFF end marker. These scripts |
| 82 |
compose pictures out of block pictures which are themselves encoded in the |
| 83 |
same way as the earlier games. In fact the scripts of pictures first appear |
| 84 |
in Seas of Blood. Games prior to Robin of Sherwood use display sized |
| 85 |
pictures, Robin of Sherwood is special using strips for forest and special |
| 86 |
rules. |
| 87 |
|
| 88 |
Drawing Codes: |
| 89 |
|
| 90 |
0xFF End |
| 91 |
0xFE 733C mirror area x0 y0 width y1 |
| 92 |
0xFD 6FF5 arg 0-7, arg 0-7 replace colour arg1 with arg2 |
| 93 |
0xFC 76D4 arg1 arg2 arg3 arg4 draw color, args y, x, height, colour, width |
| 94 |
(in early games x, y, colour, length) |
| 95 |
Seems to be |
| 96 |
set attributes (arg1, arg2, height, attribute, width) |
| 97 |
where arg1=y arg2=x in chars 0,0 top left |
| 98 |
0xFB 700D |
| 99 |
Make picture attribute area bright |
| 100 |
0xFA 7512 Flip image horizontally |
| 101 |
0xF9 DrawPicture n (following byte) |
| 102 |
0xF8 729D Skip rest of picture if object arg1 is not present |
| 103 |
Early games: Draw picture arg1 at x y |
| 104 |
0xF7 743A arg1 } Rebel Planet: Stop drawing if alcove is unlocked |
| 105 |
0xF6 744E arg1 } set A to 0 4 or 8 and call same method |
| 106 |
0xF5 7444 arg1 } |
| 107 |
0xF4 7458 arg1 |
| 108 |
End if object arg1 is not present |
| 109 |
0xF3 7409 Mirror top half vertically |
| 110 |
0xF2 7331 arg1 arg2 arg3 arg4 Mirror area horizontally |
| 111 |
0xF1 73FE Mirror area vertically |
| 112 |
0xEE 7507 Flip area horizontally |
| 113 |
0xED 7654 Flip image vertically |
| 114 |
0xEC 7649 Flip area vertically |
| 115 |
0xEB CRASH |
| 116 |
0xEA CRASH |
| 117 |
0xE9 7678 arg1 arg2 .. |
| 118 |
arg1 = colour to match |
| 119 |
arg2 = new colour |
| 120 |
Swap colour (paper or ink) |
| 121 |
0xE8 747A |
| 122 |
Clear upper |
| 123 |
|
| 124 |
Lower values 6FB7 = code calls 7234 etc see 6F86 |
| 125 |
|
| 126 |
Engine Tables |
| 127 |
|
| 128 |
This is a sequence of conditions and actions. The encoding is as follows |
| 129 |
|
| 130 |
Bit 7 Action |
| 131 |
Bit 6 Set = Last Action (condition cannot be last) |
| 132 |
Bit 5-0 Code |
| 133 |
|
| 134 |
Condition Codes |
| 135 |
1 AT L |
| 136 |
2 NOTAT L |
| 137 |
3 ATGT L |
| 138 |
4 ATLT L |
| 139 |
5 PRESENT O |
| 140 |
6 HERE O |
| 141 |
7 ABSENT O |
| 142 |
8 NOTHERE O |
| 143 |
9 CARRIED O |
| 144 |
10 NOTCARRIED O |
| 145 |
11 WORN O |
| 146 |
12 NOTWORN O |
| 147 |
13 DESTROYED O |
| 148 |
14 NOTDESTROYED O |
| 149 |
15 ZERO F |
| 150 |
16 NOTZERO F |
| 151 |
17 WORD1 W |
| 152 |
18 WORD2 W |
| 153 |
19 WORD3 W |
| 154 |
20 CHANCE % |
| 155 |
21 GT F N |
| 156 |
22 LT F N |
| 157 |
23 EQ F N |
| 158 |
24 NE F N |
| 159 |
25 OBJECTAT O L |
| 160 |
|
| 161 |
Action Codes |
| 162 |
1 LOAD ? |
| 163 |
2 QUIT |
| 164 |
3 INVENTORY |
| 165 |
4 ANYKEY |
| 166 |
5 SAVE |
| 167 |
6 DROPALL |
| 168 |
7 PICTURE ? |
| 169 |
8 OK |
| 170 |
9 GET O |
| 171 |
10 DROP O |
| 172 |
11 GOTO L |
| 173 |
12 GOBY O Secondary message block (He-man, Kayleth |
| 174 |
etc ?) on all games that use it ? |
| 175 |
13 SET F |
| 176 |
14 CLEAR F |
| 177 |
15 MESSAGE M |
| 178 |
16 CREATE O |
| 179 |
17 DESTROY O |
| 180 |
18 PRINT F |
| 181 |
19 DELAY T |
| 182 |
20 WEAR O |
| 183 |
21 REMOVE O |
| 184 |
22 LET F N |
| 185 |
23 ADD F N |
| 186 |
24 SUB F N |
| 187 |
25 PUT O L (Unsure) |
| 188 |
26 SWAP O O |
| 189 |
27 SWAP F F |
| 190 |
28 MEANS (?) V N |
| 191 |
29 PUTWITH O O |
| 192 |
30 BEEP ? ? (Rebel Planet) |
| 193 |
31 LOOK ? ? (Unsure) |
| 194 |
32 QSAVE 0 0 (He-man, Temple, Kayleth) |
| 195 |
33 QLOAD 0 0 (He-Man, Temple, Kayleth) |
| 196 |
34 Clear Lower?? 0 0 (Used in Kayleth) |
| 197 |
35 OOPS (Temple) |
| 198 |
|
| 199 |
Each sequence consists of sequences of conditions and then actions |
| 200 |
each individual condition or action is followed by its parameters. A single |
| 201 |
0x7F marks the end of the tables |
| 202 |
|
| 203 |
The automatics table has no verb/noun header. The actions table precedes |
| 204 |
each table with two bytes. The first is the verb the second the noun. |
| 205 |
A code of 0x7E indicates "any word" (is 0 none - unsure) |
| 206 |
|
| 207 |
Verbs |
| 208 |
0 NONE (noise AND/OR) |
| 209 |
1=11 Exits (North, South, East, West, Up =, Down, |
| 210 |
NorthEast, NorthWest, SouthEast, SouthWest) |
| 211 |
1C |
| 212 |
|
| 213 |
Nouns |
| 214 |
B8, DE, D1 ?? |
| 215 |
|
| 216 |
The word table is a single table. It contains 5 bytes per word being 4 |
| 217 |
letters (space padded) and a byte of value. The top bit is set for nouns |
| 218 |
and clear for verbs. It ends XXXX[FF] |
| 219 |
|
| 220 |
Functionality By Game |
| 221 |
|
| 222 |
Games we can parse: |
| 223 |
Rebel Planet |
| 224 |
Blizzard Pass - unusual 128K mode |
| 225 |
Temple of Terror - added opcodes |
| 226 |
He Man - added opcodes, quicksave/restore |
| 227 |
interpreter "get all" helper |
| 228 |
|
| 229 |
Games not yet parsed: |
| 230 |
Kayleth - added opcodes, other changes |
| 231 |
|
| 232 |
|
| 233 |
Section Locations (Blizzard Pass) |
| 234 |
|
| 235 |
75CE |
| 236 |
Messages 7E26 |
| 237 |
Object Text 8CE6 |
| 238 |
Automatics 96D9 |
| 239 |
Commands 9A54 |
| 240 |
Words A720 |
| 241 |
Room Exits AB67 |
| 242 |
Tokens B1BC |
| 243 |
Object Starts B6A8 |
| 244 |
Room ??? B798 (room graphics ?) |
| 245 |
FF terminated F8 marker ? |
| 246 |
Room Text 1B000 (Segment 3) |
| 247 |
|
| 248 |
Note that blizzard pass is special in that it is the only game for the |
| 249 |
Spectrum 128. The 128K version has two location tables (one for what would |
| 250 |
be the graphical game and one for the text "other side of the tape" both |
| 251 |
placed in one setup, with the rooms in the higher banks). Blizzard Pass |
| 252 |
also appears to have a special hack so that there are two ranges of object |
| 253 |
that append to the room description not one. This hack is not yet |
| 254 |
implemented in TaylorMade. |