Page 1 of 1

Request, generate terrain **done, download inside**

Posted: 06 Sep 2011, 22:58
by Frank87
Hello there!

In the track editor you can now use script to place 10 tree blocks at random location at the map.
What I am wondering about: Could someone be able to create a script that created a terrain for you, completely random? This terrain would be of both water, hills, cliffs, mountains and so on.

Or is it impossible to make it completely random?

Re: Request, generate terrain

Posted: 07 Sep 2011, 13:33
by konte
I thought of this already as well. But making an authentic terrain script is a lot harder than just placing tree blocks, as you can imagine, I guess^^

If no one else has had the idea already and is working on it, I would like to make one :)

Re: Request, generate terrain

Posted: 07 Sep 2011, 14:59
by krial057
Here my first try: 8-)

Image
atm you can set the min and max height and the number of terrain "blocks" with random size.
Tryed first with generating a heightmap(with a fractal function) and then rendering the terrain with the heightmap hights. however, this took very long and so I gave it up and my new algorithm is simply get a random block height, position and size and place it...

regards Alain

Re: Request, generate terrain

Posted: 07 Sep 2011, 23:27
by Frank87
Nice! :) But please don't give up, see if there is a way to make a good algorithm. But of course ,if it's too hard I understand that - afterall, I canot make shit at all ;p

Re: Request, generate terrain

Posted: 08 Sep 2011, 14:27
by konte
I created a terrain generator, I'm very pleased with it :)

Image

It places all the three kinds of terrain randomly at random positions. As you can see, you can determine how man blocks will be set and if a certain block type should occur more often (this means, twice as much as normally).

Download: http://konte.org/daten/skripte/Bulldozer.Script.txt
(Place it in \Documents\ManiaPlanet\Scripts\EditorPlugins\TrackMania)

Re: Request, generate terrain

Posted: 08 Sep 2011, 14:57
by Frank87
This is absoluty amazin, thanks a lot!!
Thumbs up man.

Quick question tho: Would it be hard implenting so the game also used the various water and hill cliffs (the ones in the block selection) ? =)

Re: Request, generate terrain **done, download inside**

Posted: 08 Sep 2011, 21:37
by krial057
Nice one konte :thumbsup:
(Thank you for your very nice tutorial btw :D I linked it in my old reference)
(one question I coulnd't find out so far: is it possible to capture the keypress event in an editor plugin? oO if yes, I would have some nice ideas, like a 3d snake inside the editor xD)

My one is not yet as customizable as yours, but you can change some variables inside the script (making an interface too later...) You can: change the minimum and maximum height (f.ex. if you want to get very height mountains you can set a minimum height that is nearly on the maximum, or if you want to have small hills, you can set the minimum to ground height and the maximum to 1, 2 or 3 hills stacked)
My algorithm is a bit different. It has some Terrain templates with different height values (for example if you want height 5, the algorithm will take the terraintemplate:1 time mountain and 2 times hill).
Here my very best result so far:(had a lot of luck xD)

Image

The terrain generator is now also in my plugin collection(check the forum threadfor more infos)

If you want you can give my plugin a try too and give feedback(the download is in the collection thread or direct link

regards
Alain

Re: Request, generate terrain

Posted: 09 Sep 2011, 15:50
by konte
Well, my script doesn't pay a lot attention to the height, if there's a 2-level (or more) mountain, that's rather coincidence :D
And that's certainly a advantage of your code.

But the disadvantage is that you create only rectangles which doesn't look well on bigger sizes. My script adds always some smaller "add-on" blocks to the main block, if the block is large.
Frank87 wrote:This is absoluty amazin, thanks a lot!!
Thumbs up man.

Quick question tho: Would it be hard implenting so the game also used the various water and hill cliffs (the ones in the block selection) ? =)
Thank you :)
I don't think so, I'll take a look at it tomorrow or Sunday ;)

Re: Request, generate terrain **done, download inside**

Posted: 18 Sep 2011, 20:34
by Dany0
I think Konte's script is better for map making and AK's better for deco.