0
\$\begingroup\$

I'm trying to create a very modifiable game starting with terrain in the form of a tilemap.

Any type of tile can be removed, modified, or created by the user. The problem is that I can't find a way to properly implement terrain generation for this.

The amount of tile types that can be used is known at run time of course, but I'd like to avoid placing a hard limit or hard coding most numbers. There is no issue with having too many types and generating a nonsensical map.

I've tried Perlin and simplex noise, but, ultimately, there was no real consistency with even 4 tiles.

I've also tried using weights, but couldn't find any relevant resources to smooth it out.

I know that generating multiple noise maps (temperature, for example) is another option, but I wanted to see if there was a better one.

To specify,

I moved back to Perlin noise and get the following using every possible tile (which is 8 at the moment)

8 Tiles

With some tweaking, it looks somewhat okay but still fails to not look like a meteor strike.

With just 3, I get this using ocean, grass, and mountains (blue, green, and black respectively)

3 Tiles

And again, tweaking it doesn't help much, most likely due to my method of selecting tiles.

I've tried turning the noise map into a height map, as well as a weight map, among others, but the results are mostly inaccurate or very ugly, even with tuning.

What I'd prefer is the following, assuming hills, forests, grass, water, and surface water are used.

Desired

\$\endgroup\$
5
  • 1
    \$\begingroup\$ This problem looks a bit under-specified in its current form. To come up with a method the generator should use for assigning tiles, we need an idea of what the output should look like, or specific criteria we can judge it against, so we can distinguish "good" generator algorithms from "bad" ones. Try editing your question to show us a sample of the set of tiles you might have at runtime, and a sample output using those tiles that you'd consider "good". Even better if you can show two examples with different tile sets, illustrating how you want the generator to adapt to changes in its input. \$\endgroup\$
    – DMGregory
    Nov 26 '21 at 21:39
  • \$\begingroup\$ @DMGregory Thanks for your response, I've added some examples to the question. \$\endgroup\$
    – zeplar_exe
    Nov 26 '21 at 22:46
  • \$\begingroup\$ How should the generator know which tiles belong in stripes like rivers, which ones belong in blobs like lakes, etc? What kind of additional information will you be providing alongside the tile images/colour values? That part of the problem still isn't specified here. \$\endgroup\$
    – DMGregory
    Nov 26 '21 at 23:04
  • \$\begingroup\$ @DMGregory That's fair, I assumed that noise would generate that information for me, as generally implied in discussions I found on the subject. What would you recommend? \$\endgroup\$
    – zeplar_exe
    Nov 26 '21 at 23:11
  • 1
    \$\begingroup\$ Noise just gives you pseudorandom numbers. It does nothing more contextually-sensitive than that. That higher-level semantic/distribution guidance needs to come from your app. So it looks to me like you might need to take a step back and think about the set of patterns of tile distribution you want to support. Then you can edit your question to clarify the rationale you want your generator to use. Put yourself in its place "user has passed me tiles A B X Y, how do I arrange them in a nice map?" Once you understand this rationale, we can help you translate it into an algorithm. \$\endgroup\$
    – DMGregory
    Nov 26 '21 at 23:48

You must log in to answer this question.

Browse other questions tagged .