To create an arbitrarily large world, for example like in the game Minecraft or No Man's Sky, the common way to do this is by procedural generation.
Since RNGs are pseudorandom, that means that you can assign a Seed to every world or planet, and always get the same world.
My Problem is: When I want to create a world, I need an initial seed. Also, every point on the planet is assigned a pseudorandom height value. Using fractal noise, you can get good-looking landscapes.
However, a seed has the maximum size of 64-bit. To generate a unique value for every position, and have that value be dependend on the initial seed, you'd need to put the information of the x-Coordinate, the y-Coordinate and the World seed into the seed for the RNG, without addition or multiplication because then seeds could repeat. If you do this like this:
seed = (worldSeed << 32) | (x << 16) | y;
x and y could only be 16-bit numbers. That'd mean that if one step on the coordinate system is one meter, the world could only be 65.536 square kilometers big.
Minecraft and No Man's Sky and many other games however are way bigger than this. How are they able to do this?
Aucun commentaire:
Enregistrer un commentaire