I am programming a tile based game and I have some basic tiles (grass, dirt, etc..), but I can't figure out how to make good random map generation, because when I do some really random selection, if the tile should be grass/dirt, I get this:

I understand why this is happening, but what I want is to create some random continuous areas of grass or dirt. Something that would make more sense, like this:

Answer
What you could do is randomly generate a Voronoi map like this:
- Picking random
center points(see the black dots) and randomly decide if they are grass or dirt. - Then for over all tiles, check if it's closest to a
center pointof dirt or a grass. - Done!
If what you did previously is "flip a coin" for each tile (noise), generating a Voronoi diagram will provide a much better result.
You could improve on this by dividing the center points into islands with an algorithm that:
- Picks a small group of
centers pointsand designates them asleaders. - Iteratively adds a random adjacent undecided center point each turn.
- Done!

No comments:
Post a Comment