No Man’s Sky might not be everyone’s cup of tea but its code is pretty impressive. Blogger gregkwaste outlined exactly how the space exploration game creates its procedurally generated creatures and more.
In a post at 3dgamedevblog.com, Greg provides an exhaustive breakdown of the process behind No Man’s Sky‘s various monsters and spaceships. Here’s how a potential creature’s model looks before it is generated:
The animal is a horrific mess of potential body parts and contradicting geometries. However, each geometrical object has a name that points to a descriptor. These classify each regions such as a creature’s head or other body parts. These descriptors can then be mashed together and assembled through code to make a new animal. Essentially taking bits and pieces from descriptor pools until they create a valid critter.
Greg assembled creatures that all come from the model you see above, the result are a variety of aliens that share commonalities but still end up being relatively unique:
All of the above creatures started from the same base model. What determines the chance of a body part being used is a bit unclear. Greg posits they are either decided by the game’s engine when running or contained elsewhere in the code. However, each piece seems to have a relatively equal chance of selection. This applies for spaceship models as well. Ship designs are procedurally generated in a manner similar to animals. Greg’s post also covers texture generation and animations. I highly recommend reading it in full.
This doesn’t mean there’s infinite possibilities for the game Last month, an intrepid player decided to see what would happen if you entered into a 256th new galaxy. It turns out that after you moved beyond this number of galaxies, they start to repeat. You can see specifics in Ryan Zea‘s video below:
Whatever your thoughts about No Man’s Sky, I think the raw breadth of the code is impressive. If anything else, it’s given us no end of penis monsters. And for that, I am eternally grateful.