Skip to content

war3map.w3e Terrain

Stijn Herfst edited this page Nov 15, 2017 · 26 revisions

This is the tileset file. It contains all the data about the tilesets of the map. Let's say the map is divided into squares called "tiles". Each tile has 4 corners. In 3D, we define surfaces using points and in this case tiles are defined by their corners. I call one tile corner a "tilepoint". So if you want a 256x256 map, you'll have 257x257 tilepoints. That's also why a tile texture is defined by each of its four tilepoints. A tile can be half dirt, one quarter grass and one quarter rock for example. The first tilepoint defined in the file stands for the lower left corner of the map when looking from the top, then it goes row by row. Tilesets are the group of textures used for the ground.

Format

Here is the file format:

char[4]		"W3E!"
int32		w3e format version [0B 00 00 00]h = version 11
char		main tileset [TS]
int32		Custom tilesets flag (1 = custom tileset, 0 = no custom tileset)
int32		Amount 'a' of ground tilesets used (Maximum is 16)
char[4][a] 	Ground tilesets IDs (tilesets table)
int32		Amount 'b' of cliff tilesets used (Maximum is 16)
char[4][b] 	Cliff tilesets IDs (cliff tilesets table)
int32		Width of the map + 1 = Mx
int32		Height of the map + 1 = My
float		Horizontap center offset of the map
float		Vertical center offset of the map

Then width * height tilepoints, each 7 bytes long:

int16		ground_height
int16		water_height + boundary_flag
4bits		flags
4bits		ground_texture
4bits		ground_variation
4bits		cliff_variation
4bits		cliff_texture
4bits		layer_height

Explanation

char[4]		"W3E!"

A constant string at the start of the war3map.w3e file used to identify it.

int32		w3e format version [0B 00 00 00]h = version 11

The version. Seems to always be 11? Needs more investigation

char		main tileset [TS]

This is the main tileset for the map. Each tileset has an .mpq in the game mpqs which contains some specific textures for this tileset like water or cliff textures. It can be one of the following:

  • A Ashenvale
  • B Barrens
  • C Felwood
  • D Dungeon
  • F Lordaeron Fall
  • G Underground
  • L Lordaeron Summer
  • N Northrend
  • Q Village Fall
  • V Village
  • W Lordaeron Winter
  • X Dalaran
  • Y Cityscape
  • Z Sunken Ruins
  • I Icecrown
  • J Dalaran Ruins
  • O Outland
  • K Black Citadel

int32		Custom tilesets flag (1 = custom tileset, 0 = no custom tileset)

Indicates whether this map uses a combination of textures from different tilesets or a predefined one from the list above.

int32		Amount 'a' of ground tilesets used (Maximum is 16)

Indicates how many ground textures there are. The maximum is 16 since a tilepoint only allocates 4 bits and thus can save only 16 different values.

char[a][4] 	Ground tilesets IDs (tilesets table)

A list of strings of size 4. Example: "Ldrt" stands for "Lordaeron Summer Dirt"
Refer to "TerrainArt\Terrain.slk" located in War3.mpq or War3x.mpq for more details.

int32		Amount 'b' of cliff tilesets used (Maximum is 16)

Indicates how many cliff textures there are. The maximum is 16 since a tilepoint only allocates 4 bits and thus can save only 16 different values.

char[4][b] 	Cliff tilesets IDs (cliff tilesets table)

A list of strings of size 4. Example: "CLdi" stands for Lordaeron Cliff Dirt
Refer to "TerrainArt\CliffTypes.slk" located in War3.mpq or War3x.mpq for more details.

The cliff tile list is actually ignored, the World Editor will simply add the cliff tiles for each tile in the ground tile list, if a cliff version of this ground tile exists.

int32		Width of the map + 1
int32		Height of the map + 1

Width and Height of the map in tiles. We add 1 because a map of 256 x 256 tiles will have 257 x 257 corners.

float		Horizontap center offset of the map
float		Vertical center offset of the map

These 2 offsets are used in the scripts files, doodads and more.
The original (0,0) coordinate is at the bottom left of the map (looking from the top) and it's easier to work with (0,0) in the middle of the map.
These offsets are:

-1*(Mx - 1) * 128 / 2 and -1 * (My - 1) * 128 / 2

where:

(Width - 1) and (Height - 1) are the width and the height of the map in tiles 128 is the size of a tile on the map
/ 2 because we don't want the length, but the middle.
-1 * because we are "translating" the center of the map, not giving it's new coordinates

Tilepoint

int16		ground_height

Minimum height (-16384)
Normal height (ground level 0)
Maximum height (+16383)

The tilepoint "final height" you see on the WE is given by:

(ground_height - 0x2000 + (layer - 2) * 0x0200) / 4

Where "0x2000" is the "ground zero" level, 2 the "layer zero" level and "0x0200" the layer height

int16		water_height + boundary_flag

The highest bit (bit 15) is used for the boundary flag 1.

0x4000 --> boundary flag 1 (shadow generated by the world editor on the edge of the map)

The tilepoint "water level" you see on the WE is given by:

(water_level - 0x2000) / 4 - 89.6

Where "0x2000" is the "ground zero" level, -89.6 is the water zero level. The water zero level is a constant value found in Water.slk * 128. So height = -0,7 --> water_zero_level = -0,7 * 128 = -89.6.

4bits		flags

Flags values (shown as big endian):

0x0010 --> ramp flag (used to set a ramp between two layers)
0x0020 --> blight flag (ground will look like Undead's ground)
0x0040 --> water flag (enable water)
0x0080 --> boundary flag 2 (used on "camera bounds" area. Usually set by the World Editor "boundary" tool.)

4bits		ground_texture

Which ground textures is used (dirt, grass, rock, etc...). This refers to one of the ground tilesets discussed earlier.

4bits		ground_variation

Which variation of the texture to use (bones, holes, etc...). This is to reduce the amount of repetition.

4bits		cliff_variation

? (Which model to use? Values seen are 0, 1, 2)

4bits		cliff_texture

Which cliff texture to use (dirt, grass, snow, etc...). While technically this should refer to one of the cliff tilesets discussed earlier the cliff tile list is actually ignored, the World Editor will simply add the cliff tiles for each tile in the ground tile list, if a cliff version of this ground tile exists.

4bits		layer_height

The layer height is changed when using cliffs.

Implementation

Todo

Clone this wiki locally