How Company of Heroes made a destructible battlefield

This is The Mechanic, where Alex Wiltshire invites developers to discuss the inner workings of their games. This time, Company of Heroes [official site].

The Tiger tanks come rolling in, the artillery comes thundering down. Walls are blown wide open, buildings collapse on themselves. In Company of Heroes, the battlefield is ever-changing, munitions cutting into the map new opportunities for flanking and to be flanked. Confident pushes turn to disaster as the enemy punches through rear guards, and last-ditch defences are saved as the cavalry smashes through barricades. Company of Heroes is a deeply dynamic RTS, something that’s all down to:

THE MECHANIC: Destructible environments

Most of the features on a Company of Heroes map can be destroyed: fences, walls, buildings, the ground itself. Destruction provides a great deal of its real-time strategy and also the game’s whole identity, which evokes the WWII we know from the photographs, films and stories that memorialise the fierce fighting that swept through northern France, leaving hedgerows and fields, farms and towns in ruins.

And let’s be honest, it’s also a thrill to see your actions written into the world. Shellholes and breaches are a record of the skirmishes and pitched battles you’ve fought. Though Company of Heroes was released 11 years ago, it’s still a novelty to see a game world respond so expansively to your decisions.

It all comes from a simple idea: giving soldiers cover. “We were looking at the original vision and source material and cover was obviously critical to the experience of soldiers on the frontline,” Quinn Duffy, who was senior designer on the game, tells me. The first prototypes featured basic all-around cover, and Relic noted the way it encouraged players to preserve their troops. And then the team switched from using the old engine it had used to make Impossible Creatures to a new one, called Essence, and with it came cover that was directional.

“That was the big defining change in terms of environments in the game,” says Duffy. Now units would only be covered from one side, creating opportunities for them to be flanked or approached from the rear. Relic then wanted the cover to be destructible, with weapons impacting on it: machine guns tearing through fences, grenades blowing walls down.

The result was a relationship that defined the ambitions Duffy and his team had for their game. “We wanted to create movement and fluidity and adaptability in the world. To force troops to move and for players to move them around, seeking better cover.”

But in making an actual game out of this relationship, Relic encountered all manner of knock-on effects which ended up pulling in the creative skills of the entire studio to solve them. “We had to be really aware that by deciding to destroy the environment we were signing up for emergent gameplay in every system, not just a few,” senior artist Alun Bjorksten tells me.

Some effects were practical. If guns are firing on cover, then the player needed to see the bullets impact on it to understand what’s happening. So Relic had to create little visual features to support that, including extra effects, such as the machine gun tracking its bullets across ground and up to the cover to give players awareness, as well as a sense of drama.

And say you’ve got a squad of riflemen behind a fence that’s under fire from a machine gun. When the fence falls apart, the riflemen needed to be able to automatically shift to find the next cover so they had a sense of life, so a kind of self-preservation system had to be built to manage that.

And then there’s pathfinding. In the first Company of Heroes, soldiers can’t cross fences and walls, so once vehicles and explosions start breaking them up, troops’ access to different parts of the map completely change.

“It made the map design interesting,” says Duffy. “If you put a fence in you needed to know the pathfinding distance it would add, and you needed to ensure it wasn’t going to block troops.” Map design was an exercise in breaking the game into phases for when during the battle certain weapons and vehicles with the power to destroy objects would appear, and accounting in the environment for their effects on changing the pathfinding.

Sometimes destruction would remove access to areas, such as when buildings are reduced to impassible rubble. Bjorksten remembers when the team made it possible to destroy bridges, but before it was possible to repair them. “We were like, we’re going to destroy the bridge! And then you realised you couldn’t progress any more. So we needed to repair as well as destroy, and then to destroy the repair. You could easily invalidate the gameplay.”

Philosophical decisions had to be made, too. If a wall falls down and the AI isn’t there to see it, does it know about it? Relic decided it had to.

This creative choice is what’s behind those times when you see AI begin magically pouring through a new gap in defences. “There’s a desire to make them only aware of what they can see, but it’s not always realistic in terms of the knock-on behaviours,” says Duffy. Without this supernatural awareness, the AI could get stuck because it doesn’t have long-range knowledge about the world to be able to find its way to where it wants to go.

