Random map generator utility (beta)

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
batoonike
Posts: 75
Joined: January 3rd, 2009, 8:14 pm

Random map generator utility (beta)

Post by batoonike »

I made a small random map generator that works with templates. Templates are text files that have a list of commands. Combining these will allow you to create all kind of random maps with predictable structure. The result will be a scenario file that you will put into wesnoth/data/multiplayer/scenario folder and can play after restarting Wesnoth.

This is in very early stage. Currently works for 40x40 1vs1 maps that I play with a friend.

Download here for Windows: WesnothMapGenerator.zip

Example map:
Image

Example template. Documentation is included in the download.
//Generalrandomize
SelectAll(0)
Fill(1,"Gg")//grass
Fill(0.2,"Hh")//Hills
Fill(0.25,"Gs^Fms")//Forest
Fill(0.03,"Ss")//Swamp
Fill(0.03,"Mm")//Mountains

//Base mountains/hills
Repeat(8,12)
SelectClusterRandom(3,2,5,8,27)
Fill(1,"Mm")//Mountains
Fill(0.3,"Hh")//Hills
Fill(0.1,"Gs^Fms")//Forest
Fill(0.04,"Ww")//Water
Fill(0.04,"Mm^Xm")//Impassable mountain
EndRepeat()

//Clearings of grass
Repeat(4,6)
SelectClusterRandom(3,3,5,8,45)
Fill(1,"Gg")//Farm
SubSelectOne()
Fill(1,"Gg^Fet")//Great tree
EndRepeat()

//Roads between map corners
SelectLine(0,0,1,0,0,2)
Fill(1,"Gg")//Grass
SelectLine(0,0,0,1,0,2)
Fill(1,"Gg")//Grass
SelectLine(1,0,1,1,0,2)
Fill(1,"Gg")//Grass
SelectLine(0,1,1,1,0,2)
Fill(1,"Gg")//Grass

//Lakes
Repeat(3,4)
SelectClusterRandom(0,4,7,10,40)
Fill(1,"Ww")//Water
Fill(0.1,"Wwf")//Ford
Fill(0.3,"Wwr")//Reef
Fill(0.3,"Wo")//Deepwater
EndRepeat()

//Volcanos
Repeat(0,2)
SelectClusterRandom(3,2,3,4,8)
Fill(1,"Uh")//Undergroundhills
SubSelectOne()
Fill(1,"Qlf")//Lavachasm
EndRepeat()

//Villages
SelectAll(1)
FillCapEvenly(1,"Gs^Vh", 40)//Village

//Main Castles
//Player 1
SelectCluster(0.1,0.1,0,2,2,99,99)
Fill(1,"Ch")//Castle
SubSelectOne()
Fill(1,"Kh")//Keep
SetStartLocation(1)
This is inspired by Heroes of Might and Magic random map template system, which has enormously increased the lifetime of the game. The generator allows having any number of players, if you want more than 2 you will have to manually define additional sides in cfg file. There is no guarantee that this project will be continued.

Download here for Windows: WesnothMapGenerator.zip
User avatar
The_Gnat
Posts: 2215
Joined: October 10th, 2016, 3:06 am
Contact:

Re: Random map generator utility (beta)

Post by The_Gnat »

Wow this is a very useful tool! I will definitely try it out!
Post Reply