Subject: Re: Quasi-realistic algorithm Date: Fri, 08 Feb 2002 13:53:32 +0100 From: Artur Biesiadowski Newsgroups: rec.games.roguelike.development Hansjörg Malthaner wrote: >>5. Rivers run from the mountains to the ocean. Furthermore, they tend to run >>south. Lakes collect where there is a river in a lower-than-usual elevation >>area (that is, a depression). This can be implemented to your liking. >> > > What to do in plain areas? I tried to implement this algorithm a while ago, > but I got stuck in plain areas, where lots of indifferent directions can be > chosen for the river. Just an idea. Let's suppose that we are talking about tiles (maybe not exactly rogue-like tiles, but some discrete grid points). For every tile you should generate height. Best would be float one, with really random variation, so almost no two tiles will have exactly same value. Then start river somewhere in mountains and lead it randomly, with note that every time they have to go downwards. If at any point you hit place where all escape routes are higher, you start to form a lake - and thus increase 'water height' of given tile. At the moment you reach level of previous tile, you also turn it to lake and try to escape from both tiles. And so on. There can be some extra possibilities - if difference of levels between two tiles with river is bigger than given treshold, we have a waterfall. If you hit another river, end tracing. If you happen to have two possibilities of going further with very similar heights, add a small random chance of 'splitting' river. Another step in 'realism' direction would be to control amount of water. It would start quite small and then for every tile increase a bit depending on type of tile (from rain/very small streams which are invisible on this granularity etc). For some types of terrain it could be negative (desert - but then probably river would terraform this tile and possible few around to grassland at cost of decreasing flow?). If two rivers connect, add flows. Each terrain type would have it's maximal flow support - if river has too much water, it would have to split or become wider or terraform terrain (canonyons,etc). I have no idea at the moment how to handle wide rivers :) Deltas would be simulated by having 'beach' terrain type with a lot smaller flow allowance than normal terrain - so river would have to widen suddenly or terraform desert into ocean. Ok, last paragraph is a blue sky, but previous stuff could work. Major problem is generating 'realistic' height map. But I think it can be done - starting with seeding mountains and ocean, then interpolating between them, with addition of some variance (fractals ?). Artur