Players can also put down barriers, like barbed wire and sandbags, further tweaking the way units can access different areas of the maps. And in these being destructible came another issue, as Duffy explains: “You put a nice sandbag emplacement overlooking a road and set your machine gun up, all super cool and tactical, and then your first vehicle comes and drives right through the middle of it.”

“The Tiger tank has this ability called ‘heavy crush’, which can crush objects that other vehicles can’t,” says Bjorksten. “Once it’s on the map then all bets are off because this thing could go through all kinds of things you’d set up neatly as chokepoints.”

Destroying your own defences is a long-standing frustration in Company of Heroes, but like the prescient AI, it’s a result of accounting for wider problems. First, Relic needed to avoid players being able to accidentally block in their own vehicles with their defences. Relic also knew the appeal of that same vehicle crushing the enemy’s defences. And then there was the way pathfinding works. The game has a grid of the world that records in every location what objects units can pass through it. When somewhere is marked passable to a heavy crush vehicle, as far it’s concerned it’s just open ground, blind to what’s actually there. Unfortunately that means it’s also blind to your own defences.

“I think game design and development is months and years of constant little compromises and weighing pros and cons, and that’s the daily occurrence,” says Duffy. “There was a lot of debate about this and how much we tried to preserve elements of the maps so the early infantry cover combat was maintained while also being able to have vehicles rampage around and not get stuck on objects or do slow turns around things and get killed. When the maps were really populated with crushable stuff, vehicles became tough to use because they had slow turn rates and they’d expose their weak armour. Those frustrations aren’t worth the trade-offs.”

Not all the ramifications of making things destructible were problems. They also led to design opportunities. For instance, if you have cover, you can start to design weapons that are effective against it, like the grenade. And if you have buildings, soldiers should be able to go inside. And if they’re inside, they should be able to shoot out of it. “So they should poke holes in buildings and use them,” says Duffy. “Alun spent like a year making buildings work.”

Every asset needed a set of destruction states and physics objects attached to them to represent damage. They also needed to have rules attached to them to represent whether they’d block pathfinding or provide cover or other things. “We probably tripled the cost of making the game because of this!” says Bjorksten. But buildings were a special case. Relic wanted them to look like the ones you see in period photos, where every window is different, where rooflines don’t meet up and nothing’s symmetrical, and where damage varies enormously.

“We knew we couldn’t just create a set of pre-damaged buildings, because you’d see the repeats of the same building over and over again, so out of this was born an epic system for designing these systems in what we called panels.” Every building was divided into 10ft by 10ft pieces, and then written into the rendering code were ways to punch holes or collapse them. Two people worked on this system for two years, almost full-time, creating the art and figuring how the the texture memory available to PCs at the time could hold it all.

“There are 230 different damaged states that you can put a building into,” Bjorksten says. That’s 1,073,741,824. “It’s quite the system.”

And along with their appearance, buildings had an impact on the game itself. Weapons had different effects on them, including the number of panels they’d damage and its extent. They’d have sight-blocking and shot-blocking properties, too. (The team had to also account for stats and random values occasionally leading to cases such as V1 rockets impacting on a building and doing no damage.)

“I don’t know if many teams have attempted that. Probably with good reason,” says Duffy.

I wonder if Relic ever found the scale of what Company of Heroes became daunting, but Duffy shrugs. “No more daunting than just building a big-ass game is daunting.” Perhaps that’s just with the benefit of knowing how well it turned out to work.

If you’re in the mood for more COH history, check Fraser’s excellent making of feature from last year.

