Last modified 8 months ago Last modified on 09/10/11 19:56:18

New Map Format

This page is here to discuss and develop a new map format for Warzone 2100.

Current proposed Format

We split decals and terrain into different files: decals.ini for decals, and terrain.png and height.png for terrain.

In the main savegame data, there will be a field to select current tileset, such as "arizona", for example. This will make the game look for a "<tileset name>.ini" under tilesets/ which maps decals and terrain names to actual texture files. A map mod can override this file to provide custom tilesets, in which it can use some of its own textures intermixed with existing textures.

The decals.ini will look like a bunch of these:

[decal_356]
decal = rocks3
x = 20
y = 3
flip = 0
rotate = 0

then, for example, in arizona.ini there will be an entry that (under [decals]) says "rocks3 = arizona-classic/rocks3.png".

(The game will stitch together individual textures into texture pages on load. No need to worry about that.)

The height information in height.png is stored as four height points for each tile, where the upper left pixel in the PNG is the upper left corner of the tile, while the lower right pixel is the center height of the tile. The two remaining pixels are unused for now, but should contain identical or interpolated values to the two others. This allows us to eliminate the tile flipping and rotation, and keeping some possibility for expansion later.

Finally, the terrain type information in terrain.png is mapped from fixed numbers 0-15 to textures in the <tileset name>.ini under "[tiles]", similar to decals, eg "0 = "arizona-classic/water.png". There is a maximum of 16 terrain types for each tileset. They follow a pattern that we encourage future tileset makers to follow, to make it easier to add generic support for any tileset inside map editors and map generators in the future:

#define T_UNDERWATER          0
#define T_CLIFF               1
#define T_CLIFF_VARIANT       2
#define T_LOW                 3 // low ground            
#define T_LOW_VARIANT         4
#define T_STANDARD     	      5 // most common terrain type
#define T_STANDARD_VARIANT    6
#define T_TILES        	      7 // tiled structure, eg inside base areas
#define	T_TILES_VARIANT	      8
#define	T_HIGH 	       	      9 // high ground
#define	T_HIGH_VARIANT 	     10
#define T_WET                11 // near water
#define	T_TOUGH	       	     12 // slow to move through
#define	T_SPECIAL1     	     13
#define	T_SPECIAL2     	     14
#define	T_REARM	       	     15 // rearm pad

Have a look at http://developer.wz2100.net/ticket/652