Minecraft – make a seed for minecraft that makes a world I want

minecraft-java-edition

If I wanted a world that has a lot of something and a little of something els, for example:
I would like to have: snow biome 20%, planes 10%, forest 30%, desert 10%, ocean 30%,
Is there a way to create a seed that does the percents that I wrote up there? If yes what is the way of making that seed?

Best Answer

Short Answer

As already stated, you cannot craft a seed that would generate a world with specific properties.
(See bottom for alternative options.)


I’ve seen this question numerous times in various places, so I’ll explain exactly why it is not possible.

Technical Explanation

Procedural Generation for variety

Minecraft uses what is called procedural generation to create the world. That is, instead of the developers using map-makers/level-editors to create the maps (and their contents) for the game, the game creates it all on the spot using algorithms. (Technically, any/all parts of a game could be procedurally generated, like with Farbrausch’s proof-of-concept demo-game .kkrieger, which packs an HD FPS that rivals contemporary games that weight in at dozens of gigabytes into just 97,280 bytes!)

To create a game with variety instead of the same thing copy-pasted everywhere (which would quickly make the game look very patterned and repetitive), the algorithms use random numbers to vary things like terrain, characters, and items.

Not-so Random Numbers

Computers are incapable of creating true random numbers (it could be argued that we are as well), so they use various means of creating pseudo-random numbers with a pseudo–random-number generator (PRNG). The methods vary, but essentially boil down to taking a number, passing it through some sort of complex mathematical formula to create a large number, then reducing that large number to a smaller one and using that as the next number in the sequence. That number is also passed back through the same process to create the next number and so on. Obviously there is nothing random about that since each number is directly related to and derivable from the previous one, but there is no obvious connection between them (as in 1, 2, 3…; 1, 4, 9…; 3, 5, 8, 13…; etc.) This makes them random enough for most purposes.

Seeds

Now comes the key part. Because the process is feeding a number through a formula and repeating, to get the first number, you must first give the PRNG something to begin with. This is called the seed.

Entropy

One option is to use some source of entropy to get a number. This would result in as random a number as is technically possible. For example, you could use the current time (which presumably will be unique at any given moment since time is a one-way street). You could also use the current temperature of the CPU which may not be unique, but is not likely to be at any predictable value at any given moment due to the various factors that go into setting it. Also user input like mouse-movements and key-presses (sampled over a period of time) tend to be fairly unpredictable. These are examples of entropy sources which can provide the PRNG with an unpredictable seed which can thus lead to new and unique content being generated at each run. This is what Minecraft does if you leave the seed blank.

(Creating random content ostensibly means that it can provide an essentially infinite amount of ever-new gameplay—though in practice, it doesn’t quite work like that; there are limits to what is practical/playable, and the novelty invariable wears off at some point.)

Random-ish

Another option is to use a fixed seed. If you provide the PRNG with the same starting number, then every time you do a run, you will end up with the same sequence of numbers being output. The numbers will still seem random in that they don’t appear to be connected to each other, but the set of numbers are the same as the last time you used that seed, and the same as the next time. This is what happens when you input the seed to the world-generator.

(You might wonder what the point of using a fixed seed is. After all, if the PRNG is already generating numbers that aren’t truly random, then why make it even less random? For one thing, it makes it possible to create reproducible random content. This allows for people to share seeds so that they can share things like Minecraft worlds that they like without having to send all of the files. Instead of transferring a bunch of large files, they can just post the seed which is only a few bytes, and the other person recreates the same world.

Another use is in game-development. When testing software, reproducibility is key. Using random numbers can help emulate player input, but being able to emulate a player pressing buttons and keys and such in exactly the same way each time makes it much easier for testers and debuggers because they can reproduce the sequence of input that lead to the error.)

Example

Here’s what I remember of the example I saw when I first learned about RNGs about 3.7 million years ago (this specific formula is just an example; it actually has some flaws that make it impractical, for example a seed of 0 or 1 would be useless). Imagine a process as so:

  1. Take 8-digit input number
  2. Square it
  3. Cut out middle 4 digits
  4. Return that
  5. Goto 1

