58

Reading about No Mans Sky, and hearing about the 18,446,744,073,709,551,616 planets there are, I'm curious, where did that number come from? Does that mean there are 18,446,744,073,709,551,616 unique planets, and if1 they're all found, the next planet would be a repeat? Or does it mean they've places some kind of "hard limit" in the code for that number? Or something else completely?

My current guess, is they can calculate that their world generation algorithm has 18,446,744,073,709,551,616 unique output values, and any new planets after that would be repeats.

1 I know that this will never happen

Update: I've reached out to Hello Games, and if they reply (I imagine they're still a little busy at the moment!) I'll update this post with what they say.

  • 4
    Fun fact! This number is so large that every player on Earth would need to reach a cumulative ~ 607,000,000 (Six hundred million) planets in order to have just a 1% probability of any repeated planets. Not entirely unreasonable if the game is wildly successful for a long long time, but very very unlikely. – Brian C Aug 9 '16 at 18:26
  • I don't think they're using that number as a seed but merely as an ID number, though I could be mistaken. – WeRelic Aug 9 '16 at 18:45
  • 89
    Well son, when two integers love each other very much... – corsiKa Aug 9 '16 at 23:05
  • 2
    Actually it has 18,446,744,073,709,551,616 unique input values. – OrangeDog Aug 10 '16 at 11:08
  • @corsiKa: Oh, is that when they start multiplying? – Mehrdad Aug 12 '16 at 3:08
96

18,446,744,073,709,551,616 is 2^64. I assume that this means the planet generation algorithm is based on a random seed that is a 64-bit number (e.g. the long type in many programming language). I don't know how (or even if; how would anyone check?) they guarantee that all possible inputs are used and that none are repeated.

EDIT: While it's still true that this number is 2^64 (and it still appears in some statements in the lore, so could be said to be the number of planets that exist in-universe), there are not this many planets in the game. Since the Atlas Rises update, there are 256 (257? It's not entirely clear) galaxies, and each planet has a 12-digit hex coordinate that identifies it within the galaxy. This coordinate is divided into parts:

  • 3 digits ea. X and Z coordinates of region (a region is a cube-shaped volume of space)
  • 2 digits Y coordinate of region
  • 3 digits system within region (known regions have 533 to 553 systems, so not all values are used)
  • 1 digit planet within system (0 is not used, largest known system is 6 planets and 2 moons)

So, putting that all together, there are about 600 trillion systems. If eight bodies per system is typical (in practice this is a high estimate), that's about 5 quadrillion, still far from the 18 quintillion being discussed here.

In practice it doesn't matter, because if a new system were discovered every second, it would take 74,000 years to reach all of the systems in one galaxy.

  • 1
    I heard that the "seed" is whatever (your|your ships|the planets) current position is, so I guess there will be a rough game.getPlayer().getCoords().toLong() thing for getting the seed. Maybe this a question for maths.se whether or not it;s possible to prove how many outcomes a function would have. – TMH Aug 9 '16 at 16:03
  • 24
    wouldn't they just use one seed for generation? I don't get why they would need to regenerate the seeds, which would in turn regenerate the universe. – edthethird Aug 9 '16 at 18:51
  • 8
    @edthethird this is because they will be using a pseudo random number generator, which will actually be a deterministic algorithm for creating numbers starting from an initial condition (the seed.) Therefore, the same seed input will result in the same set of numbers from a pseudo random number generator in which to generate the same planet. See en.wikipedia.org/wiki/Pseudorandom_number_generator for more details. – Nick Meldrum Aug 9 '16 at 22:09
  • 2
    @edthethird I think people are saying that the universe generator is separate to the planet generator, and that they have their own seeds. – OrangeDog Aug 10 '16 at 11:07
  • still, the generation of a planet would only happen once- so sure they can use every seed in existence for every planet, however they would still only use them once. cool makes sense – edthethird Aug 10 '16 at 15:00
66

I'm curious, where did that number come from?

18,446,744,073,709,551,616 is 2^64. In programming terms, 18,446,744,073,709,551,615 tends to be the upper limit of an unsigned long long, but this depends on the implementation. 18,446,744,073,709,551,616 will be all of the possible numbers for an unsigned long long, including 0 (i.e. 18,446,744,073,709,551,615 + 1).

Essentially, it is very likely brought about by the limits of a data type. In this game it appears the data type is the planet seed.

A seed is a variable for generating (pseudo) random data in an algorithm. Assuming the algorithm remains unchanged, the same seed will generate the same data.

Therefore, using the same planet seed will give you the same planet. If you have played Minecraft, you will probably understand the general concept of re-using seeds to get the same map.

2^64 for a seed appears to be chosen to give the illusion of infinite worlds. Technically, there can only be 18,446,744,073,709,551,616 worlds via this seed. Functionality, it would take 584 million years if you could visit a new world every 1 second, or to quote from the same article:

It would take about 7.3 billion persons, all working from birth until death, visiting a planet every second of their lives in this game, to see 18.4 quintillion worlds combined. The current population of Earth is 8 billion people. So, yeah, No Man's Sky has an infinite universe, to any reasonable person, anyway.


Does that mean there are 18,446,744,073,709,551,616 unique planets

No, there is no guarantee that 2 unique seeds will give 2 unique planets. For example, seed 1 and 90,000 may generate the same planet. This will all depend on the algorithm itself.

In order for the algorithm to generate a unique planet for all seeds:

  1. There are 18,446,744,073,709,551,616 or more unique combinations of planet properties
  2. The algorithm maps seeds to each of these unique states once only

Without any analysis on the algorithm involved we can only speculate if this occurs.

All I could find out about the algorithm is that it has 14,000 lines and was written in a way to create navigable worlds. Making them navigable suggests there is some simplification applied to prevent complex structures. Common sense would suggest that this limits the uniqueness of planets.

Functionally, it would seem likely that each planet you visit will be unique. Technically, well like I said above, it will depend on the algorithm.


My current guess, is they can calculate that their world generation algorithm has 18,446,744,073,709,551,616 unique output values, and any new planets after that would be repeats.

The algorithm would only allow a seed from 0 to 18,446,744,073,709,551,615, inclusive. If you could somehow add a value greater than 18,446,744,073,709,551,615 I would assume that you would either see a crash, error or an overflow to a valid number. For example, 18,446,744,073,709,551,616 may just overflow to 0.

Essentially, I am almost certain that 18,446,744,073,709,551,616 is the maximum seed, regardless of any tricks to force a higher seed value.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Robotnik Aug 12 '16 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.