Slashdot Mirror


Halo 2 Artificial Intelligence Explained

An anonymous reader writes "Stuffo has an interesting interview with Bungie's lead AI developer, Chris Butcher. Butcher explains in detail how the enemies in Halo 2 think and exactly why they do the things they do."

20 of 68 comments (clear)

  1. Sounds like a good approach by ex_ottoyuhr · · Score: 5, Interesting

    I've long suspected that the proper way to handle game AI, and game development in general, is to model things in a manner as similar to the real world as possible... It's also nice to finally have a self-preservation instinct in game enemies...

    Does anyone know if Far Cry used a similar approach? Its AI struck me as very close to Halo's in a lot of ways. (Then again, the whole game was like that...)

    And is the server messed up, or is this a first post? :)

    1. Re:Sounds like a good approach by Anonymous Coward · · Score: 3, Funny

      And is the server messed up, or is this a first post? :)

      It can't be a first post, it had content.

    2. Re:Sounds like a good approach by DrSkwid · · Score: 2, Insightful

      is to model things in a manner as similar to the real world as possible...

      first we model the fundamental particles

      then photons, electrons, neutrons and protons

      add in a few forces, gravity of the planets & stars, expansion of the universe that sort fo thing

      evolve your target planet where your game is to take place

      keep running the evolution software until your required habitats form

      grow some simulated babies and in a simulation of the particular culture of your required characters and find those who are right and agree to be in your game

      stage the game

      or you could just build complicated decision trees that fool the gamer into seeing what he wants to see for considerably less input than modelling the whole universe.

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  2. [partial] article without popups by Anonymous Coward · · Score: 4, Informative

    The linked article is rife with popups and requires one to click 'next page' about 50 times, so here's most of the text. NB - I only got the first 6 pages; pages 7 and 8 came up 404.

    In the Mind of the Enemy
    The Artificial Intelligence of Halo 2
    by Robert Valdes
    11/17/04
    So here I am ... surrounded by pizza boxes, soft taco wrappers, empty beer and soda cans and controllers. I'm tired, and I smell bad. I've finally beaten "Halo 2." I've been ambushed, sniped, flushed out, cornered and just plain beat down by the Covenant more times than I care to remember. In both "Halo" and "Halo 2," the enemy's battlefield savvy is one of the most impressive aspects of the game. The enemies are so much more than just an onslaught of fodder. This is not your daddy's shooter. If you think that a quick trigger finger is going to let you plow through the Covenant in "Halo 2," then there is a body bag with your name on it.

    The enemy characters in "Halo," as with all video games, are driven by artificial intelligence or AI. The complexity of the AI can often make or break a game's level of fun, realism and replay value. Halo is at the top of list when it comes to AI. The enemies react, respond and adapt to the player like real combatants on a battlefield.
    If you're amazed by just how "dirty" the Covenant's "dirty pool" can get in the heat of battle, then you will be interested to hear what Chris Butcher had to say about the artificial intelligence of "Halo 2." Chris is one of four Engineering Leads at Bungie Studios, who are each responsible for certain sections of Halo's creation. Chris created the AI for the original "Halo" and got to expand his work in "Halo 2." Stuffo got a chance to sit down with Chris a few days before "Halo 2" launched and talk about the artificial intelligence of "Halo 2."
    The Basics
    "I wrote the artificial intelligence for Halo 1," Chris explains. "Basically, it is a very specialized type of intelligence. There was a custom piece of code for each character." In "Halo 2," Chris broadened the AI he built for the first game. The first thing to understand about the AI characters in Halo is this: "The AI lives in a simulated world."
    Most first person shooter games, such as Quake or Unreal, are built on a graphical engine. The player is essentially a stationery "camera," and the engine creates the sensation of moving through a world by rendering graphics that create that effect. Halo is different, Chris explains. "Halo is a simulation engine. The engine creates the world, then puts the player and the AI in it ... [The] characters and their code are isolated from the world."
    Each character is written to do certain things, but despite their individual roles, they all function in the same way. It breaks down like this:
    The character uses its AI "senses" to perceive the world -- to detect what's going on around it.
    The AI takes the raw information that it gets based on its perception and interprets the data.
    The AI turns that interpreted data into more processed information
    The AI makes decisions about what its actions should be based on that information.
    Then the AI figures out how it can best perform those actions to achieve the desired result based on the physical state of the world around it.

    "That all works through the same capabilities the player has," Chris explains. This is a key point in how the Halo AI works: Because the characters are forced to perceive the world around them, they are, in many ways, limited like the player by their senses -- in their overall awareness of what is going on around them. This limitation creates more lifelike behavior for the AI characters, as they can be surprised, make mistakes and decisions based on their perceptions of what's going on around them. As Chris puts it, "there is really very little difference between a player and an artificial intelligence character in Halo."
    AI Perception
    Chris goes on:
    "If we were writing artificial intelligence for a robot, we would have to

    1. Re:[partial] article without popups by Profane+MuthaFucka · · Score: 5, Informative

      Just go for the printable version. The whole article on one page. No popups either, because I'm running firefox.

      http://stuffo.howstuffworks.com/halo2-ai.htm/print able

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
  3. AI by MyLongNickName · · Score: 5, Interesting

    It is interesting to see how much work is required to get something that simulates 'common sense'. Note how much 'tagging' was required to get a character in a controled environment from point A to point B in a logical manner.

    Now take your average FPS player. He is able to look at the terrain without these tags and make a coherent game plan. Leave one tag off of an object, and that AI player is suddenly trying to do something impossible and not able to make a decision to try a different tact.

    AI has certainly improved. I can't even begin to guess how many single player games have been destroyed simply because I found an explotable AI weakness. What will make AI really good is when it can adapt strategies when it has consistently lost.

    --
    See my journal for slashdot ID's by year. Mine created in 2005. http://slashdot.org/journal/289875/slashdot-ids-by-year
    1. Re:AI by mrdogi · · Score: 5, Insightful

      Humans 'tag' as well. We just do it much faster (with experience) and have years of experience to help with that tagging, both in speed and in richness of tagging. Although, I suppose we also get superfluous tagging ("What idiot painted that box yellow?") to distract us a bit.

    2. Re:AI by gothzilla · · Score: 4, Funny

      We also can make a lot of mistakes in our tagging.
      "After looking at the angle of that corner up there, I calculate that I can take it in my Ferrari at 82 mph without losing control."
      "I can jump over that fire hydrant without smashing my nuts."
      "This gun isn't loaded so it can't hurt me."

    3. Re:AI by Osty · · Score: 2, Insightful
      Ahh, humans tag, if you will, but they do it dynamically. If we were like an AI, we'd need someone to go around in front of us painting things orange or red or green so we'd know where to go.
      What would be great would be to have an AI that can tag terrain dynamically and decide which is the best place to go based only on what it can "see". That way you could design any map, random or planned, and drop an AI into it and have a great game. Unfortunately what happens is that the game developers plot out all of the paths and areas and points of interest for the AI before the game starts.

      Actually, a lot of things humans do have been pre-tagged. It's just that we can apply one set of tags from one situation to a new situation and expect them to work relatively well. As an example, look at driving a race car on a track. For a given driving style, there is an optimal line to take on the track for best speed. If you put a human in a race car on that track for the first time, with nobody helping them, they have to go through many laps of trial and error to find the line (level developers tagging things). If instead you put an experienced driver in the car, but kept this as his first time on the track, he'd be able to apply sets of tags from other race tracks to similar turns on this one. It won't be perfect, but it gives him a good place to start (level designers learning how to tag levels for AI, becoming more proficient). Now if you put an instructor who knows the track in the car with driver, and put down cones on the track for braking points, turn-in, apex, and exit points, most drivers will be able to turn flawless laps almost immediately (they'll still have to work up their speed, though). That's equivalent to putting an AI into a pre-tagged level.

      It's not much fun watching someone drive a race track for the first time (it's fun doing it, but not watching it). Most people prefer to watch the actual race, filled with drivers who know what they're doing and who know the track. It's more fun that way. Similarly, you don't really want to spend your time running around with the AI while they learn a level. Therefore, the best thing to do is to pre-tag levels so the AI already knows what to do. Alternatively, you could use a learning AI, but you still need to spend the time up front to teach the AI the levels before you ship. If you build a new map, it's up to you to train the AI and provide that information when you ship the map.

  4. Re:Could someone explain... by mrdogi · · Score: 3, Insightful
    I suppose something like this...

    In Quake, etc. the creatures just stand around until you come into their field of view (or they come into yours, I suppose), then attack.

    In Halo 2, they can look around at the start of the game, and then start banding together, or exploring until they find you.

  5. Wow by dretay · · Score: 2, Informative

    I was very impressed by the depth of understanding that the AI showed in HALO 2 before reading this article. What I found particularly interesting is the "Uncanny Valley" problem whereby the AI becomes very life like and then, when it does something inhuman, it just becomes creepy. I have never personally experienced the problem, but I have a friend who refuses to play certain games for exactly this reason.

  6. Re:Could someone explain... by gothzilla · · Score: 3, Informative

    The difference is that Quake and Unreal have a single universe, so to speak. The walls, objects, and enemy characters are all part of the same engine and rendered at the same time. Walls, boxes, and monsters were all part of the same code and were handled the same way with the same engine physics.

    Halo 2 creates 3 separate entities. Instead of the enemies being part of the world and rendered at the same time with it, they are now a separate part of the game and don't share any code with the landscape, walls, etc. The game first creates the world, then it creates the AI totally separately and puts them into the world. Basically you have one engine that controls the world and another totally different AI engine that has to interact with the world engine.

  7. Re:Could someone explain... by Relic+of+the+Future · · Score: 4, Informative
    In many games, the NPC/targets/AIs/whatevers are just another object, like a brick, that gets dropped into the game world. For Halo 2 though, they made them just like any other player, only instead of taking their input controls from your xbox controller, they take them from a piece of code. Instead of having that code look at an image on screen (like you as a player do when playing the game) they instead examine all of these tags that exist in the game world; where you see a clump of pixels and think "wall", the AI has been told "cover.value=+2.8", and can react accordingly.

    This approach allows for the AI to react much more realistically and intelligently with the environment without requiring an impossible amount of effort. It also allows improvements in the AI code to be isolated from the design of the levels (as long as the rules of this "tagging" interface are obeyed by both sides of the programming aisle).

    I wonder how much of this tagging was done by hand, vs. how much was done by automated analysis.

    (As an aside, the grav-lift on Collossus needs to be turned off for CTF, Assault, and Oddball games. Am I right?)

    --
    Those who fail to understand communication protocols, are doomed to repeat them over port 80.
  8. Re:is halo2's ai that good? by Hassman · · Score: 2, Interesting

    Yea, they seem to use a lot of covering fire as well. The elites will pin you behind a wall with constant fire while others advance on your position. Pretty cool stuff.

    --
    -Mark
    Dovie'andi se tovya sagain.
  9. It is a different approach basically by SmallFurryCreature · · Score: 3, Insightful
    I think it was a recent star wars fps where I was stuck so I switched of clipping and drifted through the walls to see where I was supposed to go. Bit of a suprise when I saw myself standing somewhere. It was the setup for a cutscene.

    Basically in a quake like game wether it is half-life or quake itself the game centers around the player. The player is the center around wich the world moves. Until you move and trigger something wether it is AI or a scripted sequence the world will remain static.

    In a simulated world the world will go happen wether you move or not. A very good example is MS flight simulator. With the proper settings if you start the game you are sitting on the ground at an airport. But as you sit there you can see weather patterns moving. Other aircraft taking off an landing. Air control giving instruction to ensure seperation.

    Note that this is purely an approach to how the "story" in the game is developed. You could easily use the quake engine to create a simulated world and use MS flight simulator to create a trigger driven story game. In fact they exist.

    So halo has the same kind of graphical answer as quake. What is different is how the population changes. It seems that the halo makers claim they have a more MS flight simulator like approach where the AI does its thing even if you just stand at the start. Note that in the recent MS flight simulator you are part of the AI as both air traffic control and other aircraft react to you (sometimes).

    It should be easy to check if there is an invisible mode/no clipping mode in halo 2. If they are right then you should see that enemy walking around and chatting long before you have walked along the corridor and triggered them to do their stuff.

    Personally I think Halo2 is a cross. A true simulated FPS would have far more of a realistic combat mode as you would be on a battlefield with a battle going on and you would be just one of the soldiers. If you remember Call of Duty then think about the russian square assault. While their is obvious AI going on the AI is totally incapable of achieving anything. You score the majority of kills and you "unlock" the next bits in a level.

    If Call of Duty had a simulated world then you could just sit to the side and slowly see the AI on one side win. F16 falcon had this to a certain degree. It was a very realistic combat flightsim and I sucked at Air to Air. However as long as I setup the right mission where I bombed and had my wing mates cover me the AI would do the job. One time I started a mission but had a call of nature. The rest of the flight started in the air and the base was attacked. As I was sitting on the toilet I could hear my wing engaging the attacking flight and shooting them down. All without me even having touched the controls. That is a simulated world.

    So is this the future? Well for some games. Imagine if you played a simulated RPG. If you then went to the toilet and let the game running a NPC would pick up the role of hero and complete the story quests. Hmmm.

    Imagine in Halo if it was truly simulated world. If you take the wrong turn your AI buddies could very well have completed the level while your trying to find your way back.

    Flight sims and realistic combat games might be fun with truly simulated worlds. FPS ala Halo are perhaps better when the player is the hero who triggers events. Some simulation can take place but do you really want the intresting bits to be done by the your AI buddies?

    Half-life is a scripted STORY engine. Halo claims to be a simulated STORY engine. The graphics are exactly the same. They choose the wrong words.

    --

    MMO Quests are like orgasms:

    You may solo them, I prefer them in a group.

  10. Re:Unamazing AI by AzraelKans · · Score: 4, Insightful

    Well.. you have to remember a few details before judging, first of all halo 2 is all about battles, so you would expect they expent more time on that than say "conversations" or other nuisances and on that level both as partners and as enemies the AI acts pretty convincingly. Second, halo2 is definetily a lot larger and complex than half life.(not HL2 though) so is a lot harder to coordinate the AI and place tag points effectively. And 3rd the AI in a console game expending so much cycles in a console in network and graphics code, can only be good enough to be believable, but cant expent so much cycles to be "ground breaking" so their target was believable and enjoyable and I think they got that right.

    I havent even noticed before reading the article but the enemies DO talk to each other (in english) before teaming up on your poor butt. Thats an interesting detail to watch (although it ussually ends with you dead in the ground).

    Oh I almost forgot, you have to play in the "heroic" dificulty level to see what the AI can really do. The easy and normal levels are quite dumbed down in comparison.

    --
    Go ahead MOD my day!
    More opinions here
  11. Re:is halo2's ai that good? by bar-agent · · Score: 3, Funny

    It was only when I realized that he would step from behind the box to start firing at my friend (still ignoring me) that I realized it was an enemy.

    Maybe it was thinking the same thing you were. I guess that's some pretty advanced AI!

    --
    i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  12. Re:Could someone explain... by ajd1474 · · Score: 2, Interesting

    The best way to see this is when you are involved in the three way battle between Covenant, the Flood and the Humans (when you are the arbitor).

    Each time you enter an area there is a battle going on between the humans/flood/covenant. Most games the action revolves around you triggering something. Halo 2 (and similar games) have the world and its players acting out their own story. You could stand in a corner and just watch the battle unfold. This is useful when you come up against a bunch of sentinels and flood... just let them battle it out, then waltz in a take out the winner.

    The AI treats all enemy forces the same way, and as such you become just another player in the battle. It is also noticable when you die, in a lot of games the AI simply stops once you're dead, because you are the trigger for every action... in Halo 2 they just keep on fighting each other.

    It means the world feels much more real, because all this is happening "around" you, and not "because" of you.

    --
    I refuse to have a sig... dammit!
  13. AI level = Difficulty level by MMaestro · · Score: 2, Interesting
    On Legendary I've seen the AI do some crazy things they never do on Normal or Heroic. So far out of the ordinary, I've seen marines press their backs against cover and peek around it before attempting to fire. I think grunts attempt to use grenades to blow away your cover, but that might just be flushing out techniques. I've had elites try to 'bait me' by letting one come out in the open and having the others stay hidden until I tried to take the bait. And of course, they flank you. A lot.

    I haven't tried any missions where there are jackals, hunters, flood, forerunner drones, or *spoiler* brutes yet but I'm guessing they have their own tricks. Oh and before you question what I saw, on legendary there are LOTS of situations where you're against 6+ elites at once so you see their tactics quite often.

  14. Re:Could someone explain... by tenaciousj · · Score: 2, Funny

    where you see a clump of pixels and think "wall", the AI has been told "cover.value=+2.8", and can react accordingly.

    That's because the AI has freed its mind.

    The Matrix has you Relic of the Future.