how do “seeds” work in video games such as Minecraft?

1.16K viewsOtherTechnology

For example, how does an infinitely randomized world like Minecraft manage to generate me an identical world to my friend with just a handful of numbers that they send me?

In: Technology

23 Answers

Anonymous 0 Comments

True randomness doesn’t exist in computer software and games, it’s just a trick that generates numbers that appears to be random, so it’s pseudo-random.

Computers generate random stuff by getting a seed, which is any number stored inside the program or picked elsewhere (like the system time in miliseconds) and then from this number you can get the randomness efect by myltiplying it with another number, adding other number… Something already coded inside the game. That’s why its called “seeds”, because from it you can generate other random values.

In minecraft, the game uses the seed to create the world. For example, if you code an algorithm that places a nether portal inside the world like:

x = seed * 5 -23

y = seed * 25 + 7

Notice that if you use the seed “10” the portal will be generated exactly at x: 27 y: 257. Notice that the numbers seems like are random but you can always get the same if you use the same seed. If you use another number like 11 it changes the numbers completely: x: 32 y: 282. This is a small example and minecraft algorithms are much more complex.

How minecraft automatically generates the seed number? Simple, if you leave the seed blank, the game just “tells the computer” to give any pseudorandom number that uses another but similar method.

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