Carnivores 2 MAP

The **MAP** files are used in *Carnivores 2* and *Carnivores: Ice Age*. *Carnivores* also used MAP files, which had a slightly simpler format.

The MAP files consist of large blocks of data, many of which are pointers for items in a corresponding RSC file. MAP files are always exactly 14,155,775 bytes long, but RSC files can vary in size considerably.

Each area in *Carnivores 2* and *Carnivores: Ice Age* consists of 1024 \* 1024, or 1,048,576, cells. According to Action Forms, each cell is 4 \* 4 meters, making the overall area 4096 \* 4096 meters (just over 4 kilometers on each side), or almost 17 square kilometers; the maximum area height is 127.5 meters.

## Format

// fields (14155775 bytes)

0x000000
uint8
1048576
HMap

Terrain vertical height

0x100000
uint16
2097152
TMap1

Index to ground texture in RSC

0x300000
uint16
2097152
TMap2

Index to ground texture in RSC for distant mesh

0x500000
uint8
1048576
OMap

Index of the 3DF object in RSC

0x600000
uint16
2097152
FMap

bit
1

0x0001
Flag 0: *unknown*

bit
1

0x0002
Flag 1: *unknown*

bit
1

0x0004
Flag 2: *unknown*

bit
1

0x0008
Flag 3: *unknown*

bit
1
fmReverse
0x0010
Flag 4: The engine will reverse the order of the triangles so that the center edge goes the other way.

bit
1
fmNOWAY
0x0020
Flag 5: Marks this cell as invalid for spawning and path finding for AI

bit
1

0x0040
Flag 6: *unknown* (This flag is only set on "Mount Ravan" and the Trophy Room in *Carnivores 2*, and "Dry Nodus Lake" and "The Giant's Boot" (which have the same value map for this flag, one generated for the former level) and the Trophy Room in *Carnivores Ice Age*)

bit
1
fmWater
0x0080
Flag 7: Marks the cell as having water in it, must be set for the Water Index map to have any effect

bit
1

0x0100
Flag 8: *unknown*

bit
1

0x0200
Flag 9: *unknown*

bit
1

0x0400
Flag 10: unused

bit
1

0x0800
Flag 11: unused

bit
1

0x1000
Flag 12: unused

bit
1

0x2000
Flag 13: unused

bit
1

0x4000
Flag 14: unused

bit
1
fmWater2
0x8000
Flag 15: Marks the cell as having water in it (this flag is unused)

0x800000
uint8
1048576
Dawn LMap

Grayscale lightmap for dawn

0x900000
uint8
1048576
Day LMap

Grayscale lightmap for day

0xA00000
uint8
1048576
Night LMap

Grayscale lightmap for night

0xB00000
uint8
1048576
WMap

Index to water table in RSC

0xC00000
uint8
1048576
HMapO

Height map for objects that have the **ofPLACEUSER** flag

0xD00000
uint8
262144
FogsMap

Index to fog table in RSC

0xD40000
uint8
262144
AmbMap

Index to sound table in RSC

## Notes

* **MAP** files are always exactly 14,155,775 bytes long, if they are smaller than this they are either a *Carnivores MAP* file or are corrupted.
	+ The game doesn't check the size of the file before reading from it so there is no error checking prior to simply dumping the data into arrays, which permits corrupt data to be entered and allowing the game to reference objects that may not even exist, which can cause nullptr exceptions or crashes depending on the version of the game.
	+ Since the game doesn't error check the file size, one could pad their map file with extra data for a number of reasons, perhaps watermarking their file.
	+ Conversely, MAP files smaller than the expected size can be read fine, since the C STDIO library (which is used for reading the files) returns null when it is told to read past the end of a file. This means a MAP file could be truncated after the height block, and potentially even a completely empty file would work.
* Each unit of a field in the height map blocks corresponds to half a meter, giving a possible height range from 0 meters (for a value of `0x00`) to 127.5 meters (for a value of `0xFF`).
* While most blocks have a separate field for each cell of the map, the fog and sound table indices instead cover a square of four cells each.

## External links

* The .map files on La saga de Carnivores
* *Carnivores 2* and *Ice Age* .map files thread on The Carnivores Saga
* Online viewer allowing viewing of a *Carnivores*, *Carnivores 2*, or *Carnivores Ice Age* .map file's heightmap, water map, and flags