A lot of games nowadays rely on procedural generation. Be it landscapes, whole levels, items, sounds and more. But why is procedural generation in video games so popular and how exactly does it work? A lot of technical know-how is needed to make your own procedural levels. But there are many methods & tools to help you achieve your goal. We’re going to help you find your way through the chaos and how you can come up with your own algorithm for your game.
Procedural Generation & Its Benefits
The Procedural generation (PCG), also called proc-gen, is a technique used in video games. It creates certain content is by using various algorithms instead of them being handcrafted by designers and programmers. It automatically builds parts of the game world and its elements. This way you don’t have to place all the assets one by one.
Tailor It To Your Own Needs
There is no such thing as the perfect proc-gen you can simply use to copy and paste into your game. As with most things in coding you have to come up with solutions on your own. Start simple and see if it works you can still make it more and more complex as time goes on. Minecraft started off with almost nothing and over the years became a powerhouse when it came to generating whole worlds.
Automatic Content Creation
The PCGs ability to automatically generate content is one of its biggest perks. It saves you the tedious work of populating an empty world by filling it up with assets on its own. The content can sometimes feel repetitive and unpolished compared to a handcrafted environment. But proc-gens are a great way to fill the gaps in between. It is also a create tool if you suffer from art blocks. With a PCG you can already start filling the canvas with something and use it as a base.
Variety & Replayability
Proc-gens are a necessity if you want to create seemingly endless words or randomly generated dungeons. Every time a new game is loaded, it is different from the one you used prior. So every time you restart, it will be different every time you play. Some games even allow people to copy & save their seeds and to share them with other people as well. This creates a huge replayability factor and allows players hours of fun without getting bored by the same recurring things.
Efficiency & Scale
Proc-gens can be used for better data compression, reusing data to save resources, and for greater scalability. PCGs are usually less memory-intensive than other game elements. The assets get generated on the fly rather than being stored somewhere in the system. While it saves memory space, proc-gens demands more from the CPU since it computes everything instead of recalling it. As always it is crucial for developers to maintain the balance and to ensure everything runs smoothly.
The Challenges Of Working With Proc-Gen
Using PCGs can sometimes be like a double-edged sword. While it can save you a lot of time, it also needs a lot of work beforehand. It isn’t very efficient to write a proc-gen for every single little thing in your game. Sometimes it’s faster and easier to do it the old-fashioned way while also saving you some CPU.
Complexity Of Proc-Gens
The lines needed for a proc-gen can be as simple as ‘if there is a water body larger than 50 tiles of water, generate a 3-tile pier’ to a whole network of sets and rules that can easily fill a whole book on its own with its complex algorithms. This is why you should break it down as simply as possible to see if you can make it work. The longer a piece of code is, the more bugs and mistakes can make their way in. Of course, it is also easier to create an algorithm for a 2D game rather than a 3D game but the rules apply to both of them.
Creative Problem Solving
Just because something doesn’t work as intended, doesn’t mean that the problem has to be your proc-gen. Let’s say you wanted to create a randomly generated set of puzzles where the player’s goal is to move around stuff in order to process through the level but sometimes… they simply get stuck because they trapped themselves and now there is no way out.
Now of course you can try and tinker around with the algorithm until you get rid of the problem but why not make it a feature? Why not let them turn back time or let them teleport to the beginning of the room so they can redo the puzzle? Just because something doesn’t work as intended, doesn’t mean it is bad overall! It’s just a matter of perspective.
Ensuring Quality
One of the biggest problems is quality control. Since the world is randomly generated, it is impossible for developers to make sure every single world works and runs smoothly. They can go and optimize the algorithms but it’s way more difficult than to manually adjust the space.
Balancing Gameplay
Balancing the gameplay is always a problem in the industry, no matter if you use proc-gens or other methods. Keeping the gameplay both fair and challenging at the same time has to be one of the highest priorities. Players easily forgive floating trees or holes they can fall into, they often even make for hilarious situations… BUT! They won’t forgive you if the game becomes unfair and keeps them from moving forward.
Game Breaking Bugs
Just like we mentioned in the quality control sections, it is hard to predict a randomly generated world. Sometimes it happens that things collide in the worst way possible, causing the game to break so it becomes unplayable. The more complicated your proc-gen is, the higher the possibility. Which is why you should be careful while writing the code and avoid using unnecessary complicated algyrithms.
Procedural generation can be used for many different parts of game development to either speed up your process or save yourself some resources. It is important to know how and why you want to use and implement procedural generation in your game. Sometimes it might be better to stick to man-made resources than computer or AI-generated ones but it all depends on what your ultimate goals are.
World Generation
World generation is one of the most known PGC techniques out there. With the help of algorithms you can create endless and ever-changing environments that offer the players a lot of exploration opportunities and more importantly: replay value. Games like Minecraft and No Man’s Sky are prime examples of how you can utilize this power to generate infinite worlds that keep people entertained for years.
Level Generation
Very similar to the world generation, levels can be made in the same manner. Rogue-like games like Hades, Spelunky or The Binding of Isaac have used this PGC to generate endless mazes for the player to explore anew every time they start a run. This makes the whole experience less repetitive and more challenging since players never know what exactly they have to expect from the next level.
Character & Creature Generation
A lot of games like Sims, Spore or Starbound have also utilized PGC for the characters that are randomly populating their world. Depending on the type of game you’re creating and the importance of NPCs the amount of computer-created characters & creatures varies a lot. Besides, having to design and create every single being in a world takes way too much time, especially if the generated characters can’t be interacted with.
Item Generation
Another very prominent use of PCG techniques can be found in loot generation. Games like Path of Exiles or other loot-heavy games need some sort of algorithm to be able to generate random items that match the level of the player and the type of monster they have killed. They vary in rarity, stats, quality and quantity. It would be impossible to assign everything per hand without the help of some sort of procedural generation
Story Generation
Now of course fast games with sheer endless possibilities also somehow need an endless story to keep you entertained and of course PCG can also be used to generate quests, story branches and more for your world. Of course like with all technology this can be rather limiting but with the constant evolution of AI it’s getting better and better every day.
Of course there are many more possible uses for PCGs like animation, music and other details but these are the most prominent and important ones.
Procedural generations in their variety are undoubtedly a huge part of game development and will only grow bigger in the future and mixing procedurally created content with handcrafted and mindfully designed assets will definitely put your game onto the next level. While it may seem daunting at first, proc-gens will aid you and your team a lot by saving you tons of time & energy that you can use in other parts of the production.
If you’re curious about how to generate procedural levels for your game you might also be interested in how to create the perfect platformer:
Leave a Reply