Friday, October 28, 2016

tiles - Random map generation


I'm starting/started a 2D tilemap RPG game in Java and I want to implement random map generation. I have a list of different tiles, (dirt/sand/stone/grass/gravel etc) along with water tiles and path tiles, the problem I have is that I have no idea where to start on generating a map randomly.


It would need to have terrain sections (Like a part of it will be sand, part dirt, etc.) Similar to how Minecraft is where you have different biomes and they seamlessly transform into each other. Lastly I would also need to add random paths into this as well going in different directions all over the map.



I'm not asking anyone to write me all the code or anything, just piont me into the right direction please.


tl;dr - Generate a tile map with biomes, paths and make sure the biomes seamlessly go into each other.



Answer



Among the many other related questions on the site, there's an often linked article for map generation: Polygonal Map Generation for Games you can glean some good strategies from that article, but it can't really be used as is.


While not a tutorial, there's an article on how Dwarf fortress world maps are generated. Basically you generate multiple layers of noise, for height, moisture, temperature, salinity. Then you'd use something like this:


enter image description here


Or this


enter image description here


to generate biomes based on the layers of noise you produced before. Typically this gives a fairly smooth transition between biomes and the transitions are logical. I also modify the moisture and temperature maps based on elevation. This naturally generates a "timber line" and produces rocky mountains with snowy caps.


I'm using this strategy my game and it produces maps like this very quickly:



enter image description here


Additionally, you can see me scroll through a few more maps at the beginning of this video.


And here's some more to get you started:


How can I create a random "world" in a tile engine?


How can I identify feature regions in a procedurally generated world?


How do I create tileable solid noise for map generation?


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...