Map file
A map file is a file format is used in the Windows version of LEGO Rock Raiders, and to a lesser extent in the PlayStation version, to store the layouts of levels and designate various types of markers used for a variety of functions in-game. Multiple map files are stored in every level's folder. They use the filename extension .map
.
Default map files in the Windows version are paired with BLX files in every level's folder. The purpose of these files is unknown, and they are not used by the game at all. Their encoding is currently not documented. They may have been used in the creation of the Map files, or may be an older, more complex format for level maps that was abandoned in favor of the Map format.
Format specifications
Map files are encoded in hexadecimal code. All numerical values in map files are stored in a little-endian byte order (meaning the least significant byte is stored first - for example, the hexadecimal number 3E8 would be stored as E8 03
instead of 03 E8
). Every block in a level is designated by a 16-bit integer (example: 13 00
), which the game reads to generate blocks from the leftmost side to the rightmost side, and then back to the leftmost side of the next row down.
Every map file has a file header comprised of four 32-bit integers (known as words) . The first word in every map file is always 4D 41 50 20
, which in ASCII spells out MAP followed by a space. The second word records the number of bytes contained in the rest of the file, not counting the first eight bytes contained in the first two words. For instance, a 24x48 map would have a size value of 9A 09 00 00
, which means the rest of the file contains 2458 bytes (99A in hexadecimal), and the file's total size would be 2466 bytes. The third and fourth words list the X and Y dimensions of the map respectively, letting the game know how many integers to read before completing a row and moving to the next one below it.
Interestingly, each stored dimensions value is always one greater than the number of blocks actually present in the level in-game - so for instance, a 24x48 map would have a dimensions value of 19 00 00 00 31 00 00 00
, as 19 is hexadecimal for 25, and 31 is hexadecimal for 49. This may indicate that either that the vertices are counted rather than the blocks, or that there is an extra row and column of blocks on every map that does not generate in-game[verify]. Either possibility may be due to how the Surface map applies height values to the top left corner of a block rather than its center.
Map types
Nine different map types are used in the Windows version of LEGO Rock Raiders. Though they all use the same encoding, which type they're marked as will determine how they are used in a level. Because of this, not every level uses all map types, and some are used rarely by default. Every level at minimum requires a Predug, Surface, and Terrain map to function without crashing the game.
Block Pointers map
The Block Pointers map, usually found as tuto.map, is the map file type that designates the locations of tutorial blocks.
Tutorial blocks are markers or flags that are used in a level in cooperation with its NPL file. Depending on the objective scripting, flags can be used for a wide variety of functions, such as checking whether blocks are exposed or have been crossed, moving the camera to a specific location at a certain time, or pointing to a wall or floor block that the player needs to interact with. In special cases, it also tells an emerging creature where to travel, and can trigger a scripting function if they stop at a certain flag.
Block Pointers map files can use any hexadecimal values between 01 00
and FF 00
in sequence[verify] to designate tutorial blocks. Values of 00 00
are taken as null.
CryOre map
The CryOre map, usually found as cror.map, is the map file type that designates the locations and amounts of Energy Crystals and Ore in a level (hence the name Crystals and Ore). Note that this only applies to materials found in walls defined in the Terrain map; materials found lying around in open caverns are defined in the Object List file, and Ore dug up out of rubble is defined in the PTL file.
CryOre map files use only the following hexadecimal values:
00 00
- None01 00
,03 00
- One Energy Crystal02 00
,04 00
- One Ore05 00
,07 00
- Three Energy Crystals06 00
,08 00
- Three Ore09 00
,0B 00
- Five Energy Crystals0A 00
,0C 00
- Five Ore0D 00
,0F 00
- Ten Energy Crystals0E 00
,10 00
- Ten Ore11 00
,13 00
- Twenty-Five Energy Crystals12 00
,14 00
- Twenty-Five Ore
Values of 15 00
and higher will cause the game to crash when exposed. Odd values will cause the Energy Crystal notification message to play the instance the game freezes.
Emerge map
The Emerge map, usually found as emrg.map, is the map file type that designates the locations of trigger points and emerge points for emerging creatures. All the trigger points of an identical value are tied to all the emerge points of the value one above that of the trigger point. When a Rock Raider walks or drives over a trigger point, a monster will emerge from the emerge point tied to that trigger.
The emerge point must be on a wall defined in the Terrain map, can be any wall type except for Solid Rock, and can't be on a corner or have water or lava directly in front of it (even if the designated monster can cross water or lava). If all the walls located on an emerge points of the same number are mined, reinforced, or made into corners via collapsing walls next to them, the trigger point will cease to function. Conversely, a hidden wall that becomes exposed will cause a non-functioning trigger point to start functioning.
Like the Block Pointers map, every emerge block is given a different hexadecimal value in sequential order. Unlike the Block Pointers map, however, the values go up in increments of six instead of one, so that, for example, 02 00
and its trigger 01 00
are the first emerge in the map, but 08 00
and its trigger 07 00
will be the second, instead of 04 00
and 03 00
.
Therefore, Emerge map files use the following hexadecimal values:
00 00
- No Emerging on this block01 00 and higher in increments of 6
- Trigger on this block02 00 and higher in increments of 6
- Emerging on this block
Erode map
- Main article: Erosion
The Erode map, usually found as erod.map, is the map file that designates the locations of eroding lava and erosion paths. Like the Fallin map, higher values represent more dangerous erosion.
Erode map files use only the following hexadecimal values:
00 00
- No erosion01 00
,03 00
,05 00
,07 00
,09 00
- Blocks that only erode on a space adjacent to lava, with09 00
eroding the fastest and01 00
eroding the slowest02 00
,04 00
,06 00
,08 00
,0A 00
- Blocks that begin eroding at the start of the mission, regardless of whether they are next to lava or not, with0A 00
eroding the fastest and02 00
eroding the slowest
Odd numbers 0B 00
and higher have no effect. Even numbers 0C 00
and higher cause the erosion to progress backwards into the unused first stage, which it remains at until repaired.
Fallin map
The Fallin map, usually found as fall.map, is the map file type that designates the locations of cave-ins. Like the Erode map, higher values represent more dangerous or unstable cave-ins.
Fallin map files use only the following hexadecimal values[verify]:
00 00
- No cave-ins01 00
,02 00
,03 00
,04 00
,05 00
,06 00
,07 00
,08 00
- Cave-ins, with01 00
being least dangerous and08 00
being most dangerous
Path map
The Path map, usually found as path.map, is the map file type that designates the locations of Power Paths and rubble.
Path map files use only the following hexadecimal values:
00 00
- No Power Paths or rubble01 00
- Rubble02 00
- Power Path
Predug map
The Predug map, usually found as dugg.map, is the map file type that designates whether blocks are walls or cavern terrain, whether a cavern is exposed or hidden, and the locations of Slimy Slug holes.
Predug map files use only the following hexadecimal values:
00 00
- Wall01 00
- Exposed cavern02 00
- Hidden cavern03 00
- Slimy Slug hole04 00
- Hidden Slimy Slug hole
Surface map
The Surface map, usually found as high.map (and therefore often called the height map), is the map file type that designates the height of the terrain at each block in a level. Like the Erode map, higher values cause higher increments - in this case, the height of the northwest corner of a specific block. The exact difference between incremental height values is determined by each level's RoughLevel code, which by default is 6 in all levels. As the depth from the ground to the ceiling is a total of 80 in the unmodified game, 13 height units will nearly reach the ceiling[verify].
Surface map files can use any values between 00 00
and FF 00
, with the former being the lowest possible terrain and the latter being the highest possible. Most custom map tools only allow heights between 00 00
and 2F 00
, though manual hex editing allows for far greater values to be set. Such extreme height differences may cause mobile units and the game camera to move unusually. If the height difference is very sudden, sharp hills may disappear and be seen as fog holes in the ground and ceiling in eye and shoulder view, and moving the camera across such hills in top view can cause parts of low ground to disappear as they end up out of draw distance.
Terrain map
The Terrain map, usually found as surf.map (not to be confused with the above Surface map), is the map file type that designates the locations of various walls, as well as ground, water, and lava. The PlayStation version of the game also uses Terrain maps, found as terrain.map.
Terrain map files in the Windows version use only the following hexadecimal values:
00 00
- Null01 00
- Solid Rock02 00
- Hard Rock03 00
- Loose Rock04 00
- Dirt05 00
- Dirt, was most likely planned to be the unused Soil06 00
- Lava07 00
- An unused form of water that displays as a blue sheet floating at the top of the wall. Empty tiles next to it will cause it to sink down to the ground, though it seems to behave differently in eye and shoulder view. It was possibly meant for some sort of flooding mechanic, but was never finished.08 00
- Ore Seam09 00
- Water0A 00
- Energy Crystal Seam0B 00
- Recharge Seam
Note that none of the values actually correspond to ground, as a Predug map value of 01 00
(exposed) or 02 00
(hidden) is what actually determines caverns, while any Terrain map value except for 06 00
, 07 00
[verify], and 09 00
will default to ground when marked as such. Most default maps use Dirt 04 00
everywhere that ground is designated; however, custom map tools tend to mark 00 00
where ground is designated.
The following values are not used in map files and do not present correctly in levels (showing as ground stretching up to the ceiling and acting like a wall that can't be drilled but can cause landslides and emerges), but are used in the Radar panel:
0C 00
- Rubble0D 00
- Reinforced Wall0E 00
- Power Path0F 00
- Slimy Slug Hole10 00
- Undiscovered Cavern11 00
- Cavern Floor
Values of 12 00
and higher will crash the game when moused over.
Terrain map files in the PlayStation version use only the following hexadecimal values:
01 00
- Ground02 00
- Dirt03 00
- Loose Rock04 00
- Hard Rock05 00
- Solid Rock06 00
- Lava07 00
- Water
AI map
The AI map is an unused map type. Specifications are currently unknown.
Modding
To do: Write about various level editors and make articles for them when the forums are back up
All of these can either be opened using a Hex-Editing Program or more preferably using the RRU Level Editor or the Map Tool.