Viewing a single comment thread. View all comments

RhynoD t1_iy8w3cu wrote

Minecraft is procedurally generated. The world does not exist if it isn't loaded because you are in that section of it. Every time you load a section, the game uses the seed to rebuild that section based on a set of rules.

For example, the rules might say: start with bedrock here. If the seed value is X, put stone above it. If there are Y number of stone blocks within such and such distance, the next block should be magma. If there are such and such magma blocks, put diamond ore. If there are already diamond ore blocks within a distance, or Redstone instead. When it's at least so high up, put dirt.

Every chunk is built like this, based on the seed. Since the seed stays the same, the world can be rebuilt to be exactly identical every time you load in. When you make changes to the world, the seed is changed to make sure the change you made appears the next time.

It's like, instead of someone memorizing an entire story, you just give them a title and they invent the story as you go along based on that title. When you leave, the story is forgotten but you save the title. The next time you want that story, you give them the same title and they follow the same rules and end up creating that exact same story from scratch.

4

ZylonBane t1_iyaddzc wrote

>When you make changes to the world, the seed is changed to make sure the change you made appears the next time.

Okay stop, this is complete ignorant nonsense. That's not how seeds work. You're proposing some sort of mechanism that could losslessly compress several hundred K of arbitrary data into a single number. Not only is that not how Minecraft works, it's literally impossible.

How Minecraft actually works is that a chunk is generated once when it's initially discovered, then written to disk. Any subsequent changes to that block are written to the save file.

8

dmootzler t1_iy8wknr wrote

How do player-initiated changes to the world get persisted? Is it just as some kind of diff relative to the generated world?

1

RevaniteAnime t1_iy8z652 wrote

The "chunks" that have been modified in Minecraft get saved to the storage. So, the more you start changing things in a Minecraft world the bigger the save file gets.

9

Shaddaa t1_iy8yuax wrote

Yes that's how it is usually done. Either you simply store any chunk the player made changes to and just load that again, or you only store the changes and apply them after generating the untouched state of the world.

4

[deleted] t1_iy8xwei wrote

[deleted]

−2

dmootzler t1_iy8yp7m wrote

That doesn’t sound right.

Finding the seed that yields a specific world plus a specific set of user changes would require a brute force search of all possible seeds, which is completely infeasible.

Even if you could do it, the encoding would be no more space-efficient than an optimally-compressed diff.

5

Fwahm t1_iy9tegi wrote

No, as there are many world-states that don't correspond to any seeds because not all possible states can be baseline in a seed.

It's more like keeping the title of the story the same, but you also hand them a piece of paper with instructions for them to apply modifications to the story after they finish generating it. "Change John's name to Joe", or "Megan died of influenza instead of pneumonia", for example.

3

Shaddaa t1_iy8zaqq wrote

If I got your analogy than that is not true, not every possible world has an associated seed, there are far more possible worlds than there are possible seeds.

2

[deleted] t1_iy90ag4 wrote

[deleted]

−2

Shaddaa t1_iy90w2d wrote

To me your analogy sounds like changes to the world (=story) are saved by changing the seed (=title) to a seed which generates the changed world. But there is no seed that will generate a world with my oak plank house in it. Maybe I just got your analogy wrong, I believe we both mean a similar thing.

3

dmootzler t1_iy9azry wrote

Ahh I think you misunderstood my original question. I wasn’t asking about how user-specified seeds are handled.

What I meant was, when I mine/build/craft, altering the state of the world, how is that new world state persisted (since the results of my actions would not be present in the procedurally generated chunk)?

2