No Man's Sky

No Man's Sky

View Stats:
Adarynin Feb 4, 2020 @ 2:24pm
What is procedural generation?
The answer to many NMS questions is "procedural generation", but many don't know what that means.

I really like this video where someone explains how to generate a galaxy with planets in only a few lines of code. (just skip the code if you are not intererested in those parts and just watch the examples).
https://www.youtube.com/watch?v=ZZY9YE7rZJw

He shows why his galaxy is not random, when you return to a spot, you get the same stars again. The stars are not saved on the hard drive, they are generated again, after the same formula.

(Just like, if you calculate the volume of your room, you'll get the same cubic metres the second time, even if you don't write down the first result, as long as you are using the same h*w*l formula and the same height, width, length values.)

This is how No Man's Sky 265 [256?257?] galaxies can fit into a few Gigabytes (which are mostly music files) and how everyone gets the same planet in the same place, even offline. It's not an MMO where we download premade maps.

In the end he mentions the challenge of saving changes done by players. When we build bases and manipulate the terrain in NMS, the game first generates the planet by its formula, and then adds the saved changes on top of the procedural generation. With varying success, as we know. ;-) These later changes have to be stored, and transmitted between players in the same MP session. And when you think of elements that can move (animals, ships, NPCs), even if they started out under the same conditions, they might take different paths in multiplayer...

How often have you heard questions in forums such as: My base was fine, how is it now half underground / floating 1m above the ground? Why did the terrain "regrow"? Why does my friend not see my terrain manipulation? Why do I see the same types of animals as my friends, but in different places? Why do we see the same types of starships in a system but with different stats?

-- Most of the answers become clear if you consider which parts are procedurally generated, which parts are added on top of it later, and what needs to be transmitted among players. Pretty cool. :-D
Last edited by Adarynin; Feb 4, 2020 @ 3:51pm
< >
Showing 1-12 of 12 comments
Gumsk Feb 4, 2020 @ 2:29pm 
Good post. I don't think people realize how hard it is to incorporate some of this stuff, particularly when it's added after the initial design. That said, there is some really sloppy code by HG, too.

The only change I would suggest is that there are 257 galaxies :)
Adarynin Feb 4, 2020 @ 2:32pm 
Right, or maybe it was 256 galaxies, anyway, I don't recall. :-)
Gumsk Feb 4, 2020 @ 2:35pm 
There are the standard 256 plus one odd-ball one.
Gumsk Feb 4, 2020 @ 2:40pm 
To bring it back to the main topic, did you know that at least some of the galaxy names are procedurally generated from the galaxy ID? If you force yourself into negative galaxies, you'll get a different name for each negative index, but it's all really the same place. Eventually the game will reset you to galaxy 257 (index 256), Odyalutai, but everything stays the same. I spent a lot of hours thinking I was exploring new negative galaxies before I realized it was the same!
Adarynin Feb 4, 2020 @ 3:32pm 
Originally posted by Gumsk:
at least some of the galaxy names are procedurally generated from the galaxy ID? If you force yourself into negative galaxies, you'll get a different name for each negative index, but it's all really the same place.
Interesting that probably tells us something about how it’s implemented. Maybe the naming function returns names for any input value, but the galaxy function accepts only 0-265. For negative values, do you get the same as 0, 265, or something different?
Gumsk Feb 4, 2020 @ 3:36pm 
Basically, you get 0 to 255 and anything outside that range sends you to Odyalutai, which has the label 256, but obviously isn't in that normal range. You can't get there normally, so residents will fade over time, I'm sure. I tested in the negatives all way down to -999 or -9999, I don't remember (with gaps, of course), and everything got a name, so it was definitely procedural.
Adarynin Feb 4, 2020 @ 3:47pm 
Originally posted by MXK:
Would it be possible for them to implement some sort of cloud saving for ALL users so the changes could be saved for ALL FOREVER??? Wouldn't that be something finding planets with abandoned installations and not just new worlds.
Technically yeah... E.g. games like Second Life are 99% user-added content, and they manage to store it and transmit the new buildings to each visitor.
But consider that this high-fidelity MMO base sharing like in Second Life is a monthly paid service, they have hundreds of employees and a support department. — Whereas the Indie-game-level base building we get in NMS is included in the one-time game price.
Galactic Starman Feb 4, 2020 @ 4:04pm 
Originally posted by MXK:
Would it be possible for them to implement some sort of cloud saving for ALL users so the changes could be saved for ALL FOREVER??? Wouldn't that be something finding planets with abandoned installations and not just new worlds.

As far as I understand, are not our bases saved forever? I know we can only share one base per a planet but if we upload another base on the same planet the previous base still exists for the owner - at least on their local PC. That base could presumably be uploaded and seen by another player if uploaded again. Until then it would at least exist for an invited group play and all bases remain on the player's local PC and I think visible to the base(s) owner's group?, but only the current uploaded base would be visible to random players outside the group.

I visit old addresses from when I first played the game and have found several abandoned bases. Now without power. They're quite atmospheric if not a bit forlorn to wander about in.
Last edited by Galactic Starman; Feb 4, 2020 @ 4:06pm
All of the above went right over my head .
ZombieHunter Feb 4, 2020 @ 6:03pm 
Procedural generation means mostly the same, slightly different. Cannot compete with hand-crafted worlds.
Scrublord Feb 4, 2020 @ 9:43pm 
Originally posted by ZombieHunter:
Procedural generation means mostly the same, slightly different. Cannot compete with hand-crafted worlds.
Not 100% true. Many games that implement procedural generation usually pair it up with hand-crafted elements, and different biomes could follow different rules for the generation that separate them from the other biomes like in Terraria. Some of those hand-crafted worlds even use procedural generation to start the map and then add the fine touches after it's generated to give it a hand crafted look. If programmers put procedural generation in their games without any restrictions on what's implemented, you would get something that looks like the outer lands in Minecraft, with everything being pure chaos.
Adarynin Feb 5, 2020 @ 12:33am 
Originally posted by ZombieHunter:
Procedural generation means mostly the same, slightly different. Cannot compete with hand-crafted worlds.
It’s not supposed to compete with hand-crafted worlds, they’re two different game types. In handcrafted games, the player expects the game to tell them a hundred stories. While procgen is a backdrop in which the player expects to make up their own stories.

Also, the human brain is exceptionally good at recognising patterns, and creating procgen that provides stimulation to brains that were exposed to the variety of planet Earth is a known challenge. :D

I don’t think anybody would claim that procgen is “better” or will replace handcrafted games. Maybe hybrids are the future?
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Feb 4, 2020 @ 2:24pm
Posts: 12