Sponsored By

What the code of No Man's Sky says about procedural generation

A programmer dissected the code of No Man's Sky to find out exactly how it procedurally generates planets full of unique content.

Alissa McAloon, Publisher

October 17, 2016

2 Min Read
Game Developer logo in a gray background | Game Developer

Greg of 3D Game Dev Blog took a few weeks to dig into the code of No Man’s Sky to try and figure out how the game engine created by Hello Games creates each element of an entirely procedurally generated game world. 

This blog post is definitely worth checking out if you’re a dev at all interested in the code that went into procedurally generating nearly every bit of content on a multi-planetary scale. 

The post splits its findings into three main categories: geometry, textures, and animation. The section on geometry is by far the most in-depth and talks mostly about how the game creates creatures, ships, and other models by combining multiple parts from assets with a predetermined chance value. 

A similar approach is used to procedurally generate the textures and color pallettes used for creatures and planets within the game. 

An example of randomly generated creatures using <i>No Man's Sky</i> assets in an external viewer.

“...except [for] designing different model parts, [the game artists] have also provided multiple different textures for each part. So traversing that file in the same fashion with the descriptor file, one can calculate the final diffuse texture of the procedural generated model,” he explains. “And here is the even better part. Even if two models are identical geometrywise, they can end up having completely different colors, marks, shapes, etc using those procedurally generated textures.”

The piece-by-piece way No Man's Sky generates all its content leaves the door open for Hello Games or modders to add additional model parts post-release and exponentially increase the procedurally generated possibilities. While this might not say much about the current state of the game, Greg explains that this way of content generation speaks volumes about the game engine itself.

"The mindblowing thing about this generation procedure is that if they had double the number of [artists] working exclusively on [models], the game content (just for the creatures) would be hundreds of times larger," he says. "And this fact alone shows me the capabilities and the potential that NMS game engine has."

The full post, which includes models rendered in a viewer and a more in-depth explanation of the code behind No Man’s Sky, can be found over on the 3D Game Dev Blog.

About the Author

Alissa McAloon

Publisher, GameDeveloper.com

As the Publisher of Game Developer, Alissa McAloon brings a decade of experience in the video game industry and media. When not working in the world of B2B game journalism, Alissa enjoys spending her time in the worlds of immersive sandbox games or dabbling in the occasional TTRPG.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like