To Create Smart AI Command & Conquer Devs Made Units Stop Acting Stupid

To Create Smart AI Command & Conquer Devs Made Units Stop Acting Stupid

Developing the popular RTS Command & Conquer: Tiberian Sun involved solving a whole host of problems. But the biggest and most interesting problem was figuring out to allow hundreds of troops and vehicles to move around maps without slowing and destroying PCs at the time.

The latest video in Ars Technica’s wonderful War Stories series is all about how developers Westwood Stuidos solved pathfinding and unit management in Tiberian Sun.

In games, characters and units figure out where to go using pathfinding. This creates a series of possible routes the AI can take to reach their objective. With even one unit, this can mean dozens or more different paths.

In a game like C&C: Tiberian Sun this pathfinding becomes more complicated as players can spawn hundreds of units, all of them moving and stopping in different areas of a large map, which can contain other players doing the same thing. This many units trying to find their way at once could cause even powerful PCs back in the day to collapse under the computational weight.

One of my favourite quotes from the video is easily this: “Players don’t realise how hard you have to work to make a game not do something stupid.”

ImageYouTube )” loading=”lazy” > An example of one unit and all their possible paths. (Illustration: Ars Technica, YouTube )

This is in reference to when pathfinding stops working or makes a mistake. These issues create the feeling that the AI unit you are ordering around is an idiot. So the team spent a lot of time making their AI not do dumb things.

As Westwood Studios co-founder Louis Castle explained: “If you spend time making something not do something stupid it will actually look pretty smart.”

The solution to their pathfinding problems was to create a series of rules and directions, that helped lessen how much processing power would be needed.

For example, if a unit is near friendly AI units that are moving, the game tells these units to ignore each other. When AI units encounter a friendly AI unit who is moving and is in their way, the game simply tells the unit to bump that stationary friend out of their way. Using these techniques allowed Westwood Studios to have hundreds of units in their game without destroying players’ computers.

The whole video is interesting as Louis Castle explains how they solved other problems, including issues with the CD-ROM and video compression.


  • I don’t follow Kotaku to be directed to someone else’s videos. I follow to read Kotaku articles. And this would make a brilliant article as pathfinding has long been the bane of many of my RTS “battles” over the years.

    • Kotaku can’t do everything, especially when they’re not subject matter experts (unless I’m mistaken and they have a former developer with significant experience, particularly with AI and pathfinding).

      Personally, I’m happy for Kotaku to suggest content that I may otherwise not come across.

      • That’s also part of the site’s general ethos since it was founded. While it’s always great if we’re breaking the story or we have the content first, it’s our job to share with readers stuff that’s relevant, interesting, funny or shows off more about a game or community that they otherwise wouldn’t have known. Being precious or anal about where it comes from ultimately only harms readers. And it works both ways – while we share content from other places, those places share our content too (see literally any story talking about Destiny development, and you’ll find some nugget that goes back to Jason’s reporting, as an example).

        Obviously not everything is going to be to everyone’s tastes, but the general principle underlying all of it is that the content will be interesting, relevant, important to the gaming community, or just help lift your day a little. I think this falls under a few of those brackets.

        • Man, I know you have to deal with Kotaku commenters all day and that would drive any sane person to desperation, but was I really “precious” or “anal”?

      • I’m not an expert on the fundamentals of writing a music album. So I went and did a little research and was able to write an article that paraphrased what others said so that they could read my article, and not have to watch a video.

    • Nonsense, we all know you come here for Twitter reposts and to download 13.5MB gifs.

  • The path-finding on bridges and walls has always bugged me in the Total War series in particular.

    Like in the C&C video here, you can see the AI favours one side over the other and would probably grind the face of units before using the entire space.

    • The side of the bridge the AI prefers in that gif at the top is almost certainly related to which direction they’re going once they reach the other side. You can see units move left, right or straight ahead once they hit the other side of the bridge so they probably have different destinations.

      I haven’t watched the video to know how they decided to do it back then, but pathfinding these days is typically implemented using a nav volume that weights movement across the area based on terrain penalty or occupation by another movable actor, then sends out probes that calculate the most efficient route. They might preference one side on an empty bridge, but whether they spread out horizontally or fall in behind on an occupied bridge comes down to which option maps to the shorter route. If Total War’s having trouble with that, they probably need to change the weight that actor-occupied areas have in the calculation.

Show more comments

Comments are closed.

Log in to comment on this story!