

With a successful 20-year history and a devoted following in the gamer community, Sid Meier's Civilization* series had a substantial challenge in raising the bar for Civilization V (Civ5). Part of that challenge involved ensuring that the prospective audience would be able to experience the game on a mainstream computer system and enjoy the game just as much as they would on a high-end system. To that end, Intel® Graphics Performance Analyzers (Intel® GPA) paved the way for ensuring the game would offer the best possible mix of graphics and game performance for the vast majority of systems in use-including notebooks and desktop machines equipped with Intel® Graphics chipsets.
The means by which the Firaxis engineering team accomplished their performance enhancements provides insights into techniques that developers everywhere can apply. Developers gain multiple benefits from having a tool that makes it possible to identify bottlenecks and eliminate them, as well as experiment with different DirectX*-based game code implementations to enhance graphics and game performance. This case study examines the ways that Firaxis was able to ensure the best possible graphics playback on a variety of systems and improve the responsiveness of gameplay in Civ5.
Download Article
Download Sid Meier’s Civilization* V Finds the Graphics Sweet Spot [PDF 1.6MB]
Extending the Civilization Franchise
Over a span of decades, Civilization has evolved from an interesting board game to one of the most engaging gaming experiences that a PC can offer. Along the way, the designers, artists, developers, and strategists at Firaxis have capitalized on the platform capabilities of each successive generation of hardware and used these capabilities to richen and expand the online world and vast interactive possibilities of the AI-guided gameplay. Threading proved to be an exceptional means of making the complex game responsive and graphically rich.Dennis Shirk, a producer at Firaxis Games, commented, "Obviously, the biggest change that everyone is going to see immediately when they see the game is the graphics and the engine we wrote. We wrote the engine from the ground up to really let the art team go crazy.

"We switched from square tiles to hexes, so now everything looks organic-everything looks more natural," Shirk continued. "The rivers flow more naturally. The mountain ranges look like something you might see from an airplane. The keyword that Dorian Newcomb, our lead artist, was trying to get across was ‘believability.' It really shines. Dan Baker is our graphics lead and the things that he has been doing with this engine are just amazing. People have never seen something like this come out of Firaxis."
Dan Baker said, "We used [Intel] GPA extensively to analyze the situation, analyze the game from both the CPU and the GPU side to make sure that we are getting very efficient use. And so far, this kind of shift for making sure that the graphics are not going to slow the game down has yielded even better results than we thought. We are in a situation now where we don't believe that our game designer can slow our game down. That is a situation that we haven't been in before."

