Back in 2019 I rewrote the island section of my noise-based map generation page. I had high hopes for that rewrite. It was ok, but I was still quite unhappy with it. So I rewrote it again.

Island map generation: demo and main ideas

What did I not like?

  1. The demo isn't interactive. In the text I told the reader to experiment with the parameters, but I didn't actually let them do that.
  2. My recommendations were mediocre. My thanks to KdotJPG on Reddit for pointing this out.

It turns out I didn't understand the problem as well as I thought.

So I decided to study it. I had been decomposing the problem into two: a reshaping function that can push the output up into land or down into water, and a distance function that determines how to reshape each part of the map. I made visualizations of various reshaping functions:

Reshaping functions

I learned a lot here. Looking at the outputs, I very much liked the curved variants. But it turns out these charts were misleading! More on that later.

I also made visualizations of various distance functions:

Distance functions

I learned a lot here too. But it turns out these were misleading too! More on that later.

Finally, I combined the two and generated lots of islands:

Combined output

I really liked some of the combinations and decided I should recommend them. I love "small multiples" visualizations that let you see all the outputs at once instead of using interactivity to see one at a time. But it turns out these visualizations were misleading too!!

What went wrong? How did all these visualizations lead me astray? It turns out that I still don't understand the island problem. A lot of my intuitions I had built for my polygon map generator. There, I used the island code to generate an island shape and then assigned elevation a different way. In doing that, I had thrown away the elevation data other than the 1-bit water/land sign. So when I recommended that same code on this page, where I don't throw away elevation data, it went badly. The visualizations I made here didn't show the final islands in 3D, and they were all tiny thumbnails, so I didn't see the artifacts.

I stopped and stepped back a bit. I needed to evaluate what I had learned and what might actually be useful now that I understand that I was approaching it wrong.

I moved all these experiments to their own page and decided to focus on the main page. What were my main complaints about it?

  1. The demo isn't interactive. So I made it interactive. I added a slider to move between the non-island and island versions, and offered a choice of distance functions. I also added a button to generate a new map.
  2. The recommendations are mediocre. I decided to go back to the original reshaping function. It has some known issues but avoids unknown problems from the other reshaping functions I tried. But the original distance functions I had recommended were clearly bad. Are there any that are clearly better? Yes. I changed the recommendation.

Along the way I learned that I needed to see the island in 3D to notice artifacts. So I changed the interactive demo to show the 3D island. And I made the colors prettier, not only for this demo but for the rest of the page. I had previously had a green to white gradient for elevation, and also low elevations became blue (water). But I had started the green underwater instead of at the lowest land elevation. Fixing that made the island map look a little nicer. While I was fixing up diagrams, I made the wraparound maps nicer:

Improved wraparound diagrams
Improved colors and 3d rendering

I am happier with the island section than I was before, but I'm still not really happy with it. I'll let it be for now and then come back to it later. I'm trying to treat my pages like a wiki: always improving, never finished. Take a look!

Labels:

3 comments:

Scott Turner wrote at April 21, 2022 6:53 AM

Most island generation seems to follow this paradigm of generating some terrain and then masking it with a generic island shape (e.g., SquareBump) and rely on the random aspect of the terrain generation to modify that mask into some acceptable island shape. But this has some drawbacks. Mostly it's hard to control, but it also rules out certain terrain + shape combinations, e.g., you're never going to get a high cliff plunging into the sea.

I found it helpful to separate the shape from the terrain. Rather than rely on the interaction between the terrain generation and mask to create a realistic island outline, why not generate the outline directly? In my case I did this by starting with a generic island shape and then perturbing it with noise to get a better island shape. (Of course, you don't have to get your island shape through perturbation -- I'm sure people can come up with some creative ways to think about that. I've thought about some kind of erosion process, for example.) But however you do it, I think the advantage is that you can optimize this process to get a good island shape, and optimize the terrain generation process separately to get good terrain.

Xejo wrote at April 22, 2022 10:14 AM

Just wanted you to know I'm fascinated by your articles. I'm not a designer, game developer, mathematician, or scientist (though I wish I was all of these things). I'm just a guy who thinks he has a great idea for a game and I'm just now diving into research on whether or not my ideas are easily supported by today's tech and how difficult they would be to develop. My idea is focused around several islands (each their own server), which is how I came across your Procedural Map Generator. Thanks for the detailed explanations and keep up the great work. I'll continue to follow!

Amit wrote at May 02, 2022 4:20 PM

Scott: agreed. I actually started with separating shape from terrain. I had come up with four shape algorithms for my 2010 "polygon map generator" project. And I continue using it for my own projects. But for this particular page I'm trying to come up with simpler algorithms that use only noise, even though noise doesn't produce the best maps. It's optimized for getting started rather than for getting the best maps.

Xejo: thanks! Glad it helped! Also see Scott's comment about how you can get *better* islands if you separate the shape algorithm from the elevation algorithm.