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?

710 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

The map is randomly generated. The seed is just an input to the random number generator. That’s not complicated at all, it’s trivial. Literally one or two lines of code.

Are you imagining that it somehow processes the text and makes a special world that represents something about that text? It doesn’t do that.

Anonymous 0 Comments

Computers can’t really generate random numbers. The way it works is that you give a random number generator a seed number it spits out random numbers based on that seed. The seed is usually a number, but in a computer, everything is a number, and if you have a bit of text, there are a few ways to turn that into a number.

Edit: in response to your edit, the way seed values work, if you give a random number generator the same seed, it spits out the same numbers. So you don’t need to store the worlds. If the instructions for constructing a world randomly are the same and you give it the same starting seed value, it will always produce the same world. 

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.

Anonymous 0 Comments

When computers do something “randomly,” it’s not usually actually random. Computers are designed to do the exact same thing every time you give them the same instructions, which means that, in principle, every time you tell them to make a choice, it will always choose the same thing. It’s possible to use special hardware to use physical processes to get “true” randomness, which is useful for things like gambling or high-stakes cryptography, but for everyday things like video games you usually use what’s called a pseudorandom number generator (PRNG)

a PRNG is a process that you use by putting one number in, and getting another number out (by some convoluted math going on behind the scenes). Typically, the next time you use the PRNG, you won’t give a new seed number, you’ll just use the last number it made to get another number, and then use that to get another, and so on. Computers always do the same thing every time, of course, so the same input number always gives the same sequence of outputs, but a well-designed PRNG makes it very hard to see the connection between the input and output numbers. If you set the initial input number unpredictably, for instance by using the current time, you get behavior that looks random to all but the most careful analyses.

An upside to this is that if you want processes that are both varied and repeatable, you can just set the seed to specific values. For instance, if you’re making a video game, you can just write a level generator that uses a PRNG to create a variety of different worlds, and then you let the user control the seed. I don’t know the details of minecraft’s world generation algorithm, but at least in principle seeds work “for free”: if you’re generating random maps, you’re going to be using a PRNG in some form or another anyway, so you might as well give the user control of the seed the PRNG uses rather than leaving it completely up to the time or whatever other seed value you’d use.

Anonymous 0 Comments

The numbers are just indicator where to start the randomness. The seed would be followed by random numbers as long as you explore the world. Since computers generally doesn’t generate true randomness, using the same seed would lead to the same world.

Take this as an example, imagine a seed of 123, and the seed acts as a height for the blocks you are standing on. so for the first block it would be 1 block high, the second one would be 2 blocks high and so on. This simple mechanics makes world generation possible.

So how about seeds such as 309 that has a significant amount of difference to them?.. Your world will be in chaos as the different height of blocks wander around your world. In order solve that, they uses a technique which involves Perlin Noise. Perlin Noise creates a smooth gradient between these blocks and make sure that your world is smooth in world generation. Each part of the world uses different Noise like for the Cave Generation and Biomes.

The beauty of minecraft is on how they uses basic programming techniques such as Perlin Noise in order for them to create an amazing game

Anonymous 0 Comments

When you generate a random number, it’s not actually random. A computer algorithm does a lot of complex math to make a number that looks random. If we give the random number generator a number to start with (called a seed) it gives us the same sequence of numbers as an output every single time.

This is why every every minecraft world with the same seed generates the same, it all starts from that seed.

It does a couple of things to make the map. It makes a random block of data that it fills with random numbers, and then it smooths those number out so there’s a slow transition between them. This is called a temperature map. This is how it puts biomes where they are. A certain range of numbers is an ocean, another is a forest, etc. The numbers between land and ocean biomes usually correspond to beaches

It then makes another one of these that it uses for elevation. High numbers on that one become hills, low numbers become valleys.

Then a block of random numbers with no smoothing, called a noise map, tells it where to out trees, cactuses, tall grass, flowers. It all depends on which biome it lands in and which number is on the noise map.

It does the same for ore distribution, but that is a 3D process, since it needs to account for height.

Caves and structures follow a different process, but it’s all the same idea, the seed is an instruction manual for which random numbers to generate, and there’s a whole bunch of code saying what random number does what.

Anonymous 0 Comments

The text you input is getting converted into a number using a technique known as hashing. This number is then used to start a sequence of random-looking numbers. There are techniques that will ensure that you always get the same number sequence from a given start. That’s what “seed” means. 

Games then use this number sequence to build the world, using mathematical procedures that create “organized chaos”. This way you can have a lot of variation, but it always looks structured. 

The number of maps Minecraft can generate is not infinite, it depends on how its number generation machinery works. At the same time it is probably large enough to be considered almost infinite. 

I think the final bit of the puzzle is that small changes to the seed string will result in very different number sequences. That is by design – these random number and hashing techniques are designed to maximize difference between similar inputs. After all, you want the result to be unpredictable. 

Anonymous 0 Comments

I think you are confused by the word *infinite* actually.

It’s infinite or it’s not.

Since the world size does actually have a limit, it’s not.

Anonymous 0 Comments

Should there be a lake here? (Dice roll) I guess not. How about a hill? (Dice roll). Hill it is. How high? (Dice roll). Should there be trees? (Dice roll). And so on until it’s a full map. Of course I’m oversimplifying, the actual thing will be much more clever, but that’s general idea.

That string of characters (the seed) represents an infinite sequence of dice roll results. It doesn’t directly encode them, but rather it’s a parameter to an algorithm that forever spits out numbers that are indistinguishable from true randoms. Same seed, same sequence of randoms, slightly different seed, completely different sequence.

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.