Realms of Chaos Level Format

From ModdingWiki
Jump to navigation Jump to search
Realms of Chaos Level Format
There is no image of a map in this format — upload one!
Format typeMap/level
Map type2D tile-based
Layer count3
Tile size (pixels)16×16
Viewport (pixels)320×200

File Format

The basic layout of a level file is as follows:

Data type Description
BYTE[0x300] palette 6-bit VGA Palette
UINT8 mapHeight Height of map, in tiles
UINT8 mapWidth1 Width of map, in tiles
UINT16LE[mapHeight*mapWidth1] backLayer Tile codes for the background tiles, one per tile
UINT16LE mapWidth2 Width of map, in tiles (might also be two UINT8 values)
UINT8[mapHeight*mapWidth1] maskLayer Tile codes for the masked and foreground tiles, one per tile
BYTE[11] unknown unknown data (could also be one UINT8 followed by five UINT16LE values)
UINT16LE spriteCount Number of sprite entries in this file
SPRITE[spriteCount] sprites Sprite entries
BYTE[0xC00] unknown ! these might be tile properties

Sprite entries use the following data structure:

Data type Description
BYTE[4] unknown (might also be a UINT32LE value)
UINT16LE hashValue Hash value for spriteName?
Char[52] spriteName Name of the sprite file (without extension)
UINT16LE posX X coordinate of this sprite, in pixels
UINT16LE posY Y coordinate of this sprite, in pixels

Note: A 52 character long name field seems a bit wasteful, as spriteName can only be up to eight characters long. Maybe some of those bytes are actually in-game for a different pourpose. They are always set to zero in the level files.

Tile Data

The game uses three tilesets for each level: BackGround tiles (.BG), Masked BackGround tiles (.MBG) and Masked ForeGround Tiles (.MFG). The background tileset can contain up to 512 tiles, while each masked tileset can only contain up to 128 tiles.

The names of the tileset files are not stored in the level file, but the game usually uses the same name for the level file and it's tilesets. So FOREST1.LED would use FOREST1.BG, FOREST1.MBG and FOREST1.MFG.

The format of the backLayer and maskLayer arrays is basically identical to the Monster Bash Level Format. The lower nine bits in the backLayer are the tile index for the background tileset, the upper seven bits are used for tile properties. The high bit in the maskLayer indicates a foreground tile, the seven low bits are the tile index.

The upper seven bits in the backLayer indicate the following properties:

Bit Binary (Decimal) Mask Purpose when bit is 1
1 0000001 (1) 0x0200 Can't walk right into tile
2 0000010 (2) 0x0400 Can't walk left into tile
3 0000100 (4) 0x0800 Can't fall down through tile (i.e. ground tiles you stand on)
4 0001000 (8) 0x1000 Can't jump up through tile
5 0010000 (16) 0x2000 Foreground tile contains an interactive item (gems, spikes, etc.)
6 0100000 (32) 0x4000 ! Blocks platforms?
7 1000000 (64) 0x8000 ! Unused?


This file format was reverse engineered by K1n9_Duk3. 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!)