Working with Intel® Graphics Performance Analyzers and Intel® Software Development Tools
The Firaxis development team made extensive use of Intel GPA in their performance tuning of Civ5. Throughout the course of the Civ5 development effort, Dan Baker has been focused on lessening the impact of graphics rendering on the overall responsiveness of the game. "As a graphics lead, I am responsible for pretty much anything you see on the screen, at some level or another," Baker said. "Graphics uses the majority-by far the vast majority of system resources. Probably 85 percent of the system resources that we are using in Civ5 are graphical. Obviously, I have to be pretty concerned about the system and performance implications of things.""For optimization on the Intel® architecture, we spent a lot of time thinking about the CPU. On previous titles, we had a lot of problems with maximizing use of the game," Baker continued. "On Civilization Revolution (CivRev), a unit took about .5 milliseconds on the CPU to render, which doesn't sound like a lot until you realize that we might have to render a hundred or two hundred of them, because the game can have whatever the user wants to do. The game is very open-ended.
"So, we were getting into a lot of trouble. When we started preproduction for Civ5, we said, we want to be able to really use the processors well. We did a lot of analysis on where we are spending our time. We did this by using Intel® VTune™ [Performance Analyzer] quite extensively and deciding we are going to be able to use all of the CPUs on the system in a very good way. We were able to use analysis tools like the System Analyzer in [Intel®] GPA to really tune the application and also to verify that the work we had done was truly making it parallel."
The History of Civilization*
Civilization* V (Civ5), the empire-building, computer strategy game, is slated for release in fall 2010, and this latest version will give a new generation of players a graphically rich foundation upon which to test their war-making and diplomacy skills. The development environment, part of which is based on the Python scripting language, has attracted a devoted community of modders, as is perhaps appropriate for a game actually designed by a former modder, Jon Shafer. To remove obstacles for less experienced players, Civ5 will have a mod browser and installer built into the game's menu system, providing simplified access to a wide range of free content that is created by imaginative developers around the world.The product of Sid Meier's Firaxis studio, Civ5 traces its roots to a board game from 1980 that was called simply Civilization. Meier found the notion of the technology tree introduced by this board game compelling and worked this concept into a series of sequels, each building on the capabilities of the available hardware platforms. The latest version features near-cinematic animated sequences and a host of sophisticated features that have been made possible by increased graphics processing powers and next-generation multicore processors. With a brand new artificial intelligence engine; a hexagonal tiling system that facilitates movements in a more fluid, realistic way; and the addition of City States as a new strategic wrinkle; Civ5 promises to take gamers on an expansive, megalomaniacal journey across the centuries.
Pete Murray of the Firaxis marketing team noted, "As a fan and as a developer, there are always things that Jon Schafer, the lead designer, wants to try new. For example, we are going from using square tiles to hexagons. Not only does that give us some cool gameplay effects, but we are able to create a much more organic-looking world. With a very powerful new graphics engine we have developed for Civ5, the landscape just glows. You have these beautiful mountain ranges and these rivers, and it is all there for you to explore."
During his Game Developers Conference 2010 keynote address, Sid Meier, director of creative development at Firaxis Games, said, "We are trying to create an epic journey for the player. There are so many genres, so many styles of games, so many different ways of gaming, but I think in a way they can all be encapsulated in this idea of an epic journey. How do we use psychology to make our journey more epic? I come back again and again to the idea of interesting decisions, which is really the core..."
Multi-threading as a Performance Booster
In Civilization IV (Civ4), without strong multi-threading, the total number of rendered graphics objects displayed onscreen is limited by the processor. Neither Civ4 nor CivRev incorporated anything more than functional threading, and the architecture did not scale well to existing or next-generation hardware platforms. To circumvent this limitation, the Firaxis development team employed Intel® Threading Building Blocks in Civ5 to broadly implement task-based threading and also used data wide threading throughout the game.

In a major split from past game architectures, the Firaxis team rearchitected their game engine and Civ5 renderer to more effectively use a multitasking model (as shown in the following figure) and to better handle massive throughput. A message-based system was devised that allows major systems to communicate through message channels, maintaining any state required and ignoring messages that don't directly apply. By decoupling system activities in this manner, the team found it easier to write thread-safe code and to avoid potential bugs and bottlenecks.
"So, now we have this very non-serial architecture that has a lot of parallel elements to it," Baker explained. "We run on a lot of processors and we have tested scaling to 12 threads, but there is no fundamental reason we can't use more."
"We do a lot of CPU work," Baker said, "and we use the Task Analyzer extensively. We use the Intel Threading Building Blocks task system and then we use the Task Analyzer to actually analyze our frame and see where our tasks are getting launched."

"With the Task Analyzer," Baker continued, "you will see little pie slices and you will see that whole frame. We are able to do a lot of tuning. There is an example here of where we do a fluid simulation for the fog of water on the CPU. I initially implemented it in parallel, knowing that there were some problems. As shown in the figure, this is where it started and you can see where it wasn't efficient. We cleaned it up using the Task Analyzer. It was very obvious what was going on."

