Automated map analyzer (idea)

Get some help with creating maps or modding.
Need a map editor or other tools, look here!
Post Reply
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Automated map analyzer (idea)

Post by NoQ »

I have an idea of writing a program that would analyze warzone2100 maps. The main thing it should do is calculate the "map metrics", by which i mean distances between important objects like player bases or "early" oil derricks.

Let me explain it a little further. One can make this analysis manually by sending a truck to a certain location and watching the game time. For example, it takes around 1 minute 30 seconds to "travel by truck" from one base to another on "Startup", but it takes around 2:30 on "Contention", which makes Startup much more suitable for rushing (the enemy will make less tanks during the time it takes to reach him). Another important aspect of the game is the time it takes to reach the first few "extra" oil derricks ("expansion") from your start location. Such analysis, being simple enough, could easily expose the balance flaws of asymmetric maps like Startup-1 or Highground. This could make making balanced asymmetric maps much easier.

Well, let me think. What do i need for this? First of all, i need a tool to extract start locations and oil derrick locations from the map. Second, i need a tool to make pathfinding and calculating the path length. The rest should be easy. Is it easy enough to obtain such tools?
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: Automated map analyzer (idea)

Post by lav_coyote25 »

only if you make it. :)
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Automated map analyzer (idea)

Post by NoQ »

I know, i know (:

Well, maybe if someone could point me to the pieces of code i could use ;)
It must be easy for Flail13 to give me some hints on extracting data from the map; Even if they'll be in VB.NET, i'd still like them :)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Automated map analyzer (idea)

Post by Per »

In the source code, look in tools/map/, there are some programs to extract map info.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Automated map analyzer (idea)

Post by NoQ »

Per wrote:In the source code, look in tools/map/, there are some programs to extract map info.
Well, i've just found myself in the mood to try to look there, and found out that these tools aren't working :(

Code: Select all

$ ls
2c-Contention.wz  8c-jp2100.gam  map2lnd.c  mapconv.c  mapload.c  pngsave.h
4c-Visionary.wz   8c-jp2100.wz   map2png    mapinfo    mapload.h
8c-jp2100         8c-squared.wz  map2png.c  mapinfo.c  pngsave.c
$ ./mapinfo 8c-squared.wz
Could not open 8c-squared.wz/game.map
Game file 8c-squared.wz.gam not found
$ ./mapinfo 8c-jp2100.wz
Could not open 8c-jp2100.wz/game.map
Game file 8c-jp2100.wz.gam not found
$ ./mapinfo 2c-Contention.wz
Could not open 2c-Contention.wz/game.map
Game file 2c-Contention.wz.gam not found
$ ./mapinfo 4c-Visionary.wz
Could not open 4c-Visionary.wz/game.map
Game file 4c-Visionary.wz.gam not found
(i.e. i've tried maps created by different map editors)

I was also trying to unpack the map, but, curiously enough, the result was the same:

Code: Select all

$ ls 8c-jp2100
dinit.bjo  feat.bjo  game.map  struct.bjo  taglist.tag  ttypes.ttp
$ ./mapinfo 8c-jp2100
Could not open 8c-jp2100/game.map
Game file 8c-jp2100.gam not found
$ ./mapinfo 8c-jp2100.wz 
Could not open 8c-jp2100.wz/game.map
Game file 8c-jp2100.wz.gam not found
I hope to learn it some day (:
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Automated map analyzer (idea)

Post by Per »

I have never tested it on packed maps (.wz). It works when called on maps like this: mapinfo data/base/multiplay/maps/2c-highground

It is a bit picky about paths and stuff, because it is just a test tool that I quickly put together.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Automated map analyzer (idea)

Post by NoQ »

Yay, got it working! It just needs at least some sort of path to the file supplied as an argument (at least "./map.wz"), to initialize the PhysFS. Still, i can't get it working with .wz archives (i was thinking that PhysFS is just supposed to do it, but had no luck yet), but at least it works with unpacked maps.

Looks like it's easy enough to extract a heightmap (using the code from map2png):

Code: Select all

#include "mapload.h"
/*...*/
map = mapLoad(filename);
MAPTILE *psTile = mapTile(map, x, y);
// and then ask questions like "psTile->height", etc
But the MAPTILE structure doesn't seem to include any info about the tile type. I want to check if a tile is a water or is a cliff. Relying on

Code: Select all

        uint32_t                texture;                // Which graphics texture is on this tile
is bad, because tile types are reassignable. Well, at least i can start trying to make it work on maps with original tile types.

Another question: Is there some info on how the hills affect unit speed?
Eg, how quickly will a truck-viper-wheels climb an orthogonal hill between a vertex line of height 10 and a vertex line of height 20?
Post Reply