Using a seed like 12345678 would result in the following:

  1. ←12345678
  2. 123456782
  3. =152415765279684
  4. 0152 41576527 9684
  5. →41576527

  6. ←41576527
  7. 415765272
  8. =1728607597381729
  9. 1728 60759738 1729
  10. →60759738

  11. ←60759738
  12. 607597382
  13. =3691745761828644
  14. 3691 74576182 8644
  15. →74576182

This gives the sequence (12345678), 41576527, 60759738, 74576182, 60692169, 53937792, 28540583, 56487797, 87120991, … As you can see, the numbers don’t seem to have much pattern, which makes them good for things that should not be a pattern (though with a little math, you can massage them into a mild pattern such as random clusters of trees or monsters; random but not absurdly scattered).

Usage

As you can also see from the example, it is extremely difficult, if not completely impossible to control what the output at any given step will be. This is even worse if you cannot control which number from the sequence is used for what purpose.

For example, imagine if the Minecraft world-generator used the following (commented) pseudo-code:

//Initialize the RNG with world-seed
//Each call to RNG() will return a number and also use it to seed the next call
initializeRNG(world-seed);

foreach chunk {
  //Get first two outputs and use them to calculate spawn point coordinates
  n1=RNG(); n2=RNG();
  n3=n1×n2;
  posX=calcX(n3); posY=calcY(n3);posZ=calcZ(n3);`

  //Determine biome
  biome=calcBiome(RNG());

  //Calculate shape of mountains/valleys using a NURB
  contour=calcNURB(RNG(), RNG(), RNG());

  //Calculate trees
  trees=calcTrees(RNG())

  //Drop next two outputs (for some reason, maybe a technical one or something)
  RNG(); RNG();

  //Calc # of lakes
  nLakes = 5 × (1 / RNG());

  //Calculate dimensions of each lake
  foreach Lake i, in nLakes {
    Lakes[i].Size =foo(PRNG());
    Lakes[i].Depth=bar(PRNG());
    Lakes[i].Shape=baz(PRNG());
  }
}

It is difficult enough to control what the output is at any given point the sequence, but to control it at just the right moment when it is used for the appropriate variable is out of the question. This is especially true if the RNG usage can vary like with the lake calculate above where the RNG is used to calculate how many lakes there are, and then a few times for each one. That means that the number that the RNG gives for the second biome will depend on how many lakes were created for the one before it. The one for the third biome will depend on the first two, and so on, making the index of the number in RNG sequence which is used for the biome variable effectively random. And this example was extremely simplified.

Application

Even if you knew the exact formula that the world-generator uses for its PRNG, and even if you knew exactly how, when, and where the world-generator uses the PRNG’s outputs in the code, being able to control its output is nigh on impossible. There is no way to formulate a number that when passed through an equation over and over again (millions of times) will give the exact numbers, at the exact right moments, that would cause the world-generator to create exactly what you want.

At best, with a lot of luck, you may be able to influence one or two outputs, but to manipulate multiple outputs would be impossible since the RNG formula is unlikely to produce consistent results (which is the whole point).

(Also, be aware that the world-generation formula has actually changed several times throughout the various versions, and that mods can affect it as well, so the same seed may generate vastly different worlds depending on the version of Minecraft, the installed mods, and the versions of those mods.)

Alternatives

There are a few options you have (none of which are prefect):

  • Use a preset (best option for ease of use), try a preset-generator like the one that ardaozkal linked to.
  • Use a 3rd-party world generator (the vanilla one is slowly catching up). There are some mods which use custom generators which allow for more customization, but they are usually still limited (e.g., I have not seen one that allows you to select the spawning biome).
  • Use a world-editor to manually create your world (or at least modify an existing one). This option is a real pain and requires a lot of work, but gives the most accurate results. Some editors include functions that reduce the amount of work such as generators that give you a starting point to work with, schematics that allow you to import features like structures or lakes, and “paint” functions that allow you to create large swaths of terrain easily.
  • Use a custom map. A lot of people have shared custom maps that they have created. With a little luck, you may be able to find one that is similar to what you want. Then you can use it as is, or modify it to your liking, or extend it with new, generated chunks.
  • Commission a custom map. As a last resort, you could have someone specifically make a map to your liking, although getting one for free would be difficult.