It was my first ever attempt at something like this... I always shied away from anything procedural in the past because I thought it would be more complicated than it is. But I decided it was time to try and overcome those fears and try to generate islands that:
1. Look natural (= not computer generated)
2. Look unqiue
3. But still similar enough that the gameplay experience is comparable
All things considered I'm reasonably happy with the result. I wish I had more time to add features (lakes, river, mountains, deserts, etc) but most of the time it creates something that looks convincing enough. What do you think? Did I achieve my goals? Here's a couple examples that it generated.
So how is it done? Here's a quick step by step.
1. I start off with a 16x16 grid of water.
2.. I mark half the middle 1/3rd of tiles as land.
3. Then I go around in circles for the next 1/3 of tiles, growing the circle each time and marking random tiles as land. The more land a water tile is touching, the higher the random chance of it becoming land. This causes the land to become less as I move away further from the center while still mostly staying connected (but with the occasional island here and there).
4. The tiles get subdivided into 8x8 smaller tiles each.
5. Only the middle 50% of the newly subdivided tiles are kept as land, the rest becomes water again.
6. I connect all the land centers with each other.
7. And fill in the between connections. The basic shape of the island is now complete and it is time to make it more detailed.
8. To add detail, I use a similar method as before. I just go around in circles on each individual 8x8 tile that has land on it, randomly changing some water to land. Again, the chance of a tile becoming land is proportional to the amount of other land tiles it is touching. (At this point I'm going to stop using the hand-drawn diagram I have been so far because it's getting too tedious and switch to actual generated images, so that's why the island shape suddenly looks different.)
9. With the shape detail added, it's time to start modifying the terrain types. First, every tile touching water is turned into sand.
10. I go around the entire map twice, randomly changing some grass tiles that are touching sand into sand. As always, the chance of a tile changing is proportional to how many other tiles of the same type it is touching.
11. Now for some forest! I go back to the 16x16 grid I was using earlier and count how much grass each 8x8 tile in the grid has. If it is at least 25% grass, it gets marked as a potential forest starting point.
12. From the valid tiles, I pick 40% at random. Then I randomly choose a spot on each remaining 8x8 tile as a starting spot.
13. To grow the forest, I go in circles between 2 and 8 times around each starting spot, randomly turning tiles into forest. As always, touching more forest = greater chance to become forest.
14. For the final step, I pick 15-30 random tiles on the map as rock starting spots, and go in circles 0-5 times to grow them.
And that's it! The island is complete.
Bonus: this is what it looks like in-game at gameplay resolution with trees, berry bushes, and bugs.
I think there's a lot of room for improvement here. What you see took me 8 hours, and if I had more time I would:
- Add a a step between 7 and 8 that curves the angular sections to look more natural.
- Add features such as lakes, rivers, etc.
- Add terrain variety: deserts, snow etc.
Anyways, if you're looking for a quick and easy way to generate some okay-looking islands I hope this helps you. I hard a hard time finding good articles on the subject and didn't have time to do a lot of research. The article that probably helped me the most is Procedural Level Generation for Artists. It made me realize that the easiest way to exert some control over what the island would look like, while retaining a good amount of randomness, would be to fix and hand-tweak a couple variables (eg my 16x16 starting grid, filling the center 33% with land, etc). Other 100% randomized methods (for example) don't look or play as well, but I did learn to subdivide a large grid into a smaller one from it. I also decided against fancier algorithms like perlin noise (as Notch famously uses in MineCraft) due to time constraints.
Questions? Suggestions? How would you have done it? Leave me a comment!