20 Comments

  1. fuggles says:

    Weird that they went the other way with Dow 3. Maybe it wasn’t worth it after all, which is a shame as I hoped they would develop it more.

    Even total annihilation has a more advanced dynamic cover system than most later games.

    • Arkandos says:

      Which is really weird, because it feels like if any game would benefit from destruction, it would be DoW.

      • Asurmen says:

        There isn’t enough assets on a DoW map to destroy, and DoW2 destroyable cover, well, sucked ass really.

        • fuggles says:

          Well improve it and add better maps. At least have dynamic craters. The bubbles look worse than dow1 mechanically.

          Does dow3 allow you to hide behind vehicle husks? Total annihilation did that really well.

  2. Rilcon says:

    This makes me want to replay Soldiers: Heroes of World War II for the good old “fuck your building cover, I have a tank” fun.

    • Premium User Badge

      Mikemcn says:

      May I also recommend, any of the Men of War games, which were the successors to Soldiers. Amazing destruction.

    • Spudnik says:

      I often hide behind eight tanks and your momma’s fat ass.

  3. Kakrafoon says:

    Having none of this in Dawn of War 3 is a shame before the eyes of the God-Emperor. Seriously, why did they have to take a step backwards? Company of Heroes still leaves me with a profound sense of awe at its larger-than-life violence towards troops and terrain. Let’s hope it wasn’t an evolutionary dead end. If it was, I’ll cherish it forever.

  4. poliovaccine says:

    This was a great game, one I believe I found through a demo disc when it was new, and which just blew me away at the time, for exactly the reason this article’s all about: that sweet, sweet destruction. Gotta thank RPS, too, for reminding me wtf it was about a year ago so I could finally look it up and acquire it. Only properly got acquainted then, but goddamn, what a juicy mother of a strategy game. Rare that I ever care about individual units in a strategy game like I do in this, too – I’d say about on par with XCOM, even though XCOM does so much more to generate that investment. Something about them being so itty bitty. I just want to protect them!

    By the way, I say this almost every time, but never stop doing these The Mechanic features. I say that almost every time cus I’m paranoid that someone will ever-so-briefly consider axing it!

  5. Synesthesia says:

    Yes. Yes! Such a huge, landmark game. It doesn’t get talked about enough. I think it’s the peak of RTS games.

    • Kollega says:

      Company of Heroes and Supreme Commander, both from roughly the same time (2006 and 2007) are still the pinnacle of the RTS genre, albeit in massively different ways. CoH is the best there is for hands-on explosive action, while SupCom really puts the “strategy” part into “real-time strategy”. And it’s a huge, massive shame that the genre did not go any further. There’s so, so much more that could be done than just rehashing the Starcraft formula.

      Sometimes, I still wish for the same kind of famous-creator-driven, crowd-funded rennaissance among RTS games that the RPG games got in recent years. Or maybe an upsurge of economical, smart “RTS-with-original-mechanics” games analogous to the indie 2D platformer scene. I don’t know if there’s any real chance of that happening, but honestly, right now we live in a state of a complete RTS drought, and I’m sure that generates demand for such a thing happening.

  6. Scrobbs says:

    There’s just been a modding update to vanilla CoH (new steam version), as well an update to the massive Eastern Front mod. Large uptick of players in June! Still averaging about 1800pm, which is pretty amazing really.

  7. Ariakkan says:

    Best RTS in the history of PC Gaming. It is unbelievable how Relic took all the good things down the drain in subsequent titles. Hopefully someday, someone will revive the franchise.

  8. popej says:

    Best RTS ever made imo. The multiplayer is unsurpassed and the single player was amazing. Homeworld single player had the edge, just.

  9. ludde says:

    Guess I’ll just echo everyone else: best RTS made. Had me and my friends completely awestruck back in the day. It’s a shame a whole decade’s gone by without anything even close to it.

  10. Premium User Badge

    FesterSilently says:

    Yeah, I can’t quite put a finger on it (possibly because I haven’t put more than 8-10 hours into the game), but I *never* got into CoH2 as much as I did (and still do!) CoH1.

    The old quote from Jimmy Doohan’s character, Scotty, from Star Trek 3 (right after he’d admitted to sabotaging the USS Excelsior) always comes to mind when I try playing CoH2 again,

    “The more they overthink the plumbing, the easier it is to stop up the drain.”

    TL;DR: I’ve got maybe 12 hours invested in CoH2; 407 hours (and going) in CoH1. ;)

  11. EBass says:

    Played far too much computer games in my late teens and early 20s. Despite being in some relatively high level FPS clans, this was the only game I ever approached world class at. Strange really, because most other RTS’ don’t really do much for me.

    Absolutely unparalleled, though the Men of War series scratches a similar itch. It’s a shame that Relic couldnt push on from their triumph.

  12. Premium User Badge

    JimmyJamNYC says:

    No I’m the same way. I just started another CoH1 single player game again and wouldn’t think of touching 2. It just sorta sucked in comparison.