Phil said:
Ok... but if an entire terrain is generated by a seed number, how do you determine that you're only rendering/generating what you're seeing if you're not saving anything but the seed number?
Unless of course you only save what you're seeing into a buffer and load more dynamically as they come into view. One problem though with this would be probably memory once you step up to a point where draw distance will kill memory. Other problems would be LOD-algorithms I suppose...?
Admittedly, I haven't fiddled around with procedurally generated terrains - if it's something I'm missing, I'd be greatful if you could explain it.
I didn't mean that you would only use the seed number to generate the terrain. Then you would have no control over the type of terrain you want to make. But to make a terrain you need random numbers, and you make those from the seed number.
I'm not sure I quite understood some of your questions. I'll just outline one way to make a fractal tilebased "on demand" terrain. It's not the best way to do it because the terrain generation part wouldn't make too nice terrain tiles, but it's easy to explain.
Start out with a 256x256 heightmap. This is a low resolution version of the terrain we want. To make a terrain tile you take four neighbour points from the low resolution heightmap and fill in the details between.
Code:
step 1 step 2 step 3 step 4 step 5
X X | X-.-X | X x X | X.X.X | XxXxX
| | | | | | . . . | x.x.x
| . . | x-.-x | X.x.X | XxXxX
| | | | | | . . . | x.x.x
X X | X-.-X | X x X | X.X.X | XxXxX
1. Start with the four control point (X).
2. Make four new points (.) by averaging together the two closest control point and adding a random number.
3. Average together the new points(x) plus a random number to make a new middle point
4. Repeat step 2, but scale down the random number (we want to make finer and finer details)
5. Repeat step 3, and so on...
You can choose how many times you want to repeat these steps to get the LOD level you want. You might get cracks between the tiles but you can hide that by adding extra polygons around the edge that point down into the terrain. (I'm thinking a triangle based terrain, but this same algorithm would also work for voxels)
Now as the player moves around in this world make new tiles when he moves towards new control points, and discard old tiles as he moves away from them.