Gods High Score Format

From ModdingWiki
Jump to navigation Jump to search

The "Top Ten Gods" high score table of Gods is stored in HISCORES.BIN. Unlike most of the game's files it is not compressed. The file is rewritten by the game whenever the table changes, and also stores the level passwords the player has earned.

Scores and passwords are not saved when the game is run from low-density floppy disks.

File format

The file is always 216 bytes: ten score records followed by a 16-byte password block.

Data type Name Description
RECORD[10] scores Best score first
BYTE[16] passwords Saved level passwords, see below

Each RECORD is 20 bytes:

Data type Name Description
BYTE[16] name Player name, one character per byte, padded with 0. Uses the alphabet below, not ASCII.
BYTE[4] score Packed BCD, most significant digits first. For example 00 04 39 20 is 43920.

A name can use all 16 bytes, with no terminator.

Alphabet

The name characters are 1-based indexes into the letter grid shown on the name entry screen. 0 is padding.

Codes Characters
1-26 A-Z
27 .
28 space
29-38 0-9

When a new score is entered, it is inserted into the table in order and the lowest score drops off.

Passwords

The last 16 bytes hold the passwords for worlds 2, 3 and 4 that the player has earned, so they can be shown again next time (e.g. PASS 2 : PME on the high score screen). There are four 4-byte fields, stored as pairs of UINT16LE words. Each field is XORed with its own key, except that an empty (all zero) password is stored as zero:

Offset Contents XOR key (word 1, word 2)
200 World 2 password 0x616F, 0x4368
204 World 2 password again 0x6E67, 0x7345
208 World 3 password 0x654D, 0x696E
212 World 4 password 0x6F6E, 0x656C

The world 2 password is written twice, but the game never compares the two copies.

Source code

From re-gods, the open-source HTML5 port:

Credits

This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)