An infinite world

As you might already know from my previous post about world building, the planets in Nimbatus are virtually endless. So what does “virtually endless” mean? All planets are procedurally generated (see my previous post), therefore the landscape gets generated as the player moves around instead of loaded from a file at once. This makes it possible to create a never ending world.

Break it down

The most important task when building an enormous world is to divide it into small parts. Each planet consists out of many small chunks and each chunk has information about it’s landscape and all objects placed on it. So there is no need to generate the entire planet at once, it’s sufficient to generate just enough chunks to fill up the screen.

As the player moves around all chunks leaving the screen are disabled. If the landscape of the disabled chunks was terraformed by the player, all the necessary information is stored into a file. This makes it possible to have a world that generates itself while the player moves around.


Floating point precision

As soon as you start working with ¬†huge worlds you will sooner or later run into floating point precision problems.¬†Unity’s coordinate system is based on floats which have a precision of only 7 digits. This will cause the physics engine to go berserk and make the game unplayable when moving too far away from the origin.

As it is not possible to change unity’s coordinate system to use doubles (15 digits precision) you will have to find another way to solve this problem. In Nimbatus the entire scene gets translated back to the origin as soon as the player moves too far away. All objects are moved within a single frame, so you won’t notice anything while playing the game.

Leave a Comment