Amberworld Logo by Oliver Gantert

... Ambermoon File Format Info ...

This section provides information about the contents and formats of Ambermoon data files. Usually, the original files have to be extracted or decrypted with AMBtool first. Please note that there may be mistakes and errors in either this information or the tools used to 'hack' these files. This is work in progress.

Don't forget that all files are MSB (big endian). Use portable techniques to read/write 16bit and 32bit numbers.


Encryption and Compression

Most files are encrypted and/or compressed in some way.

Ambermoon uses a proprietary compression algorithm called LOB, developed by Lothar Becks. Many of Thalion's games used this type of format. It can be identified by looking at the first 4 bytes in a file, which are 0x014c4f42 (01,"LOB").

There is also an encryption algorithm that is called JH, developed by Jurie Horneman. This is actually a 16bit XOR algorithm that uses an encryption key (word[0] XOR word[1]). The first 2 bytes in a file are 0x4a48 ("JH").

AMNC is an archive format (like TAR) that contains several smaller files. This format is identified by the first 4 bytes ("AMNC"), followed by a 16bit number of entries. For each entry now follows a 32bit size of the entry. Data is encrypted with JH codec, key is the entry number (starting with 1). The 'C' in AMNC seems to stand for "crypted".

AMNP is mostly similar to AMNC, except that the entry-table may contain zeroes, and most entries are compressed LOB files. The 'P' in AMNP seems to stand for "packed".

AMBR is the format used by saved games. There is an open-sourced Amiga program "AmberCheat" that allows to edit these. The 'R' in AMBR seems to stand for "raw".


Graphics and Animations

Graphics are stored in non-interleaved bitplane format, similar to the IFF ACBM format used in AmigaBasic, without compression. Look at this to get the idea. AMgfx can be used to convert them to Targa (TGA) format. Unfortunately, color information is stored in another file and (currently) there's no 'easy' way to find the correct palette, image dimensions and number of bitplanes.

Palettes.amb contains 49 different palettes, each with 32 colors and a size of 64 bytes. Colors are saved in 16 bits (0000RRRRGGGGBBBB), although only 12bits are actually used. For reference, there's a table with all palettes here (JPEG 63kB). Please note that there may still be some colors 'hardcoded' into the game or mixed with other palettes.

The following list is not complete yet, but should make life easier when working with AMgfx.

1Icon_gfx.amb (w 16, b 5).
2Icon_gfx.amb (w 16, b 5).
3Icon_gfx.amb (w 16, b 5).
Combat_background.amb (w 320, b 5).
Event_pix.amb (w 320, b 5).
Floors.amb (w 64, b 4).
Layouts.amb (w 320, b 3).
Monster_gfx.amb (w 96, b 5).
Party_gfx.amb (w 16, b 5).
Pics_80x80.amb (w 80, b 5).
Portraits.amb (w 32, b 5).
Travel_gfx.amb (w 16, b 4).

Texts and Tokens

Text files start with a 16bit value (number of strings). Each string starts with an 8bit value (string length). Most strings contain control characters (tokens) that will be explained here some day in the future. To be continued...


Music and Sounds

Music was created with Sonic Arranger. SA allows to save modules in different formats, one is an IFF-style format that can be loaded and edited in SA and one is a stripped-down 'final' version that may have the replayer code embedded. Except for the intro music, Ambermoon uses the minimal format without code. The replayer is part of AM2_CPU/AM2_BLIT, it can be found at the very end of the code hunk.