"The original performance was 8.5 milliseconds and we were able to get it down to 1.3 milliseconds," Baker noted, "by doing the correct parallelization and by cleaning up all the stuff that we found in the task analyzer. That is a specific example of where we were able to realize that we weren't threading correctly, and by looking at it in the tool, we saw that and we were able to fix it in about a day-to go through and get rid of the bad stuff. It took maybe another couple of days to tune it up and get the last few percent out of it."
Creating Games for a Wide range of Platforms
"We have a large amount of latitude to adjust the presence of the game on lowend systems. By using [Intel] GPA, we were able to look at the new [Intel®] Core™ i3 and [Intel®] Core™ i5 [processors] and I said, OK, let's actually see if we can run on this."
"It turned out that, yes, we could. We are confident that we can make the game run at 30 fps on these mainstream parts that are just everywhere. That is just huge for us because our fans can be confident that if they go out and buy a machine that they are going to be able to run our game. Yes, it may not look as nice as if you bought the high-end video card, but for a lot of hardcore Civ players, they don't necessarily care. They just want their Civ fix."
- Dan Baker, Graphics Lead, Firaxis
To stay ahead of the technology curve, the Firaxis development team is always looking ahead to upcoming platforms. "We have to think about what hardware is going to be there five years from now," Baker said, "because it takes years to develop an engine. We already have six cores shipping today, so if you are estimating that Moore's Law continues for the next five years, you can assume that by 2014 or 2015, the end-user might have 32 cores. If we want to be able to support that, we need to think about it today. Or else we will run into trouble later. So, we are really looking to make sure that our engine architecture will keep scaling for the next five years at least."
More About intel GPA
Intel GPA has become firmly established in the developer community as a valuable tool that cuts to the heart of graphics processing issues with analysis capabilities that can target both low-level individual tasks and high-level system tasks. Issues that potentially can slow performance can be quickly identified and corrected. The version 3.0 release offers numerous worthwhile enhancements, including new metrics for Intel® HD Graphics and Intel® Core™ processor-based systems.Intel listens closely to the developer community, and each new version of Intel GPA incorporates features and functionality that have been actively requested by game developers seeking to better position titles for the widest range of hardware platforms-from mainstream desktop machines and mobile gaming to the high-end, dedicated powerhouse systems that serious gamers favor.
- Yannis Minadakis
Senior Graphics Engineer, Intel

By providing an easily accessible visualization of the metrics at play within a game, Intel® Graphics Performance Analyzers lets developers focus on the performance hotspots.

Experimentation, as shown in this screenshot of Intel® Graphics Performance Analyzers using the Smoke game engine demo, is a key means to achieving significant graphics processing performance.
Chris Cormack, product designer for Intel GPA 3.0, commented, "Intel GPA 3.0 is a large leap forward for the gaming community in that we now support a platform analysis tool, not just a DirectX GPU analysis tool. One of the new features in Intel GPA 3.0 is DirectX 10.1 support. DirectX 10.1 is now supported across the entire tool suite."
"Secondly," he continued, "we have an advanced shader analysis tab. This tab provides a list of unique shaders that can be optimized on their GPU time. The tab simply prioritizes them based on GPU time. Third, we have a new launching mechanism that no longer requires you to launch a game directly through [Intel] GPA. You can now launch a game as you normally would by double-clicking on the desktop, running a script, or anything else, and then attach to that game at a later point to do your analysis.
"The last feature, the fourth feature, is our Platform View. This is the meat of the new GPA 3.0 release. This is the feature that provides true platform analysis across both the CPU and the GPU."
"Helping Firaxis use GPA," Yannis Minadakis, senior graphics engineer at Intel, said, "we looked at the performance of their tasking system in Platform View. Platform View allows you to visualize all the different tasks running on your cores. The difficulty in writing a complex task system is that you can break your problems up into small chunks of work, but it is hard to know whether that work is actually being done in an efficient manner."
- Pete Murray, Marketing, Firaxis
Support for Intel GPA is provided through an active Support Forum and library of Knowledge Base articles. Within the Support Forum, developers exchange information about the use of the product, ask questions about particular applications, and share techniques for making best use of the product capabilities. Assistance is readily available from both veteran developers and Intel staff members with deep expertise in graphics programming and game development. The Knowledge Base features an array of resources to help in mastering Intel GPA, including technical papers, training materials, links to additional information, and specific techniques for enhancing game performance.
Learn More
- Intel® Graphics Performance Analyzers is free to Visual Adrenaline developer program members.
To register and download your copy, go to:
https://ssl.software.intel.com/en-us/register/visual-adrenaline/ - For a video that shows the new product features in action, presented by Chris Cormack, the product designer, go to:
/en-us/blogs/2010/04/08/are-you-pixel-bound-scale-your-game-with-intel-graphicsperformance- analyzer/ - For the latest news and updates about Civilization V*, go to:
www.civilization5.com - For a video of Sid Meier’s Game Developers Conference 2010 keynote address, go to:
http://gdc.gamespot.com/video/6253529/ - For details on the upcoming launch of Civilization Network, visit:
http://www.firaxis.com/games/game_detail.php?gameid=31
