Sign in to follow this  

Unity Distributed procedural (inside-out) map generation

This topic is 2051 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

I'm playing with a terrain generator and renderer in Unity3D. The terrain renders properly, assuming it is passed reasonable values.

I'm attempting to construct a world generator using a set of filters and a port of the libnoise code. (Perlin generator, mostly.)

I'm attempting to wrap my head around the idea of biome generation using complex perlin noise filters. I'm aware that generating terrain from perlin fields on the fly takes a lot of time. I know you can lessen the time by pre-rendering the terrain, but this trades cpu for memory and network usage.

Instead of streaming world data to the clients, I will be using a perlin noise generator on the client side to generate the terrain. Are there any serious pitfalls to avoid with trusting the client to generate the terrain on the fly? Under what conditions would this be problematic?

I'm currently trying to figure out how to handle world generation as a whole, though. I'm doing some pregenerated stuff using a voronoi model of the world on the server, and then calculating the biomes of each cell by a quick noise elevation model, compared to an A* distance map from water for moisture, and a reflected gradient for temperature. From these three variables, I am getting the biome of an entire voronoi cell. All of this data is pre-generated, and each pixel in the model corresponds to a 16x16 tile block on the client. Only the minimum amount of data will be sent to the client to build the local region.

On the client end, this means I don't have to do much sanity checking, as the local terrain is not wildly variant. This means I can generate data from the inside out, as the server has met the client halfway, generating a plain world from the outside in.

The client takes the data the world has sent the client, and it uses it to locate a preprogrammed noise filter. Each biome uses its own filter, saving time pulling data from each filter, as data only needs to be passed through the biome filter the tile belongs to, or possibly a neigboring biome if it differs.

I'm running into a few conceptual problems:

How to store changes to terrain, such as cut down trees, player-made roads, etc. I could store it as a raster, but taking 16^2*2B + 17^2*2 bytes of data per tile just to save the data of a single tile change seems inadequate. Is there a more effective way to compress and process regional data pertaining to tile or vertex altitude changes?

Also, in addition to how to store the regional data, what would be the different ways I could store terrain on the server? Would it be better to break up the world data into raw map files and stream them into memory when needed, or would it be better to put the data into some kind of database. If database, what exactly would be the optimal method of storing it within a database? What would the pros and cons be of either?

Second, is there a good resource available for generating random terrain? I've been manually experimenting with how to use filters to randomly generate swamps, mountains, hills, plains, etc, but I'm really not seeing a lot of good documentation on how to get specific terrain effects out of a generator. Any documentation, or examples would be awesome.

Thanks,

Ne_xim

Share this post


Link to post
Share on other sites
[quote name='ne_xim' timestamp='1335470045' post='4935195']
Second, is there a good resource available for generating random terrain? I've been manually experimenting with how to use filters to randomly generate swamps, mountains, hills, plains, etc, but I'm really not seeing a lot of good documentation on how to get specific terrain effects out of a generator. Any documentation, or examples would be awesome.
[/quote]

These kind of algorithms is usually hard to predict, and experimenting is usually the way to go. If you want to accomoplish something specific, you need to think about what kind of "fractal" components possibly could accomplish it. For instance, if you'd want to create a volcanic surface, you could start by generating the basic surface with perlin noise, wich should produce smooth hills, and combine that with voronoi to produce cracks. That's the way to go.
As for references, the internet is flowing over with people doing proceduralism right now. http://vterrain.org/ is a great source for different techniques, although many examples are a bit dated. As for books, this one is fantastic, with many code examples: [url="http://www.amazon.com/Texturing-Modeling-Third-Edition-Procedural/dp/1558608486"]http://www.amazon.com/Texturing-Modeling-Third-Edition-Procedural/dp/1558608486[/url]
Good luck :)

Share this post


Link to post
Share on other sites

This topic is 2051 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this