How to procedurally generate 2d top down world?

Started by
4 comments, last by 3dmodelerguy 6 years, 10 months ago
So I am trying to figure out the best way for me to go about procedurally generating 2d top down world (like RimWorld) for a game I am working on. From everything I have read it seems like I would want to use noise algorithms for generating the world however the kind of math that seems to be required for this type of procedurally generation is not a strength so I am trying to find libraries that will handle most of the heavy lift as far as the math / algorithms go however the results I have been able to generate so far have been unimpressive.
Right now I am just trying to be able to generate the main world land not worrying about small things / resources like tress, flowers, rocks, ore, etc right now. Want I am looking to be able to do right now is just:
  • Generate a map of X by X size that is surrounded by a certain impassable tile (deep ocean, unbreakable rocks, etc.)
  • Be able to generate a number of different biomes that have logical sense (have a beach biome only next to the ocean, have an oasis biome only within a desert biome, etc.)
  • Make the terrain look somewhat irregular so that each map generation does not look too similar and the biome shapes should be quite varied
I have been trying to use a Unity implementation of this library : https://github.com/Auburns/FastNoise_CSharp : and I am guess I am using it wrong or something as the maps I generally filled of a bunch of oval shapes within ovals shapes. The few tutorials I could find on the topic either 1. Go into building the noise generating algorithm itself which while at a basic level I could probably do but I would be completely screwed if I had to extend that algorithm to what it would probably need to be for my end goal or 2. Talks about stuff at such with no code examples or anything and at such a high level I have not idea what they are talking about. I have no issue with using the data that is generated from the algorithms to be used for generating the world, I just know that I am not the person to actually generate those algorithms themselves.
Are there any good tutorials that have decent code examples about working with 3rd party algorithm libraries (C# would be ideal since that is the language I use with Unity) to generate maps of this nature?
Advertisement

What are you generating exactly? It looks like you are assigning regions of a 2D map to belong to different "biomes", but how do the abstract biomes translate to concrete environments? For example, are you placing different plants as scenery in different biomes?

Also, why do you insist on using noise functions? If the main constraints in your procedural generation are about what biomes should or should not be adjacent, why don't you start from a planar graph of adjacent biomes and turn it into a map by giving each region the appropriate shape, elevation and other features?

Omae Wa Mou Shindeiru

Many years ago, I wrote some blog entries about using my own noise library to generate procedural islands:

https://www.gamedev.net/blog/33/entry-2249260-procedural-islands-redux/

https://www.gamedev.net/blog/33/entry-2249282-hooking-into-the-tree-to-build-a-map/

An example:

blogentry-47547-0-72940200-1296083423_th

The entries are quite dated now, as my noise library has moved on quite drastically from what it was back then, but the concepts still remain the same.

The idea is that you use different types of functions to generate the result you desire. The islands in those articles use a distance function as the base, which is distorted by a noise fractal to give the island shape. Other various functions and fractals are layered on to create mountains or hills, to delineate areas of mountain and hill, and so forth. It can require a great deal of experimentation so that you know what the results of certain functions will be, and can predict what things will look like.

Above post looks great. Additionally, here's a solid Unity tutorial on using noise to generate heightmaps. You can slice 3D or 4D noise to make it seamlessly wrap horizontally and/or vertically.

http://www.jgallant.com/procedurally-generating-wrapping-world-maps-in-unity-csharp-part-1/

I find erosion-modelling to be what makes noise-terrain look like real terrain. It's not too difficult to do and gives great results. Check out this paper for a good explanation and some images to get what it's about: https://www.dropbox.com/s/kqv8b3w7o8ucbyi/Beyer%20-%20implementation%20of%20a%20methode%20for%20hydraulic%20erosion.pdf?dl=0

Thanks for the tips all. I ended up continuing to use the noise generator for the general map and was able to find a tutorial that was dumbed down enough for even me to understand (at least enough) on how to create a circular mask with randomization in it in order to have the map completely surrounded by water / beach. I am sure I will have more questions in the future as I am sure I am going to need to do more / better generation but at least this gives me a map that is usable for the time being.

Thanks again.

This topic is closed to new replies.

Advertisement