Random graphics generation.

```Jan Ekholm wrote:
>
> On Fri, 12 Jan 2001, Joel Utting wrote:
>
> >So...does anyone want to start a competition to see who can write the
> >best mathematically generated game ? As little as possible stored data,
> >and the focus on huge game worlds (generated) and lots of generated
> >objects.
>
> I would be interested in such a thing. Mainly the random creation of maps
> that could be used as a base for a map editor. It is much nicer to create
> a map for a scenario if you don't have to start out with just a green
> plain...
>
> One way, which is quite common, is to use "fractals" to generate the
> height curves for a map. Well fractals are just plain wrong here, plain
> recursion is what it really is. Just randomize heights for the corners of
> a map, subdivied the map into four equal rects and randomize the heights
> of the corners of this submap too. Continue recursion until the submap is
> a 1x1 tile. If you want water define the height for a "watermark". All
> land above this mark is land, below is water. This algorithm can be nicely
> tuned for all kinds of effects, and is very suitable for 3D-landscapes. A
> future version of our game Civil will use full 3D landscapes. Currently we
> use hexbased landscapes, and I haven't figured out how to nicely map these
> kinds of generated landscapes to that format.

I used to do that when I wanted a landscape, it produces a good image,
but it can be complicated to program - compared to what I do now. I
randomize the top left corner height of the map, then run down the side
of the map, moving the height up or down depending on a random value ;
then I run across the map using the 3 points from the left of the
current point as the height to altar. It produces nice maps quickly, but
they don't wrap well - big falls or jumps on the map borders usually.

The other way I've heard is using fault lines. Given a flat map, you
pick a line across the map at random and raise or lower all the points
on one side of the line by a fixed value. You then repeat until the map
looks very complicated. I tried this once - its not too bad. I wouldn't
mind trying it with random circles instead - raise/lower all the points
inside the circle. Could make a good map that wraps well.

Another I have tried is simply randomizing the map heights, then
averaging the map out a few times to "smooth" it down. This can be good,
but doesn't always smooth well.

Bye - Joel.

---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk