Sponsored By

Avoiding PCG Pitfalls

PCG is a powerful technique that can help projects achieve great things. However, there are certain pitfalls that can end up costing you time instead. This article talks about some of those pitfalls and certain steps you can take to avoid them.

Rik van Peer, Blogger

January 24, 2018

8 Min Read

Avoiding PCG Pitfalls

It’s not a new technique by any means, but it’s hard to deny it’s been gaining a lot of traction and popularity in the recent years. Procedural content is a hot topic, and many developers are eager to include it in their projects. However, there are some pitfalls to take into account. Without the right understanding of what procedural content can do for you, it might end up making your project worse, or slow down development. The purpose of this article is to provide some ideas and techniques that should be helpful in finding the right approach to including procedural content in your project.

Chances are when you think of proceduralism, you think of projects like Minecraft or No Man’s Sky. Endless worlds and universes. You probably wouldn’t think of a field of grass swaying in the wind. Yet, that grass was neither hand-animated nor simulated but uses procedural animation. There are many different applications of PCG (procedural content generation) in game projects. Some games explore procedural narratives or gameplay elements. For the purposes of this article, however, I’ll be focusing on procedural art assets, but some of the high-level concepts should apply to other methods of PCG as well.

 

What PCG can do for you

There are a few things that PCG can do for your project. What most people are interested in is straightforward: it saves production time. No need to let your designers waste hours upon hours placing trees or gameplay objects when an algorithm can do it for you. Don’t let an artist waste their day sculpting details into a mountain when a script can apply noise and corrosion with the click of a button.

It can also be the backbone of your game. The entirety of the roguelike genre relies on PCG for their projects. Without it, the games just would not work. It is a crucial part of the game design. These are the two main purposes for using PCG in your project: simply to save time, or to enable a style of content or gameplay that wouldn’t be possible without it.

 

Pitfalls

With that in mind, we can set out clear goals of what PCG is meant to achieve for us. To simplify this process, I will discuss the type of tool that is meant to save time by generating art assets for a project. Thus, the goal is simple: to cut down the amount of time it would take to create a large amount and variety of content. This also provides a fail state for the decision to use PCG: if it takes more time than it would have done to create by hand, using PCG was the wrong choice.

It’s important to always keep a clear goal in mind when designing an algorithm. Without a strongly defined outcome, it’s easy to get stuck in a feedback loop, continuously iterating on an algorithm when it’s not clear when your result is closer to what you need. Dejobaan Games wrote about running into this problem in their article “Procedural Content Generation: Thinking With Modules”. They mention spending a lot of time on an algorithm meant to generate levels based on various different user inputs. The algorithm was supposed to be able to generate “fun” levels, and they lost a lot of time endlessly tweaking it to try and find the sweet spot. When every iteration starts creating as many problems as it solves, it might be time to step back and re-evaluate the criteria for what a good outcome is. It’s important to work towards an outcome instead of from your algorithm.

Content can be unique, yet look the same. This problem described by Kate Compton in her GDC talk "Practical Procedural Generation for Everyone" has to do with functional uniqueness. You could create a powerful and complex algorithm that generates billions of objectively unique bowls of cereal. No two will be exactly the same. Except that just making a single bowl of cereal by hand would have achieved the same outcome. The player likely won’t notice or care that the bowls are technically unique, they’ll all look the same. So actually, the time spent creating this algorithm was essentially wasted. The goal is to create content that is visually distinct and diverse. If it’s too hard to tell apart, a single hand-made model serves the same purpose.

It doesn’t matter how powerful and complex your algorithm is if the content it creates is bad. Your content doesn’t just need to be procedural, fast and easy to create. It needs to be good. As your algorithms become more complex, it becomes more and more difficult to author what a “good” result is. If you have created an amazing algorithm that can create square miles of terrain with the click of a button, but the terrain is boring, you probably wasted your time.

 

Making your algorithms work for you

Thankfully, there are ways to alleviate some of these risks. Depending on how you build your systems, you can get so much more out of your algorithm. As an example, let’s look at some ways to let users interact with a theoretical algorithm that generates vehicles.

The quickest way to present this algorithm is to simply give the user an option to press a button, and a random vehicle will be created for them. All parameters randomized. This is functional but obviously rather limiting. What if the user finds a vehicle they really like, and wants to use again? So perhaps the next step is to expose the seed that determines the randomness in the algorithm. Now the user can save the seeds of the vehicles they like and re-use the same ones later. Much better, right?

Yet this doesn’t provide a lot of control. What if the user finds a vehicle they like but wants to get some similar variations? Perhaps to give the user this level of control, the right answer is to expose all the parameters and let the user edit these to their heart's content. This might work for some algorithms, but if you’re dealing with something very complex, the user could get lost in adjusting parameters that they don’t really understand. Not to mention this solution doesn’t exactly use the power of procedural generation if your user ends up manually defining the content.

Perhaps the ideal outcome is to let your user specify constraints for your algorithm. This way they can more or less “search” your algorithm for the content they want. Say your user still wants the algorithm to generate random vehicles, but they want all of them to share a certain attribute. Or perhaps they’ve found that only vehicles with a certain attribute at a certain level works for them. This way you give the user a lot of control over the algorithm while maintaining the “power” of proceduralism. Obviously, doing this takes more time than to just let your algorithm randomly determine the parameters every time, but for more complex algorithms, this method can help you get the most out of them.

 

Conclusion

PCG is a very powerful and versatile technique that can elevate a project to a scale or level of quality that would be very hard to achieve without it. It can be used to implement new and unique gameplay or functionality into a project, such as the roguelike genre does. But ultimately, most projects stand to benefit from PCG’s ability to create a lot of content quickly and efficiently.

When implementing procedural content into your project to save time, there are a few pitfalls to watch out for which might end up wasting time instead. For instance, it might be tempting to work on a promising algorithm to try and find the perfect content for a project, but it’s important to establish a good goal to work towards. Likewise, making content procedural for the sake of having it be procedural can harm a project. First and foremost, content needs to be good. Furthermore, an algorithm shouldn’t just produce content that is unique, it needs to look unique as well. If the content becomes too hard to tell apart, using proceduralism to create it would be a waste of time.

However, when taking care to allow a strong level of control over your algorithms, it can at least become easier to find content that is “good”. A powerful algorithm can only be utilised to its full potential if the user has easy and intuitive access to that power. What level of control that is depends on the type of algorithm, however. Unfortunately, there is no perfect solution that will work every single time, but taking a little bit of extra time and effort to define a clear goal should make it easier to make an informed decision.

Hopefully, this article has provided some helpful ideas on how to successfully implement PCG into a project. Thank you for reading.

 

Read more about:

Blogs

About the Author(s)

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

You May Also Like