Creating a terrain (the ground of your game) can be a very complex problem. How do you create a hill that looks natural? Tree and shrub growth that mimic real life? These are problems that Environment Artists in game development have to face and they tend to accomplish this extremely well. But how do you create a terrain for your game that’s infinitely expanding? Games such as No Man’s Sky has you flying around quite literally the infinite expanse of space, generating entire planets for you to be the first to discover.
Let’s start off with a game more familiar that has accomplished a similar feat. Minecraft, at its core is a game that generates entirely unique worlds every time you start a new game. There is a method Minecraft uses to generate a near infinite number of worlds and terrain. This means that they don’t have a person design each one specifically. This method is what’s called “Procedural Generation”. Not only does this method generate a unique world from nothing, but as the player continues to explore the world the computer can take the now existing terrain and build upon it the further the player explores.
(pictures showing how random a terrain Minecraft can generate)
However, there are a number of limitations to this method. The first is that since it’s entirely random, the terrain could very easily look unnatural or block key paths in our game. This is where game designers have to again control how much randomness a game can use. The second limitation is processing power. Depending on the level of detail in your game, the computer has to calculate and generate entirely unique structures - that can put a strain on your computer and sometimes slow the game down.
There are solutions to these limitations that many have tested and perfected over the years that game development has existed. To generate terrains from nothing, programmers tend to control the amount of randomness. They use randomness in conjunction with algorithms to construct semi-lifelike terrains for their games. One of these methods is the “diamond square” method that begins constructing the terrain by its corners and slowly working its way into the centre. Another method is to take an image of “noise” (a black and white, static like image) and create a terrain from this; darker parts of the image generate the low ground, where the lighter parts of the image generate high ground. If there are any sharp bumps in the terrain, simply blend them together to make it more natural.
There are also solutions when it comes to the processing power required to generate these terrains. A common method that Minecraft uses is to break the world up into “chunks”. These chunks are sections of terrain that get generated piece by piece. This allows the computer to only worry about the immediate surroundings of the player - saving on processing power. If the player decides to explore in a direction, simply generate more chunks in that direction that attach to the already existing terrain.
(.gif showing Minecraft loading chunks of a terrain)
Randomness is an exceptional tool that allows us to create entirely unique worlds. However, as its name suggests, randomness can create both exceptional worlds and worlds that aren't fun to play. This is where a strong understanding as a game designer is needed to control just how random you want your world to be.