Polls

Default Game Speed

Log in to vote!

Latest Posts

Topic: how are map files structured ?

gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-21, 13:45

Hello,

i'm interested in map editing, and i would like to try to build / modify algorithmically some maps. In order to create balanced maps (with perfect symmetry or things like that), or geometrically based maps. I could build fully balanced maps for any number of players ...

In order to do that, i need to know exactly how the files are made. I tried to find it in the wiki but i could not find anything clear.

Thank you


Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1093
Ranking
One Elder of Players
Location: Poland
Posted at: 2019-11-21, 15:14

Hi,

I remember few talks about symmetries in Widelands, so first comment to that:
Map symmetry can be only 60 degree x Integer - as rotation symmetry. Or linear symmetry along 3 lines, 60 degree between each. And that is for "perfect" symmetry. But unfortunately it will not say that this map is completely balanced. In some directions big buildings are easier to build, in others not. So every time you have to test if something will work as expected.

Also I was interested in building maps from scratch at starting point (so map will be empty at the beggining and after starting the game, whole will be generated), but it stopped when I realized that it needs:

  1. Creating proper scenario in LUA, with complex solutions (to make a balance!)
  2. Adding some API between widelands code and LUA scripts for scenarios (not completed that time, maybe it has changed)
  3. It will be VERY CPU intensive, so people would be very upset while beggining to play.

BUT

Maybe you want to create a map on your side only, then upload created map and share with us, then Tibor is the best target person for that idea. He already made a script for such a process. Very good one. https://www.widelands.org/maps/srawerb-ait/ is an example of output of it. face-smile.png


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-21, 16:52

einstein13 wrote:

Hi,

I remember few talks about symmetries in Widelands, so first comment to that:
Map symmetry can be only 60 degree x Integer - as rotation symmetry. Or linear symmetry along 3 lines, 60 degree between each. And that is for "perfect" symmetry. But unfortunately it will not say that this map is completely balanced. In some directions big buildings are easier to build, in others not. So every time you have to test if something will work as expected.

i know about this.

Also I was interested in building maps from scratch at starting point (so map will be empty at the beggining and after starting the game, whole will be generated), but it stopped when I realized that it needs:

  1. Creating proper scenario in LUA, with complex solutions (to make a balance!)
  2. Adding some API between widelands code and LUA scripts for scenarios (not completed that time, maybe it has changed)
  3. It will be VERY CPU intensive, so people would be very upset while beggining to play.

that is not what i want to do. But do you know if it is possible to do that and to get the map after it, in order to save it in a file and re-use it ?

BUT

Maybe you want to create a map on your side only, then upload created map and share with us, then Tibor is the best target person for that idea. He already made a script for such a process. Very good one. https://www.widelands.org/maps/srawerb-ait/ is an example of output of it. face-smile.png

This was the idea, and if it works i will share maps as well as the tool i would build. I will loot at this link.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 512
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2019-11-21, 17:38

that is not what i want to do. But do you know if it is possible to do that and to get the map after it, in order to save it in a file and re-use it ?

A savegame file contains the entire map information. So I think you just make a savegame, compare the .wgf folder with some .wmf folder to find which files are extra, delete them, rename .wgf → .wmf, and you have a map file

Edited: 2019-11-21, 17:39

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-22, 21:59

i've been spending time reading some .wmf files to try to understand it, but i can't get the logic in it. I request just enough information to create a script to create a .wmf file from some heights and terrain arrays ...


Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-23, 16:27

I'm really interested in the script tibor used to create this map ...

ps : maybe this topic should be moved to the map editor forum ?


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 512
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2019-11-24, 12:43

gnarfk wrote:

i've been spending time reading some .wmf files to try to understand it, but i can't get the logic in it. I request just enough information to create a script to create a .wmf file from some heights and terrain arrays ...

The .wmf is a zip-compressed folder containing a number of binary files – one with heights info, one for terrains, one for immovables, etc.
Have a look at the write() functions in src/map_io/map_xxx_packet.cc to find out the syntax of each of the binary files


Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-24, 13:43

i just noticed this morning that i could ask the game to save in "not compressed mode" ... in this way it is easier to read the files ! It is why i could not understand anything at first

heights, terrain, resources are just arrays ... easy to read/write. mapobjects need still a little work to understand, but i will soon succeed.


Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-24, 23:03

I made a first program, only to create land, with neither resource nor immovables. Here (attached) is the kind of result i have for now ...


Attachment: test_gnarfk.wmf.zip (10.2 KB)

Top Quote
gnarfk
Avatar
Joined: 2015-01-05, 16:18
Posts: 66
Ranking
Likes to be here
Location: France
Posted at: 2019-11-25, 12:04

I updated my program, with random forests and rocks. Here is the first result i got with it.

Please let me know if you like it or not. (it is still a beginning)

Next steps: resources player locations port spaces

When all will be finished, a little work on symmetries/translations/rotations ....

Do you have some advices on amount of trees,rocks, resources ? i only have to change some parameters ...


Attachment: gnarfk2.wmf.zip (11.2 KB)

Top Quote