Author Topic: Procedural Island Tilemap Generation  (Read 2631 times)

wg/funstorm

  • Global Moderator
  • Key Contributor
  • *****
  • Posts: 596
  • Karma: +0/-0
    • View Profile
    • Funstorm
Procedural Island Tilemap Generation
« on: Sun, Sep 2, 2012 »
This quick little random island generator was made as part of Ludum Dare 24. I had a really hard time finding good, easy to understand resources on the subject so I wrote up my own method. I made it in flixel, although I guess the method is generic enough that it would work in any language. Click the picture if you're curious as to how it's done!


Gama11

  • Contributor
  • ****
  • Posts: 390
  • Karma: +0/-0
    • View Profile
Re: Procedural Island Tilemap Generation
« Reply #1 on: Sun, Sep 2, 2012 »
Wow, those islands look pretty neat. Too bad you didn't finish the game in time.

I don't plan on implementing something like this in a project anytime soon, but it was an interesting read nevertheless. I really like the simple yet effective logic behind it. Kudos for creating this in <8 hours!

Raf

  • Contributor
  • ****
  • Posts: 268
  • Karma: +0/-0
    • View Profile
Re: Procedural Island Tilemap Generation
« Reply #2 on: Mon, Sep 3, 2012 »
Oooooh, this'll be interesting for the game I've been itching to make, especially if I can tweak this to become continents -- or one big landmass with a few islands here and there.

Raf

  • Contributor
  • ****
  • Posts: 268
  • Karma: +0/-0
    • View Profile
Re: Procedural Island Tilemap Generation
« Reply #3 on: Mon, Sep 3, 2012 »
Cause there's crap-all to do at work, I looked further into this. For lakes / rivers, it's best to keep height in mind (so you don't have stuff like a river suddenly appearing in a forest and running up a mountain). There're some algorithms for it out there (http://compsci.ca/v3/viewtopic.php?t=29157 is a very inspiring topic).

What I basically see for lakes and rivers (and foothills around mountains and all that), is that your current shape creation's done. I haven't found any algorithms that have better shape creation.

Then you run through the island you've made and randomly increase heights here and there (eg. by 5, the surrounding tiles get raised by 3, and those around those by 1). Your method of checking the surrounding tiles'd be great on this as well (so you can have mountain ranges with foothills around).

For rivers, you take a random amount of points in the higher levels, check which is the lowest tile next to it, set that to contain a river, then again, until you're either surrounded by higher tiles (you'll have a lake then), or you're at the sea.

For deserts, there's another thing I've been thinking about. You divide your map into thirds already. I'd say you can do so again for deserts and the likes, by saying: "Anything from Y: 0 up to Y: 10 is arctic. Anything from Y: 10 to Y: 20 is tundra. Anything from Y: 20 to Y: 30 is temperate. Y: 30 to Y: 40 is desert, Y: 40 to Y: 50 is temperate, Y: 50 to Y: 60 is tundra, Y: 60 to Y: 70 is arctic". So basically, you divide your map into climate lanes, pretty much like the real world. You then run over your generated world and, depending on the "lane", switch the type of tile to the lane-specific one.