Creating a random Country map
BlitzMax Forums/BlitzMax Programming/Creating a random Country map
| ||
I am trying to think of the best way to create a random map of countries. Sort of like the map on Risk, but I want the countries to be different every game. Anybody have an idea on how to go about it? |
| ||
Hmm, a Voronoi diagram might work. http://en.wikipedia.org/wiki/Voronoi_diagram Just need to get rid of the cells near the edges and randomize the borders a bit. |
| ||
Experimenting some more, this code will randomize the borders a bit. Just need to fill the edge cells with water and speed things up a bit and this should work nicely. |
| ||
Ok, my latest version. Looks pretty good, but I need to figure out what to do about the pointy peninsulas that are created and also still need to make things faster. Otherwise it looks nice. Makes little continents and islands. |
| ||
Perhaps you can use the same principle as used by the 'game of life' algorithm -- those tend to cluster together, with some islands here and there. Possibly run several iterations and blend them together, to enable you to subdivide landmasses into multiple countries dynamically as well. |
| ||
@xlsior. Thought I'd give your idea a try. After some tweeking, came up with some interesting landmasses. Now to figure out how to subdivide into countries. edit: Pressing space will iterate the creation phase again. Escape will end the program. |
| ||
the previous one produces an interesting map, the latest one just produces blank and white squares |