Currently Online

Latest Posts

Topic: Fractal based landscapes

Tibor
Joined: 2009-03-23, 23:24
Posts: 1187
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-02-26, 22:50
Hi

today I spent some time studying fractal method of landscape creation. Because I feel that my maps are too "unnatural" though there is a lot of randomness in them.

So I have some sample landscapes prepared here:





Two reasons why I am posting them now:

a) I need some assistance to convert them to widelands maps
b) I am interested in possible feedback, so feel free to comment :)

I know some 3D preview would be much better, but so far I failed to find an easy to use 3D surface plotter (for linux and command line preferrably). Never mind, what matter will be the look in the game itself...

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1023
Ranking
One Elder of Players
Location: Poland
Posted at: 2014-02-27, 01:17

Once I was talking with fk about his maps (he does it well).

He told me, that he has a program which is translating the pictures into widelands maps. He did that only for his work, but you can ask him for help.

Probably the program works the same as you did in your pictures, but only changes the format (not numbers into bmp/jpg, but bmp/jpg-> numbers -> widelands map).

It shouldn't be so hard to make simillar program.


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

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1438
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-02-27, 06:36

My advice: convert your image to a .pgm image (which is text based), open the file and copy and paste the numbers. Use a text editor to change the numbers into a lua table and put this into a script that sets the heights.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1187
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-02-27, 21:48
Hi

so first a technical detail - the result of my python script is 2D array of floats, and images are just presentation (I added colors, otherwise they would be B/W), so no need to use images to extract data...

Today I added export to a text file to my script, and modified LUA script to import the data and set heights on a map. The results (previews) are here:






Of course, I used functionalities from my other map generation scripts to set terrains and so on..

More tinkering is needed, but more-less everything to create a map is available. If LUA API for inserting raw materials and water and fish were functional, I would be able to generate amount of maps on the fly :)

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2716
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2014-02-27, 22:51

These look great face-smile.png


Busy indexing nil values

Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1438
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-02-28, 08:24

I agree that there are nice looking - how about enhancing our random map generator? Widelands is not in need of a stream of random maps - on the contrary. We have lots of mediocre maps in the map pool and only a few really great ones - a great map is balanced (i.e. fair for all players with all tribes on all starting position), not too big, not too small, not too protected. A random map is usually only fun to play when you play alone against the computer.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1187
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-02-28, 20:01
Random does not mean unbalanced!

The landscape is random, thus water/fish and mines are unevenly distributed over map, but it doesnt imply that chances of players are not equal.

When doing map with lua script I have targets and can see achieved amounts, f.e. for count of mines, of raw materials in map, water, fish, stones, trees, big-building fields and so on.

So everything is about numbers and I am able to quantify how many of resources are needed for expected number of players.

So this is not 'wild randomness' but 'controlled randomnes'

Moreover I test the game with all AI players, see screenshot



I run this test and if some player lags in growth, I try to identify why and modify map/nearby resources and so on. Or if some players run into each other too soon I move them farer apart.

BTW, I have one unfinished map with water surface like 50 %, terains are set, stones and trees as well, if anybody is interested and want to spend some time finishing it I can send it. Raw materials, water, fish must be added manually and headquarters must be placed and some final tweaking is needed.
Also I am no fan of seafaring and this map deserves seafearing...
Send me a PM if anybody interested.

If anybody is interested, here is a sample of water landscapes, as generated by script (I can control % of water in map)...




Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1438
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-03-01, 12:51

I sounds really interesting. Let see that the bug that sets resources is resolved quickly. Could you also make your map creating code available somewhere? I'd really like to take a look at it.


Top Quote
Tibor
Joined: 2009-03-23, 23:24
Posts: 1187
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2014-03-01, 18:54

The code is here:

http://pastebin.com/qrB1wac1

This is code used for "Mountain Lake" map. import_coordinates_2.txt file is a file with heights - output of my other script that generates the random (fractal) landscape.

It is spagheti code for my own use only, whenever I have any idea I rework it, or copy to new file and modify...

(Heck, I just found an error on line 355, should be "while" not "if", now I understand why I had visible vertical delves/lines on x=0 face-smile.png )

Edited: 2014-03-01, 19:03
Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1438
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-03-03, 06:33

I am more interested in the fractal based generation code than in the boilerplate to get it into Widelands. After all, this is where the juicy maps are generated from, right?


Top Quote