On Minecraft, how is it possible that during a map creation, you can just scramble letters, numbers and symbols as a seed and still have a random map as a result?

635 viewsOtherTechnology

My real question is, how is it possible on programming context?

Like, typing “dioasdjklasdknlvioj3e40435905$%” randomly on the seed input, start the map and have a still totally randomly generated world.

And by that, i actually mean how can that be possible if Minecraft wasn’t complex to program, as far as i know.

EDIT: Forgot to add, there is also a more than a sixtillion (Or even far, far more) of character combinations (Incluiding quantity of characters). All of them, if you change a single character in any place, generates you a random map. The slightlest change, and your map is completely different.

Where i am going is… how is it possible that such a small game like Minecraft could have an infinite number of randomly generated maps if it just weights a few Gigabytes (Or even Megabytes) on your PC?

In: Technology

11 Answers

Anonymous 0 Comments

It’s called “Seeded pseudo-randomness”. Broken down, computers don’t actually generate random numbers. Instead, the “random” numbers a computer generates are actually “Pseudorandom” – generated using a math formula to appear random. Games normally use some kind of variable input (time, mouse position, etc.) to make it even harder to predict; but some games give the player some control over what goes in to that input – control over the “seed”.

As a quick example: imagine I’m making a simple game where you walk through rooms, and in every room there’s either a trap, a monster, a treasure, or nothing. I could randomly generate each one – but if I’m using a computer, I might start with an 10-digit number as a seed; and starting with the first room take the seed, square the number, take the middle 10 digits for the next seed, and take the tens digit to determine the room (1-2 is trap, 3-7 is a monster, 8-9 is a treasure, 0 is nothing).

Using that idea, if I got an interesting run, I could give you the seed, and you could run through the exact sequence I did. However, if you change the number by 1, you get a VERY different experience.

Minecraft’s generation is a lot more complex than that – but the underlying idea is the same. It runs on a function that takes the coordinates of a block plus the “seed” to decide what blocks to start with – which means that if you use the same seed, you get the same world; but even small differences in your seed can mean big differences in the world.

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