Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm looking to create a simple, "randomly" generated map for a small game.

The game consists of a top-down view of a world, with land-mass and ocean areas. Think of a simple outline map of the world for example.

The closest thing I can think of that I've seen before was the level-generator for the old SimCity games, or the Civ series, where you can set a preference for single continent versus many islands, etc.

What sort of algorithm would be suitable? The map will need to be moderately zoomable, so I can have a "whole world" view, and also a more zoomed-in local view, but I think I'll sort that out later.

Initially I don't need any concept of heights, just two areas - land and sea, although I might extend it later.

share|improve this question
    
I was thinking along the lines of generation using a perlin-noise function of some sort, but am not sure how to get from what is essentially a 2D heightmap, to a set of lines connect all areas at height X. –  Cylindric Sep 22 '10 at 14:20
add comment

1 Answer

up vote 16 down vote accepted

The "famous" Amit (with the giant page of various game programming topics) has a game programming blog, and he just completed a 3-part tutorial of an interesting method of map generation. I really enjoyed the reads, and there's a working demo in the bottom of the third article which is pretty stellar.

"Polygon map generation" part 1, part 2, part 3.

This may be a technique that you want to adapt to your needs! At the very least, he mentions the algorithms he uses at each step of the process: he starts by generation Voronoi polygons, relaxes them to a more even distribution using Lloyd relaxation, uses "a simple function to divide the world into land and water", and then flood fills to determine oceans and lakes. It sounds like you can stop there, or read on for mountains and valleys and turning it into 3D and so on.

share|improve this answer
1  
Oh wow, I used Amit's guide a huge amount to learn A*. It's like he looks into my head :) Time to get that "<3 Amit" tattoo... –  Cylindric Sep 22 '10 at 15:38
1  
Those are really freakin great –  Colm Oct 19 '10 at 22:21
    
Voronoi, nice. :) –  user712092 Jul 4 '11 at 15:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.