Sign in to follow this  

How does on-the-fly map generation work?

Recommended Posts

I'm having a hard time finding articles on chunk-based "on-exploration" map generation, Google only returns pages that mention it without going into detail, ambiguous results that don't really have to do with this kind of map generation, and, of course, countless Minecraft related results.
So, how does one generate maps in chunks? And how does one make the generator result in the same map regardless in which order the chunks are generated?

I'm a fairly green C++ user who has only ever generated maps in their entirety instantaneously. But I'm now seeking to create one of those procedural deals that have worlds of potentially unlimited size, and I don't think I've ever been this clueless.

Share this post

Link to post
Share on other sites
To ensure that the same map is generated regardless of the exploration order you need a few properties:[list=1]
[*]You cannot use "randomness". Any pseudo-randomness must be based on the co-ordinates and other known data. Also ensure that any pseudo-randomness works the same on all platforms supported, e.g. don't use built-in APIs for random numbers.
[*]There is a limited radius of dependency between generated areas. If the generated data from any area of the map may affect the generated data of any other area of the map, the whole map must be generated in one go. This includes things like smoothing and blending. If you think of it in terms of tiles for example, you can't blend any further than half way into a tile, or it may have flow-on effects on other tiles.
[*]All assets (e.g. buildings, signs, etc) to display on the map must be available on demand. If you skip putting an asset on the map because it's not loaded or generated, exploration order matters.
Note that it also needs to be fast. Perhaps you could try generating prefabs that you can drop in as appropriate, for example a huge bunch of mountain ranges that you can apply a little rotation, texture changes, different treelines, erosion, etc at runtime.

Share this post

Link to post
Share on other sites

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