How do games like Minecraft and No Man’s Sky have seemingly “infinite” world expansion, yet their files are not only tangible but quite small?

267 views

I was playing Minecraft the other day and went very, very far from my spawn point and eventually returned home. When I retraced my way back, I couldn’t wrap my head around how the game not only generates the environment but remembers the placement of everything as I return to the same places I had already been. With that in mind, wouldn’t the game be required to remember… an absurd amount of information as the user explores their world? How are the file sizes of these worlds not crazily big?

In: 12

8 Answers

Anonymous 0 Comments

Games like Minecraft generates the world on demand based on a seed value

It’s a pseudo randomizer that makes a unique world, but following certain rules so that you get chunks of blocks (like a lake) side by side instead of totally random blocks that would make no sense.

The seed value is a pseudo random code or string that you can plug into the randomizer to get a random world. Normally this is generated by the game, but you can manually enter one if you want.

The world doesn’t exist until you get close enough to that area, then the game generates it for you.

Storing that information in Minecraft is actually relatively straight forward.

You have to consider that part of the genius of Minecraft is that everything is a block. So you have to consider what is the smallest amount of information that I need to create and store a minecraft world?

You don’t need to store all the pixels of the entire object that is a block, because they are all very similar or identical, so a block can be represented by a single keyboard character in memory.

Most likely every block in the world has a location value in a 3D grid of X,Y,Z with 0,0,0 being the starting block

Each block also contains a value which is the type of block it is, and it’s status.

So a dirt block might have a value of A, a rock block B, etc etc

So the file will be

0,0,0 – A

0,0,1 -B

and so on

That’s a lot of text, but text is very easy to compress.

On top of that the game has to store the location of sprites like baddies and animals, and the player characters.

When the save file is loaded into memory the game loads the assets like the blocks and draws them based on their locations in the save file.

You are viewing 1 out of 8 answers, click here to view all answers.