The freeciv map format is quite simple. In theory it is even possible to edit it by hand.
Basic information[]
- Maps are always two-dimensional. They may wrap at the north-south and east-west directions to form a flat map, a cylinder, or a torus (donut).
- The map generator treats a
"wrapx wrapy"
donut as ordinary egg-like globe with two poles, and scrolling in any direction (up, right, down, or left) arrives back at the start after some time. - For a
"wrapx"
cylinder the map generator arranges the two poles as no-fly zones, and scrolling up or down will hit hard northern and southern ice borders. - No wrapping at all is suited for most scenarios, and scrolling in any direction hits one of the four hard map borders.
- Arguably
"wrapy"
without"wrapx"
(old index 2, 6, 10, or 14) is pointless, use"wrapx"
to get plausible ice borders for the poles. - Arguably
"hex"
without"iso"
(old index 8, 9, 10, or 11) is unsuited for displays in landscape format (width greater than height).
Individual tiles may be rectangular or hexagonal (hex), with either a classic or isometric alignment - this should be set based on the tileset being used.
Old index | New style | Topology | Comment | ASCII art | |
---|---|---|---|---|---|
0 | 0000 (0) | "" | Flat earth (unwrapped) |
|
_________ |_|_|_|_|_| |_|_|_|_|_| |_|_|_|_|_| |
1 | 0001 (1) | "wrapx" | Earth (wraps E-W) | ||
2 | 0010 (2) | "wrapy" | Uranus (wraps N-S) | ||
3 | 0011 (1+2) | "wrapx wrapy" | Donut (wraps N-S, E-W) | ||
4 | 0100 (4) | "iso" | Flat Earth (isometric) |
|
/\/\/\/\/\ /\/\/\/\/\/ \/\/\/\/\/\ /\/\/\/\/\/ \/\/\/\/\/ |
5 | 0101 (1+4) | "wrapx iso" | Earth (isometric) | ||
6 | 0110 (2+4) | "wrapy iso" | Uranus (isometric) | ||
7 | 0111 (1+2+4) | "wrapx wrapy iso" | Donut (isometric) | ||
8 | 1000 (8) | "hex" | Flat Earth (hexagonal) |
|
/\/\/\/\/\/\ | | | | | | | \/\/\/\/\/\/\ | | | | | | | \/\/\/\/\/\/ |
9 | 1001 (1+8) | "wrapx hex" | Earth (hexagonal) | ||
10 | 1010 (2+8) | "wrapy hex" | Uranus (hexagonal) | ||
11 | 1011 (1+2+8) | "wrapx wrapy hex" | Donut (hexagonal) | ||
12 | 1100 (4+8) | "iso hex" | Flat Earth (iso-hex) |
|
_ _ _ _ _ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ |
13 | 1101 (1+4+8) | "wrapx iso hex" | Earth (iso-hex) | ||
14 | 1110 (2+4+8) | "wrapy iso hex" | Uranus (iso-hex) | ||
15 | 1111 (1+2+4+8) | "wrapx wrapy iso hex" | Donut (iso-hex) |
Terrain IDs[]
Single-character unique terrain identifier. The terrain types and their identifiers are defined in terrain.ruleset.
Here is a table showing the terrain identifiers of the default ruleset:
Graphic | Name | Identifier |
---|---|---|
Glacier | a | |
Deep Ocean | : | |
Desert | d | |
Forest | f | |
Plains | p | |
Grassland | g | |
Hills | h | |
Jungle | j | |
Lake | + | |
Mountains | m | |
Ocean | SPACE | |
Swamp | s | |
Tundra | t |
Layers[]
The map consists of a number of layers, each containing distinct data. The first layer is alway the t layer, which contains the actual terrain through the ids outlined above. This layer is followed by one or several more layers that contain other data, such as rivers, resources, etc. These layers differs between versions, Freeciv 2.0.* and 2.1.* have different ways of saving specials and resources.
Rivers[]
Not sure if this is correct...
A scenario may define the terrain of the map but not list the specials on it (thus allowing users to control the placement of specials). However rivers are a special case and must be included in the map along with the scenario. Thus in those cases this function should be called to load the river information separate from any other special data.
Scenarios can have the "riversoverlay" capability.
[2013/09/20 - RCatYVR] In freeciv 2.4 and earlier, rivers are defined in spe01_nnnn as value=" 8 ". The system links or fans the channels depending on the surrounding tiles and any other adjacent value "8"s present,
Resources[]
Are not saved in scenario files rather they are randomized each time you load it, save games do save them though
Save games (2.3.x)[]
With freeciv 2.3.0 a new savegame format was introduced. The map part of a savegame starts like this:
[settings] set={"name","value","gamestart" "mapsize","FULLSIZE","FULLSIZE" "size",0,0 "tilesperplayer",100,100 "xsize",16,16 "ysize",16,16 "topology","WRAPX|WRAPY","WRAPX|WRAPY" [...] } [map] have_huts=FALSE t0000="h+hf aaaa ff" t0001="dgg aat ff" t0002="hhh pp" t0003="hmp ggghh" t0004="hmh s dghf" t0005=" dg phffpm " t0006=" " t0007="aa sdg aa" t0008="aa h aa" t0009=" jff p " t0010="mh s pdp pm" t0011="gf pdhh " t0012=" gpsg p" t0013=" h hh " t0014="hff gg s" t0015="m+h aaaa m f" startpos_count=5 startpos={"x","y","exclude","nations" 0,2,FALSE,"" 9,11,FALSE,"" 14,0,FALSE,"" 2,5,FALSE,"" 12,3,FALSE,"" } b00_0000="0000000000000000" [...] spe00_0000="0000000000000000" [...] spe01_0000="0000000000000088" [...] spe02_0000="0000000000000000" [...] res0000="c c x i y v " [...] owner0000="3,3,3,3,-,-,-,-,-,-,-,-,-,-,-,3" [...] source0000="242,242,242,242,-,-,-,-,-,-,-,-,-,-,-,242" [...] worked0000="-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-," k00_0000="a88880000000222a" [...] k01_0000="0000000000000000" [...] k02_0000="0000000000000000" [...] k03_0000="0000000000000000" [...] k04_0000="0000000000000000" [...] k05_0000="0000000000000000" [...] k06_0000="0000000000000000" [...] k07_0000="0000000000000000" [...]
Settings[]
The map settings like topology, map size, ... are saved in the settings section of the savefile.
Map definition[]
Terrain[]
Using the Terrain IDs the map is discribed in the tXXXX layer.
Starting positions[]
The starting positions are listed in a table with the x and y coordinates, a boolean if it should be excluded and the nation name.
Special Layers[]
- bXX_XXX list of all bases located on the map (1=Fortress, 2= Airbase, 3=Both)
- spe_XX_XXXX list of all specials located on the map
- resXXXX list of all resources located on the map
- ownerXXXX owner of the tiles (border information; player number)
- sourceXXXX list of all border sources
- workedXXXX tile is work by the city with the given ID
- kXX_XXXX last seen information, player knowledge
Layer Details[]
Resources[]
Dccoper 02:24, November 19, 2010 (UTC)[]
Special | Abbreviation | Allowed on Terrain |
---|---|---|
buffalo | b | plains |
coal | c | hills |
fish | y | lake, ocean |
fruit | f | jungle |
furs | u | tundra |
game | e | tundra |
gems | g | jungle |
gold | $ | mountains |
iron | / (slash) | mountains |
ivory | i (eye) | glacier |
oasis | o | desert |
oil | x | glacier, desert |
peat | a | swamp |
pheasant | p | forest |
resources | r | grassland |
silk | s | forest |
spice | t | swamp |
whale | v | ocean |
wheat | j (jay) | plains |
wine | w | hills |
Older formats[]
Save games (2.1.x)[]
Here is a list of layers that is available in save games from Freeciv 2.1.*:
t000= res000=" v $ / v " spe00_000="00002089" spe01_000="00002089" spe02_000="00002089" owner="-,-,-,-" /* player number that owns a specific tile*/ source000= /* border logic, what tile gave you access to this tile */ a000= /*these are most probably bitvectores 4 bit per character a,b,c,d,e,g,h,i=4 bit=32 bit */ b000= c000= d000= e000= g000= h000= i000=
Save games (2.0.x)[]
t000= l000= u000= n000= f000= a000= b000= c000= d000= e000= g000= h000= i000=
Known problems[]
This section is transcluded from Savegames:
Problems with the existing savegame format:
- they are big - they are many - they are disconnected from rulesets, giving errors or undesirable behaviour in saves when the ruleset changes - loading of savegames is not streaming but requires vast sums of memory (up to 100 megabytes) - load of big games can be quite slow
New features we want:
- replay
So how would a future, better savegame format look like?
Video[]
- More information will follow...