Jump to content
  • Advertisement
Sign in to follow this  
3dmodelerguy

Unity How to procedurally generate 2d top down world?

This topic is 401 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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. 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!