Advanced Random Terrain Generation

Started by
13 comments, last by Vulcan 20 years, 5 months ago
Got the heightmap all done working fine. What I need to know is, is there any good ways to go about placing other random features on the terrain, eg. roads + rivers? I was thinking of generating a spline through the terrain then lowering the vertices/heightmap to accompany for the rivers, for roads I was going to do the similar spline, but only modify the terrain if the slope was to high (otherwise flatten it in the area for the road) Any other ideas? places I can go to find more info maybe? -Vulcan
Advertisement
Any chance you could share your random height-map code with me? I happen to be faced with the same problem and it would be nice to have some source code as a reference and example.

Email me. Thanks!
http://www.lighthouse3d.com/opengl/terrain/index.php3?mpd
nice tutorial
and you can find source for it too
i ended up making this midpoint dispacement, and some matrice smoothing too...
I have been thinking about this stuff also, as I need to create random maps for my 3D RTS...

I plan on using perlin noise for EVERY aspect of my map... not sure how you are creating your terrain, but I really like this method.

I was thinking that you could position trees/bushes/rocks by using a product in the perlin noise function possibly, and then testing if the height is above/below a certain threshold. Basically, you would end up with a realistic looking tree/bush pattern... you could even make it so that grass is found at a very ''low'' height, trees at ''high'' height, and shrubs in-between. This would produce a fairly realistic looking spread. There would be groups of trees which would fade into shrubs and then finally grass...

To make rivers, you can do the same sort of thing. The only problem is that to be realistic, it would need to follow some general rules... For example, rivers tend to be in ravienes not on peaks of mountains... Also, lakes tend not to be at high altitudes, though sometimes are. The easiest way to make the lakes is to just make any of your original land that is below a certain point, water... I''ll have to think about the rivers...

for rocks and things, you could just use say the first part of you terrain height perlin function and then add layer of fairly random, low amplitude noise. Again, you would place rocks at points above a scpefic threshold.

If you havn''t read up on perlin noise, I suggest you do, as it is a very very versitle algorithm and, I think, applies itself very well to this situation.

I would also, love to hear everyone else''s oppinions on this, as I am going to need to do this stuff pretty soon too as I stated above...

Hope I could help.

Dwiel
usually mine are generated like so:

firstly weather patterns. if you make the WHOLE map the same weather style it doesn;t matter

for the roads, just tell it where to start and where to end. this can be city''s warves, or edges of the map. you can make this bit random.


for the roads, just let some simple ai plot a course between the two points. don''t let the gradient (the slope of the road get to high) and in the end you shuold get a fairly decent road.


for the rivers, for each block on the map (or position, you get teh drift) their is an amount of rain fall.
Each bit of rain fall will add to its neighbour with the greatest negative slope (ie sloping downwards).
After a while this will generate a river.
Lakes will form when there are no lower neighbours.

If you set a level which the water will have to be above to be visible, this will let your dry bits, and the puddelly bits.
Beer - the love catalystgood ol' homepage
Dredge-Master:

I really really, like your idea about rainfall causing the rivers and such...

I think that it could be very interesting, dependin on the type of game, for all of this to be real time... have storms move in, rain falls, increasing size of creaks/rivers/lakes/etc... Adds for interesting effects if, in an RTS game, you can alter the ground''s shape... ie re-route water, etc... you could kinda make a natural moat around you city...

I wonder though, if there would be a good way to generate results of say, t amount of time of rain/the elements... without actually going through and simulating the weather... I guess you could just have a completely dry terrain... and have a ''great flood'' or just rain everywhere... I think this would still work...

I think it could be very interesting if the terrain changed as you played... commonly traversed places errode, weather patterns create dry spots, etc... You could also place trees this way... say, let some grow, with a leaniancy to grow near water...

Sounds very interesting...

I think real time rain in an RTS could be interesting... if say a huge storm moves in, a cloud oscures the units somewhat... water levels raise, etc

any more ideas?

Dwiel
I once had a craving for oldschool, totally useless but still fun coding in QBasic and wrote a really quick and dirty terrain generator (traced in pseudo-3D! :D). Of course, this was rather dumb though it was mostly a matter of getting that 90''s bit of code-craving calmed down and settled properly. But once that was done I felt like adding a little something extra, on a whim.

I had a nice little heightmap with heights ranging from 0-100. Since I was working in mode 13h, I had to limit myself (just putting things into context). I created a palette from 101-200 that contained water and started making it rain. I made every droplet "slide" down my hills by selecting the pixel with the lowest color value around it (ie, the lowest pixel on the map) and moving it in that direction. I''d keep doing that until I reached a point where no other pixel around the drop was lower (water already accumulated counts as land for the purpose of determining height). I let water accumulate like that, nice quick and dirty little bit of code...

What I ended up with was actually pertty surprising. I had bassins of water that filled up VERY realistically. After adding a little erosion (by "digging" into the ground as droplets flowed over them) I had very interesting rivers and lakes.

Ported to a more modern and more performant language, I''m pretty sure it could have nice results. I might try that at home tonight. But yeah, that technique turned out looking very nice.
funny
ive been thinking about the exact same weather system thing myself the past weeks. i doubt you could make it realtime though. just imagine this: you have a huge mountain lake, and someone digs a canal: how do you imagine you engine handling millions of cubic meters of water spilling over you map in realtime?

quote:
What I ended up with was actually pertty surprising. I had bassins of water that filled up VERY realistically. After adding a little erosion (by "digging" into the ground as droplets flowed over them) I had very interesting rivers and lakes.


i also think that wouldbe cricial to realism: the more water flows over a spot, the more ground is eroded. you could also make the water carry the sediment, and deposit it where the flowspeed decreases, in order to generate nice river deltas and meandering rivers and such. but once again: i think youll be forced to pregenerate this. on the other hand, that would rule out the possibility of deformable terrain... hmm..

maybe realtime would be possible, but you would have to come up with quite a clever system for that i think..

Some interesting links:



Modeling of ecosystems as a data source for real-time terrain by Johannes Hammes



A basic explanation of hydraulic erosion on a heightmap



John Beale''s homepage (screenshots of landscapes and some source code)



A while back, bishop_pass posted an interesting thread about terrain erosion, but unfortunately due to gamedev''s lack of adequate search function/archival methods, I''ve been unable to track it down. Hopefully this stuff can get you going in the right direction though.

-bodisiw
World Machine does some nice effects, including erosion.

______________________________

DGDev - The Delphi Games Development Community
______________________________DGDev - The Delphi Games Development Community

This topic is closed to new replies.

Advertisement