Dangerous Dave Level format

From ModdingWiki
Jump to: navigation, search
Dangerous Dave Level format
Dangerous Dave Level format.png
Format typeMap/level
Map type2D tile-based
Layer count1
Tile size (pixels)16×16
Viewport (pixels)320×160

Dangerous Dave stores its levels consecutively in the executable starting at offset $26E0A (after UNLZEXE'ing.) Each level is 1280 bytes long.

Level structure

Each level is stored in the following structure:

Data type Description
BYTE path[256] Path data
BYTE tiles[100*10] Tile data, left to right, top to bottom
BYTE padding[24] Unused

The 1000 bytes of tile data are followed by 24 bytes of unused data to bring the chunk up to a nice round 1024 bytes.

Path data

This block of data is used to specify a path for creatures to follow. It is an array of up to 128 X,Y coordinate pairs, with each pair being a signed 8-bit integer (so two bytes * 128 pairs == 256 bytes max.) Each value dictates the number of pixels the creature should move in both the X and Y direction. The end of the path is signified by storing 0xEA in both coordinates, and upon reaching this point the path repeats from the beginning. An example path might be

05 03 FB FD EA EA

Which means:

05 03   # Move five pixels to the right and three pixels down
FB FD   # Move five pixels left and three pixels up, i.e. return to the original position
EA EA   # End of path

This would cause the creature to oscillate between two points. (Since the values are signed, 0xFF == -1, 0xFE == -2, etc.)

Since the paths consist of relative movement instructions, a path that does not return the creature to its starting point at termination will cause the creature to gradually migrate off the edge of the level, as the misalignment accumulates after each loop iteration. However this could be used for creative effect, as the creature will then reappear at the opposite edge of the level.

It appears that only one path can be defined in each level, and all creatures follow it the same (although as the path consists of relative movement instructions, the creatures can trace out the same path at different locations in the level.)

Tile data

Level 1 with VGA tiles. Often two levels are stored in the one file.

The level consists of 1000 bytes of tile data, one byte per tile arranged in a 100x10 array.

The byte values are indices into the tileset, so a byte of value 0x02 means tile number 2 should be drawn in that location (with tile number 0 being the first image in the tileset.) Tile number 0 is actually a black square, so a byte value of 0x00 is used for empty space the player can walk in.


Both the player starting point and the creatures which appear in each level are hard coded as follows, with (0,0) being the top-left corner of the level and (99,9) being the lower right tile:

Level Level chunk Start Creatures
1 1 (2,8) None
2 2 (1,8) None
3 3 (2,5) Spiders at (44,4) and (59,4) - each spider is ~2x2 tiles in size
4 4 (1,5) TODO
5 5 (2,8) 3x Suns at TODO
6 6 (2,8) TODO (Bones)
7 7 (1,2) TODO (UFOs)
8 8 (2,8) TODO
9 9 (6,1) TODO
10 10 (2,8) TODO
5 warp 2 (51,0) None
8 warp 6 (71,0) None / shares with level 6
9 warp 7 (80,0) TODO
10 warp 1 (20,0) None

The level chunk is the "file" the level appears in (because some levels share the same files.)


The initial investigation and tile data documentation was done by Levellass, with Malvineous discovering how the path data works. 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!)