In this document, the word “animation” refers to animated sequences –you may call them cutscenes or videos– like the introduction of a game. It does not refer to in-game animations (like creatures animations which are built dynamically by the program).
The file format described in this document is used in most versions of Dungeon Master, Chaos Strikes Back and Dungeon Master II. This documentation is based on the analysis of 30 different animations files listed in a table below.
However, the following games use other formats:
ANIM.EXE [videomode] [HALF|BLEND|WIDE|HOLD|LOOP|NOABORT] [audio [track]]
As you will see, each animation file can contain several types of items. But as each game uses its own unique version of animation engine, none of them will accept all types of items. If you want to build your own animations, make sure you don’t use unsupported item types (check the supported types in the animations supplied with the games).
The playback frame rate seems to be around 6 frames per second (but I have not checked that for all files).
An animation file is composed of a sequence of items stored one after the other. All the items have the same general structure:
Meynaf has checked that the same set of item types is supported in Amiga versions of the games (DM 3.6, CSB 3.1, CSB 3.3, DM2 1.0): AN, BN, BR, DL, DO, EN, FO, MD, MF, MI, NE, PL, SD, SF, SO, TD, TR, WA.
Here is a list describing all the types of items found in animation files:
An AN item contains the definition of an animation. In Amiga versions, this item type is recognized but there is no associated action.
It is the first item in animation files, except in the following files where it is the second item, after a BR item:
In the file DMII END (FM-Towns 1.0 JP, IBM PSV 1.0 JP, PC-9821 1.0 JP), the second item is another AN item identical to the first one.
Header (6 bytes)
Data (8 bytes)
Here is the data found in the files:
A BN item contains no data. It is a control item used in loops. See the Loops section for details.
A BR item contains no data. It is a control item used to define if the animation can be interrupted by the user with a mouse click or a key press. The actual action depends on the version, for example in Dungeon Master for PC you can only interrupt the animation by pressing a key and not by clicking the mouse.
Animation files that do not contain any BR item can be interrupted by default.
Here are the files where the animation cannot be interrupted:
In the following files, there are two BR items. The first one disables interruptions until the end of the animation. Then right before the end of the animation, a second BR item enables interruptions again, after the game credits are displayed:
A CU item contains no data. It is a control item used to enable and disable the display in Dungeon Master II for Sega CD animations.
In the original animation files, CU items are always used to surround two items FS and PL (the order of which may vary):
CU with attribute set to 1 (disable display)
FS then PL, or PL then FS (set up the image and palette while this cannot be seen by the user)
CU with attribute set to 0 (enable display)
Note: sometimes the first CU is omitted (in files from the Japanese version).
A DL item contains an image with only the differences (delta) from the previous frame. Specific transparency codes are used in the encoded image, meaning previous pixels are not changed.
In order to decode an image corresponding to a DL item, you need to decode first the previous EN item (full image) as well as all other DL items up to the DL item you want to decode.
The last item of all the analyzed animation files is always a DO item which marks the end of the animation.
However, in Amiga versions, the code does not make this item mandatory.
Note: In the following animations, the size of the DO item is set to 0008h (8), but the item really does not have any data:
An EN item contains a full screen base image. The animation is then achieved by “patching” that image with DL items.
In Amiga versions, the image is copied directly to the frame buffer. The original program continues to read and decode the animation file while the image is displayed in order to save time. It also stores palette items (applied for EN and DL items) and music items but not sound items.
A FO item contains no data. It is a control item used to repeat a sequence of animation items several times.
On the Amiga versions, the animation engine supports a maximum of 16 nested loops. See the Loops section for details.
An FS item contains a full screen base image in Dungeon Master II for Sega CD animations.
Note: There is always a PL item before an FS item, except in DMII ENDA.DAT (Sega CD 1.0 JP), DMII SWSH.DAT (Sega CD 1.0 JP) and DMII TITL.DAT (Sega CD 1.0 EN & JP) where the PL item is stored after the FS item.
A GD item contains an image with only the differences (delta) from the previous frame. It is used only in Dungeon Master II for Sega CD animations and is the functional equivalent of DL items on other platforms.
GD items contain uncompressed tile based graphics without transparency whereas DL items contain compressed full bitmaps with transparency.
An MD item contains a standard MIDI file.
An MF item contains the name of an external file containing music data.
In all versions except Chaos Strikes Back for FM-Towns:
An MI item contains no data. It is a control item used to start playing a music. The item attribute contains the index of the music to play, as several musics can have been previously defined with MD or MF items.
In Chaos Strikes Back for FM-Towns: An MI item behaves likes a TR item and causes the music to stop with a fade-out.
A NE item contains no data. It is a control item used in loops. See the Loops section for details.
A P8 item contains a color palette. These palettes are used when a normal PL palette cannot be used. On PC when running in EGA mode the color palette is fixed. On PC-98 in 8-color mode, the 8 colors are also fixed. The PL item cannot be used to define custom colors and the P8 item is used to map the colors used in the animation to the preset colors in the default PC EGA / PC-98 8-color palette (the animations are not as nice as in PC VGA mode / PC-98 16-color mode where the game can choose its own colors).
1 byte per color used in the animation: The meaning of these bytes differ on PC and PC-98.
On PC: For each of the 16 colors used in the animation, each byte contains the color number to use from the default EGA palette (valid values thus range from 0 to 15). The EGA default palette is made of the following colors:
00 #000000 Black
01 #0000AA Blue
02 #00AA00 Green
03 #00AAAA Cyan
04 #AA0000 Red
05 #AA00AA Magenta
06 #AA5500 Brown
07 #AAAAAA Light gray
08 #555555 Dark gray
09 #5555FF Bright blue
10 #55FF55 Bright green
11 #55FFFF Bright cyan
12 #FF5555 Bright red
13 #FF55FF Bright magenta
14 #FFFF55 Bright yellow
15 #FFFFFF White
On PC-98: The screen resolution is 640x400 on PC-98. The animation resolution is 320x200, so each animation pixel is drawn using 4 pixels on screen:
AB
CD
In 16-color mode, the colors are defined from a palette of 16x16x16=4096 possible colors (see PL item) and all 4 screen pixels are drawn using the same color.
In 8-color mode, the 8 colors are predefined, and the 4 screen pixels may be drawn using several colors (this is called dithering and results in a better looking image).
Red | Green | Blue | Color name | Color |
---|---|---|---|---|
0 | 0 | 0 | Black | |
0 | 0 | 1 | Blue | |
0 | 1 | 0 | Green | |
0 | 1 | 1 | Cyan | |
1 | 0 | 0 | Red | |
1 | 0 | 1 | Magenta | |
1 | 1 | 0 | Yellow | |
1 | 1 | 1 | White |
The 16 bytes define 16 color mappings between the 16 color indices used by each animation pixel and the colors of the 4 screen pixels.
A PL item contains a 16 colors palette.
Header (6 bytes)
Data (66 bytes)
Four bytes for each color (4 bytes * 16 colors = 64 bytes):
Note: In the file IPLY.DAT from Dungeon Master II for Amiga, the first nibbles of RGB values are not equal to 0h but identical to the second nibbles. However these first nibbles are ignored by the engine, as if they were equal to 0.
An SD item contains sound data. Different encodings are used depending on the platform and game.
An SF item contains the name of an external file containing sound data. The format of the file should be the same as the data stored in an SD item.
An SO item is a control item used to start playing a sound. It contains 0 or 4 bytes of data depending on the game version. The item attribute contains the index of the sound to play, as several sounds can have been previously defined with SD, SF or TD items.
Note: The size of SO items is 0 in the following files:
A TD item contains no data. It is a control item used to refer to an external sound effect or music (not included in the animation file itself).
This item type is recognized in Amiga versions but is ignored.
In all versions except Chaos Strikes Back for FM-Towns:
A TR item contains no data. It is a control item used to stop music playback with a fade-out.
This item type is recognized in Amiga versions but is ignored.
In Chaos Strikes Back for FM-Towns: A TR item behaves likes an MI item. The item attribute specifies the track index to play (instead of a music index) as defined by TD items (who in turn refer to track numbers on the CD).
A WA item contains no data. It is a control item used to pause the animation until an event occurs.
This item type is recognized in Amiga versions but is ignored.
This item type is found in the following files: CSB ANIM.DAT (X68000 3.1 JP), CSB STORY.ANM (PC-98 3.1 JP) and CSB TITL.DAT (X68000 3.1 JP). The item attribute value is always 3 in these files.
An XA item is used to quickly display a final image when the animation is interrupted before the end. This item type is only suppored in Dungeon Master II for Sega CD animations. An XA item contains a sequence of other items (CU, PL, FS, CU) used to display an image. The items contained in the XA item are only played when the animation is interrupted.
Note: In DMII ENDA.DAT (Sega CD 1.0 JP), DMII SWSH.DAT (Sega CD 1.0 JP) and DMII TITL.DAT (Sega CD 1.0 EN & JP), the PL item is stored after the FS item.
There are three item types that can be used to create loops in animations: FO, NE and BN.
A loop has the following structure (where XX, YY, ZZ and RR represent any valid instruction):
FO (n)
XX
YY
ZZ
...
NE
RR
BN
A loop has the following behavior:
Using these rules, running the sample loop above with n = 3 would execute the following sequence of instructions:XX YY ZZ RR YY ZZ RR YY ZZ
and then execution would continue with the first instruction located after the BN.
Note: There is a bug in the animation engine in Dungeon Master for PC 3.4. If you specify a number of iterations greater than 10 in the FO item then the loop is only executed once.
At the end of the animation in DM END (PC 3.4 EN, PC 3.4 EN FR GE) the text ‘The End’ should glitter 50 times but it only does it once because of this bug.
The following table will tell you how many items of each type are used in each animation file:
File Name / MD5 | AN | BN | BR | CU | DL | DO | EN | FO | FS | GD | MD | MF | MI | NE | P8 | PL | SD | SF | SO | TD | TR | WA | XA |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DM END (PC 3.4 EN, PC 3.4 EN FR GE)C6DF13A7D542A809B10AA8F620145525 | 1 | 2 | 1 | 862 | 1 | 4 | 2 | 2 | 3 | 6 | 43 | 7 | |||||||||||
DM TITL.DAT (Amiga 3.6 EN FR GE), TITLE (PC 3.4 EN, PC 3.4 EN FR GE)05C2AB94CE4DFFE51B63985F7B0D1822 | 1 | 1 | 51 | 1 | 2 | 1 | 2 | ||||||||||||||||
CSB ANIM.DAT (Amiga 3.3 EN FR DE, Amiga FR Utility Disk)C2A6E36E842FF15C07FCDD076542B7B1 | 1 | 1 | 844 | 1 | 7 | 1 | 1 | 7 | 5 | 16 | |||||||||||||
CSB ANIM.DAT (Amiga EN Utility Disk)524D099FD80D266E3FE222AFA5267583 | 1 | 1 | 844 | 1 | 7 | 1 | 1 | 7 | 5 | 16 | |||||||||||||
CSB ANIM.DAT (Amiga GE Utility Disk)4A47040D6009C399E1C18A9DE7347615 | 1 | 1 | 844 | 1 | 7 | 1 | 1 | 7 | 5 | 16 | |||||||||||||
CSB ANIM.DAT (X68000 3.1 JP)6178F91435A9317FD3AF5868017F95AD | 1 | 1 | 844 | 1 | 7 | 2 | 2 | 7 | 5 | 16 | 1 | 2 | 1 | ||||||||||
CSB STORY.ANM (FM-Towns 3.1 EN JP)926D7839BE04F3C9836A1ED477767A78 | 1 | 1 | 844 | 1 | 7 | 1 | 2 | 7 | 5 | 16 | 2 | 2 | |||||||||||
CSB STORY.ANM (PC-98 3.1 JP)E5CABB3B7DE71A914742E917435C0E0D | 1 | 1 | 844 | 1 | 7 | 2 | 2 | 6 | 7 | 5 | 16 | 1 | 2 | 1 | |||||||||
CSB ENDA.DAT (Amiga 3.1 & 3.3 EN FR GE Game Disk, Amiga 3.1 EN Game Disk)9F2B73FF73AD0032810D79021C900CA9 | 1 | 1 | 1 | 285 | 1 | 2 | 1 | 1 | 3 | 2 | 3 | ||||||||||||
CSB ENDA.DAT (X68000 3.1 JP)2D8194CA2CE25DECCE6A756674C3CAD7 | 1 | 1 | 1 | 285 | 1 | 2 | 1 | 1 | 1 | 1 | 3 | 2 | 5 | ||||||||||
CSB ENDING.ANM (FM-Towns 3.1 EN JP)EF65AC2A8DD7554E8B4974D3845C8545 | 1 | 1 | 1 | 285 | 1 | 2 | 1 | 1 | 1 | 1 | 3 | 2 | 3 | 2 | 2 | ||||||||
CSB ENDING.ANM (PC-98 3.1 JP)33D9E3A84247E428E1989448D5DC66D6 | 1 | 1 | 1 | 285 | 1 | 2 | 1 | 1 | 1 | 1 | 2 | 3 | 2 | 5 | |||||||||
CSB TITL.ANM (PC-98 3.1 JP)2A6654FD2FDE8AEE980A7A8C0F067A7B | 1 | 31 | 1 | 1 | 1 | 1 | 1 | 1 | |||||||||||||||
CSB TITL.DAT (Amiga 3.1 & 3.3 EN FR GE Game Disk, Amiga EN & FR & GE Utility Disk), TITLE.ANM (FM-Towns 3.1 EN JP)5B590EA3A6F5EED513B5678B01468EE4 | 1 | 31 | 1 | 1 | 1 | ||||||||||||||||||
CSB TITL.DAT (X68000 3.1 JP)F4DA1B2C69A38325F036E8EBEE5699D6 | 1 | 1 | 31 | 1 | 1 | 1 | 1 | 1 | 1 | ||||||||||||||
DMII END (FM-Towns 1.0 JP, IBM PSV 1.0 JP, PC-9821 1.0 JP)B4A6A38657AC3C1857872952A25964D4 | 2 | 2 | 2 | 382 | 1 | 3 | 2 | 2 | 5 | ||||||||||||||
DMII END (PC-9801 1.0 JP)898ACF479051965341B9E6104452D249 | 1 | 1 | 375 | 1 | 3 | 3 | 1 | ||||||||||||||||
DMII ENDA.DAT (Amiga 1.0 EN)7F7FC31C4A1F41B8B2AFA81953823FF1 | 1 | 2 | 438 | 1 | 4 | 4 | 14 | 57 | |||||||||||||||
DMII ENDA.DAT (Sega CD 1.0 EN)7D716E35415E74CF69ACDC8EAC2196ED | 1 | 2 | 1 | 1 | 843 | 3 | 876 | 1 | |||||||||||||||
DMII ENDA.DAT (Sega CD 1.0 JP)25F44A7FE29FFE271F2D937D6BB15211 | 1 | 2 | 7 | 1 | 4 | 439 | 5 | 431 | 1 | ||||||||||||||
DMII IPLY.DAT (Amiga 1.0 EN)B1708891AB8C841B8046688E3F5C189F | 1 | 1 | 1 | 1 | 1 | ||||||||||||||||||
DMII STRY.DAT (Sega CD 1.0 EN)6098038C7681C08E88DAFA244AD50493 | 1 | 2 | 1 | 1 | 1535 | 27 | 2015 | 1 | |||||||||||||||
DMII SWOOSH (FM-Towns 1.0 JP, IBM PSV 1.0 JP, PC-9801 1.0 JP, PC-9821 1.0 JP)ECEC4D7AC081B099056531043191B55A | 1 | 18 | 1 | 1 | 1 | ||||||||||||||||||
DMII SWSH.DAT (Amiga 1.0 EN)ABCA5430912A5C2D3D35DD8142740C72 | 1 | 1 | 18 | 1 | 1 | 1 | 1 | 1 | |||||||||||||||
DMII SWSH.DAT (Sega CD 1.0 EN)544DA39473CDBA6F97C4714F3F617FD2 | 1 | 2 | 1 | 1 | 35 | 1 | 47 | 1 | |||||||||||||||
DMII SWSH.DAT (Sega CD 1.0 JP)CFF85B539BFE4BEB589E75B9BDC02959 | 1 | 1 | 1 | 1 | 1 | 18 | 1 | 20 | 1 | ||||||||||||||
DMII TITL.DAT (Amiga 1.0 EN)F023FD370AB1594EECA5B139A244B063 | 1 | 1 | 224 | 1 | 1 | 1 | 2 | 5 | |||||||||||||||
DMII TITL.DAT (Sega CD 1.0 EN & JP)C1E80401C83100319C142CF11ED44630 | 1 | 1 | 1 | 1 | 1 | 224 | 1 | 212 | 1 | ||||||||||||||
DMII TITLE (FM-Towns 1.0 JP, PC-9821 1.0 JP)D795BAB0B392B61534F64163FBBEDC38 | 1 | 1 | 224 | 1 | 1 | 1 | 1 | 5 | |||||||||||||||
DMII TITLE (IBM PSV 1.0 JP, PC-9801 1.0 JP)1780CA2972DF5FEBA5E232B11B79B0E5 | 1 | 151 | 1 | 1 | 1 |
I wish to thank Zyx, the developer of GraphReader. I found in his source code most of the algorithm needed to decode the IMG1 encoded images in animations (I just had to complete it to manage the transparency of delta images).
Thanks to meynaf too for his work in understanding animations in Amiga versions.