I’m trying to come up with an alghoritm for generating a forest area(s).
For discreete 2D map, I have to determine, if there could be a tree
standing on a discreete_map_point (for each of those points). Not too
detailed by now. The program would just have to have a general idea of
where the forest is, and where it is not.
I’ve had a few approaches to the problem:
1. Generate a few points-of-attraction(PoAt). Those would represent
centers of “forest pieces”. For each PoAt, give it an efective range of
influence. Then, for a point on the map, we sum up all the influences
from all the PoAts and we can call this place a part of the forest, if
it is higher than _some_border_value_.
So we end up with a few circles of trees.
2. Let the PoAts have non-linear distibution of influence in their
ranges. We could take, for example a function:
f(d) = -1/2*(d/R) + 1 and a border value of 1/2.
So one PoAt would behave just as before, but two PoAts, that are
relatively close, would “help each other” and together they could
produce a foresty-link between their base areas.
So we end up with a few circle-like-shapes of trees, that are really
“attractors” to themselves. Of course, we can take more complicated
functions, but that doesn’t change the effect much.
3. We could add a little random value, let’s say (-0.1 .. 0.1), to the
final (summed-up) influence. Then the areas don’t look like ideal
circles(or snowmen ;)) and are more rough on the edges.
I don’t know, if I’m heading a good way, what do you think?
The code is really easy to imlement, even in ASCII-like graphic, so I’m
not posting it here.
…And I still don’t know, how to determine PoAts…
Any help is appeciated.
Please log in or register to post a reply.
Really good methods to create areas of something are fractal methods.
Look into particle deposition, you should be able to adapt that to get
nice results, GPG 1 had an article on it.
Yeah, good point. I spent some time researching in that direction and it
turned out that perlin noise functions can give exactly the shapes I was
Although it may be _too_ random for planning an overall forest shape,
but with some modifications…
/def (still researching…)