Map documentation

Discuss the future of Warzone 2100 with us.

Map documentation

Postby Prot » 02 Feb 2013, 14:52

Someone has documentation on the format of map files?
I need to parse game map, but i not understand of the some files like game.map and ttypes.ttp, and also is coordinates format, in game JS API act like map tiles, but in map files, coordinates very long, like pixels of the map.
Example of feature.ini:
Code: Select all
[feature_0026]
id = 26
position = 3648, 13376, 20
rotation = 0, 0, 0
name = OilResource

I would like to know the ratio between the tiles and the pixels. And just want to parse the map tiles, having received information about the water and cliffs for making better bot AI.
And i need specification of map binary files, to parse it byte by byte.
User avatar
Prot
Trained
Trained
 
Posts: 58
Joined: 29 Nov 2010, 12:41

Re: Map documentation

Postby aubergine » 02 Feb 2013, 15:30

ttypes.ttp is something to do with terrain IIRC, but never worked out exactly what or how it works.

Co-ordinates format is based in pixels, where 128 pixels = 1 map tile. So the position you show above is x=28.5 tiles, y=104.5 tiles (so the middle of tile at 28,104).

As for the Z index, I have no idea how that works - IIRC in the JS API it's often a negative number -- the higher the altitude, the more negative the number!

Anyway, I don't think there's any docs for any of this stuff yet - want to create some as you find out what things are? Would be huge help for many people!

Some links that might be of use in our quest:

* http://developer.wz2100.net/wiki/MapFormat
* http://developer.wz2100.net/wiki/ConvertingOldMaps
* http://developer.wz2100.net/wiki/ModdingTilesets
* https://warzone.atlassian.net/wiki/page ... Id=5406726
* http://warzone2100.org.uk/
* https://github.com/Emdek/wz-map-editor
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
aubergine
Professional
Professional
 
Posts: 3459
Joined: 10 Oct 2010, 00:58

Re: Map documentation

Postby Per » 02 Feb 2013, 16:02

I think the easiest way to understand the map format is to read the code I wrote for loading these files from command line utilities -
https://github.com/Warzone2100/warzone2100/blob/master/tools/map/mapload.cpp - but that may just be bias since I wrote them :)

ttypes.ttp contain which terrain textures have which terrain basic types.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: Map documentation

Postby NoQ » 02 Feb 2013, 16:03

And just want to parse the map tiles, having received information about the water and cliffs for making better bot AI.
And i need specification of map binary files, to parse it byte by byte.
You just won't be able to do it inside an AI script. API isn't given access to physfs.

What you may consider doing is calling propulsionCanReach() on adjacent tiles, this gives you complete passability information. No faster method exists, i think.
User avatar
NoQ
Special
Special
 
Posts: 6066
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Map documentation

Postby Prot » 14 Mar 2017, 15:07

I finally found the time to figure this out looking into game.cpp and map.cpp from gamesource. Wrote a bash/php script for parsing maps files "game.map" and "ttypes.ttp", hail map templates for AI !! :D
Now i can pass to my bot the info about cliffs(Yellow), water(blue), Weight of terrain from height(gray scale) and gateways(red) :3

Image
Image
Image
Image
Image
Image
User avatar
Prot
Trained
Trained
 
Posts: 58
Joined: 29 Nov 2010, 12:41

Re: Map documentation

Postby NoQ » 14 Mar 2017, 16:23

I think i committed terrainType(x, y) (5.50 in the docs at the moment) since then (3.2+).

There are no functions for retrieving height, but it's easy to add if have a good use for it.

Note that height is not a property of a tile, but of a vertex between four tiles.
User avatar
NoQ
Special
Special
 
Posts: 6066
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Map documentation

Postby Prot » 14 Mar 2017, 17:07

NoQ wrote:I think i committed terrainType(x, y) (5.50 in the docs at the moment) since then (3.2+).

There are no functions for retrieving height, but it's easy to add if have a good use for it.

cool, but i use 3.1.5 or at least for both versions. And i do precalculate distanses with a* then use templates for maps. In JS calculate in realtime it's too much expencive for bot script.
NoQ wrote:Note that height is not a property of a tile, but of a vertex between four tiles.

Yeah. It top left corner, i to much learn from code, even i do not need it anymore :lol2:
User avatar
Prot
Trained
Trained
 
Posts: 58
Joined: 29 Nov 2010, 12:41

Re: Map documentation

Postby NoQ » 14 Mar 2017, 18:49

Prot wrote:
NoQ wrote:I think i committed terrainType(x, y) (5.50 in the docs at the moment) since then (3.2+).

There are no functions for retrieving height, but it's easy to add if have a good use for it.

cool, but i use 3.1.5 or at least for both versions. And i do precalculate distanses with a* then use templates for maps. In JS calculate in realtime it's too much expencive for bot script.


You can do something like "if version is 3.2+, pre-calculate whatever you like in eventGameInit()". If it's about a few seconds (note that javascript is relatively fast by itself), users won't notice (the game doesn't start instantly anyway). Unfortunately, it'd need to be done for all players independently (so multiply time estimates by 9).

Squeezing pre-computed data into the AI would, on the other hand, quickly increase mod size when more and more maps are thrown into it, and supporting all future maps is also great.

Alternatively, you can pre-compute your stuff in background, taking at, say at most 10-20 milliseconds of each game frame in the early game (different scripts can be easily taught to take non-overlapping game frames, and also other CPU stress is much lower in early game).
User avatar
NoQ
Special
Special
 
Posts: 6066
Joined: 24 Dec 2009, 11:35
Location: /var/zone


Return to Development