|
Roads & Rivers in Dynamic Procedural Terrain |
Anomie
Member #9,403
January 2008
|
I don't think 'dynamic' is super appropriate, but uh... Anyway, I was messing with some procedural terrain and I'm stumped on something: 1. I'm generating new terrain blocks as the player enters them. I'm using Perlin noise and some simple fiddling to get the basic terrain that I have now, and this gives me fairly nice lakes or ponds, which I considered connecting at random to generate passable rivers. The only problem is that I can't do this without pre-generating some adjacent terrain blocks. Another important point is that I'm doing this in real time in AS3, so I'm more concerned with playability and speed than with realism. Here's what I've got so far: http://cltatman.com/misc/generator.swf Anyone have any ideas? ______________ |
OICW
Member #4,069
November 2003
|
There's an interesting ACM article from 2005: Audiben, P., Belhadj, F - Modeling landscapes with ridges and rivers: bottom up approach. Although it's not purely dynamic, i.e. you have to pre-generate the terrain patch. In the first step they sprinkle the patch with ridge particles which are subsequently subjected to Brownian motion, this gives you ridge network. Second step consists of heavy sphere particles creating rivers. Finally they use classic mid-point displacement coupled with interpolation to get the rest of the terrain. You can think of it as generating terrain with constraints. I'm still looking for other solutions as well, though I plan to fiddle with this in my project as well. [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
gnolam
Member #2,030
March 2002
|
Something like http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ ? -- |
Anomie
Member #9,403
January 2008
|
@OICW: I can't investigate at the moment, but does that method only require a single terrain patch to be rendered, or the entire collection of patches that contain the river? @gnolam: Something like that, except that I'm only generating terrain three screens at a time. I'm having trouble generating sensible macro-structures one chunk at a time. Maybe I can do some peeking into adjacent blocks without generating them completely, I'll have to do some more work on it today. ______________ |
OICW
Member #4,069
November 2003
|
Well, in the examples they were generating 1024x1024 single patch. It took them approximately 4 seconds on modern CPU (don't remember specs at the moment). However, nothing prevents you from adapting the method to generate adjacement patches or one big patch and dividing it into smaller ones. Though, it all depends on what exactly do you want to do with it. I presume you'd like to generate the terrain on the fly without storing the heightfield. That could be quite tricky, but I think it can be done. One has to fiddle with ridge/river particle generation code, so both can propagate between adjacent regions. EDIT: [My website][CppReference][Pixelate][Allegators worldwide][Who's online] |
Anomie
Member #9,403
January 2008
|
OICW said: Well, in the examples they were generating 1024x1024 single patch. It took them approximately 4 seconds on modern CPU I'm only generating a 240x180 tilemap for each block, but I definitely can't spend 4 seconds on it. I've got my base terrain generation under 40ms, but I think I could manage more without noticeable delay using some progressive generation to split the work across several updates. My goal is to do this with only slight stuttering as new blocks are generated. Quote: I presume you'd like to generate the terrain on the fly without storing the heightfield. That could be quite tricky, but I think it can be done. One has to fiddle with ridge/river particle generation code, so both can propagate between adjacent regions. The heightmap is based on noise which I can store, but generating more than two or three chunks of noise (roads or rivers would certainly populate more than that?) is too expensive to do during the generation of a single terrain block. I don't have anything new to report, but I think I might try to generate a low-res, lo-fi noise map that encompasses many terrain blocks, and use that to define large structures. ______________ |
weapon_S
Member #7,859
October 2006
|
Couldn't you use a much simpler generator for roads and rivers, and just overlay that over the terrain? Like a simple tree generator? You would have to accept connecting lakes would be serendipitous, and roads might not follow a 'smart way' over the height map. You'd use a 'seed' based on the neighbour's, so roads would connect. |
Anomie
Member #9,403
January 2008
|
weapon_S said: That generator seems to give the same terrain, unless I clear the browser cache. Any regeneration hot-key? The generator is generating each terrain block dynamically each time you visit it, but it's all based on the same seed. I wouldn't recommend trying to use it right now though, it's currently a failed experiment to convert everything to tilemaps instead of pixels. Quote: Couldn't you use a much simpler generator for roads and rivers, and just overlay that over the terrain? The road/river generation process would hopefully be fairly simple using the macro-noise, but I haven't been able to work on it much lately. ______________ |
|