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?

565 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

Minecraft worlds aren’t randomly generated, they’re *procedurally* generated.

That seed number (which is psuedo-randomly chosen if you don’t input one) is used as a starting value for a bunch of different mathematical operations.

How can it be really complex without having been really difficult to code? A lot of the mathematical functions that govern how Minecraft takes the seed and turns it into a world were programmed by other people, and then used by Minecraft’s coders. There are all sorts of code libraries that get reused when creating new games and other applications.

So, how does a number get turned into a world? Well, I don’t know the exact method Minecraft uses, but imagine a simplified version where you take a deck of cards and use it to create a map grid. Take two factory fresh decks, all the cards in the same order. If you lay them out in a grid the same way, you’ll end up with two identical “maps”. Shuffle one deck, then lay the grid out again, and you’ll get a random map. Copy the shuffled order to the second map, and follow the procedure of laying out the cards, and you’ll get the same “random” map.

The card order is analogous to the seed number. Input the number, put it through a mathematical procedure, and it turns out a consistent result. Laying cards out in a grid is a simple mathematical procedure, but you could also do more complicated procedures. To continue the card map analogy, say that every four cards you not only put down the card, but also put a poker chip on the card, of a value determined by the surrounding cards, and then used the resulting poker chip values to put down pretzels at corresponding places in the grid, and then added up the value of each row of cards and… You could make the procedure as complicated as you want, but as long as you follow the procedure it will result in the same map for any given seed, while still having a huge number of possible maps because of how many different orders the cards can start in.

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