Creating a random Country map

BlitzMax Forums/BlitzMax Programming/Creating a random Country map

TomToad(Posted 2010) [#1]
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?


TomToad(Posted 2010) [#2]
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.


TomToad(Posted 2010) [#3]
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.



TomToad(Posted 2010) [#4]
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.



xlsior(Posted 2010) [#5]
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.


TomToad(Posted 2010) [#6]
@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.



slenkar(Posted 2010) [#7]
the previous one produces an interesting map, the latest one just produces blank and white squares