During the Montreal International Game Summit, Far Cry 2 technical director Dominic Guay painted procedural content generation as an increasingly important game development technique, not just to control costs as games get bigger and bigger, but also to retain the crucial ability to make changes throughout the production process.
"This talk is not about Far Cry 2 the game," began Guay, who populated his talk with development examples from Far Cry 2's creation rather than descriptions of the end-user goals of the game's features.
Guay defined "procedural data generation" as "techniques and algorithms of runtime or highly automated offline data generation," but noted the term refers not just the algorithms and code that comprise systems, but also the surrounding tools that enable designers to make use of them.
The Evolution Of Proceduralism
Procedural generation is "nothing new," Guay pointed out, citing Bethesda's 1996 game The Elder Scrolls II: Daggerfall, which boasts a "land mass twice the size of Great Britain."
Going back further to 1984, he praised "the granddaddy of space trading games," Ian Bell and David Braben's influential Elite. It consists of eight galaxies of 256 planets each, generated procedurally using data tables and "pseudo-random sequences" -- the code for which can today be downloaded via Bell's website.
Moving to the modern day, Guay noted that particle systems, now widely used, are really a form of procedural generation. "It's a procedural approach to creating content that has become pretty common," he said.
However, "the industry in general tends to favor brute force approaches," he said. The Far Cry 2 team found itself butting up against that tendency, due to the vast size of the game's world.
"The first big draw of generating procedural content is to save on cost and time," said Guay.
"When we started conceiving Far Cry 2, we didn't have a senior animator on board, so we didn't really have an idea of what would be possible for an animation team," he recalled, and noted that the number of discrete animations required turned out to be unfeasible, "so we moved many of those animations up into a procedural animation system."
That approach allowed the team to blend animations that change based on the player's influence on the world -- early in the game, a character might perform certain acts in a way that demonstrates contempt of the player, but later on, when the player has gained notoriety, that same character could perform those same actions while "tainted" with visual cues of fear or intimidation.
Opening Up Innovation Fields
"Another big benefit [of procedural content creation] is that you end up being able to do stuff you simply couldn't do otherwise," Guay continued. "It opens up innovation fields. If you're creating things through code, you have a deeper understanding of what you're doing, and you can bake in some limitations."
"Our artists needed to be able to build not a random tree, but a type of tree," he said by way of example. "It's actually much closer to building a particle system than building traditional art assets. Artists play with parameters more than they play with vertices."
Creating those tools allowed artists to define trees based on characteristics gleaned from extensive photo reference, more than to create a number of discrete tree variants based on those references.
That approach led to a huge amount of control and unique systems -- Guay showed an internal video of trees in Far Cry 2 growing from sapling to their full adult state. Those systems are not available to the player in the game, but they allowed the team to convincingly populate the world and deal with realistically regenerating trees that have, for example, been destroyed by fire.
"Another benefit of procedurally-generated content is the time you gain on turnaround for changes," he said, distinguishing that advantage from the more straightforward time saved in initially creating content.
"Level designers love to move roads around," he said as an example. "Typically, this would drive artists crazy. But [here], what will happen is that the terrain will actually smooth in according to how the rules were designed, and the vegetation will move and regrow." The designer can then drill down and more explicitly tweak the positioning of elements that have been adjusted dynamically.
Procedural content isn't perfect, Guay admitted. One difficulty associated with the practice is retaining artistic control alongside the dynamic processes.
Initially, the team created a procedural sky rendering approached based on algorithms -- which led to a totally unconvincing skybox that was clearly inferior to what a hand-authored skybox would be. "We considered it to be a total failure," he said.
He explained that a great deal of focus must be put on the tools that surround the algorithms, to allow the systems to be properly harnessed. In the end, the game shipped with a revamped procedural sky system that ended up much more effective than the first attempt. It takes into account myriad weather patterns, atmospheric conditions, and other variables.
To demonstrate the effectiveness of the approach, Guay showed an image made up of rows of in-game screenshots essentially forming a color palette, with time of day on one axis, and "storminess" on another axis, representing the full spectrum of skyboxes that the player will see with all the combinations of time and weather.
Another drawback is simply the complexity of the pipeline and tools. Putting the focus so much on systems and rules can be shocking to artists, who are accustomed to much more straightforward, linear art tools.
"It's not always clear what the parameters actually do in the simulation," he said.
On that same note, "the guy with the great idea for procedural data not necessarily the guy with the right mindset to make the tools," Guay added. The Far Cry 2 team dealt with this by setting up teams that paired those "idea people" with technical staff capable of executing on the ideas.
Still, despite the improvements over early development, he said there is still a lot of room to improve the tools.
With most elements of the game, the amount of time spent on developing and refining tools was vastly greater than the amount of time spent on actually developing and refining the underlying engine. In the case of the environmental tools, 15 times more time was spent on the tools rather than the engine. The only exception was the skybox tools and engine -- which points to the team's difficulties in that area.
Another hurdle was that "everything depended on programmers," since such a great deal of the game's assets depended on underlying algorithmic systems that had to be programmed.
In the end, it took about three years for the asset pipeline for the vegetation system to reach a state where it was considerd "mature and flexible," after an eight-month prototype period.
A Testing Nightmater
Procedural content can also be "a testing nightmare," Guay noted.
When a team member made a seemingly minor after-hours change to the ecosystem, it ended up increasing the asset density of the game world by 25 percent -- resulting in more than a few headaches.
"If I'm tweaking a jungle procedurally, maybe I'll just tweak it in my test map," Guay said. "But when I integrate it into the game, somewhere in the 50 square kilometer game world, maybe in just three small areas, it might cause problems, and we won't find those problems until QA uncovers them."
Still, there are ways to mitigate those problems, such as automated information gathering that searches for discrepancies in performance, memory validity, and other areas. Towards the end of the project, the team also locked generation to stabilize the world.
Though he said he was loathe to delve too deep into predicting the future, Guay did try to extrapolate some general development trends that will affect procedural content.
Amount of content in games, he said, is increasing at an exponential rate, just as team sizes are increasing more linearly. Complexity of tasks, he said, are fortunately increasing more linearly.
"I still have some long-term fears," he said. He painted a picture of a potential future where these kinds of procedural systems have improved to the point where games can run essentially complete physical simulations, where items must actually be built according to real-world physics and architectual principles.
This would then begin to make it harder and harder to "significantly, or usefully, change the game content during production," he said, particularly if it means teams must start working with trained architectural engineers.
"Processes sound like the silver bullet," he said, referring to the idea of "failing early and failing often," with the aim that more and more mistakes can be pushed into pre-production so that by the time production begins, very few mistakes and changes are made. This idea comes from film, Guay said, where the production process is much more quantified and defined than it is in game development.
"But I think we need to preserve the idea of making changes during game production," he said, claiming there is a fundamental difference between a linear medium like film and an interactive one like games, noting that the role of creative leads during production depends on the ability to keep making changes.
"The bottom line here is that I'm not trying to say creating content procedurally is... the [only] solution, but it's an interesting avenue," Guay summarized, noting that a highly systemic attitude to asset creation can preserve the important game development property of allowing for important creative changes throughout the whole production process. In conclusion, he added, "After working on Far Cry 2 I'm interested in taking it further."