Monday, June 05, 2006

Game AI Advanced Degree

well, I was hoping not to make this post. Really, I was. (and it's late as it is)

but the game AI in Oblivion is way too heavy on the "A" and too light on the "I". The NPCs continue to be phenomenally stupid--really no improvement over Morrowind. So instead of "Artificial Intelligence" we have "Superficial Intelligence" or "Artificial Stupidity".

You recall in Morrowind that the NPCs were stupid like this: you would find them all outside bopping around on their random walks in the town square, in the dark, at 2am, in the rain. And they'd still be there 12 hours later. And a month later. Doing the same random walk, bopping around the town square. Unless they were executing a scripted sequence, which few ever actually did, or if they were attacking something, equally rare. Really brainless.

Well, in Oblivion, many characters have a bit more scripting, but that's all the smarter they are. And you can't make them be any different (well, you can, but it's a game mod; there are a couple of mods available that alter some behaviors--but you can also read that they may be "unbalancing"--if that's true, it means their control mechanism is flawed). In the towns, NPCs have houses they might go to, and then go to bed. You can actually see folks lying in bed; you can wake them for a conversation, but they will go back to bed when you finish. In the morning, they will walk to work. Ok, that's decent scripting, FAR better than Morrowind.

I hated having a sidekick character ever, in Morrowind, even just to escort someplace, because that NPC was still going to run towards a fight if one was available. So in order to do an escort properly, you'd have to talk to that NPC, and tell them "Wait here" and then go clear the route to the destination, then come back and escort safely, because if you didn't and a really difficult opponent was in the middle of the travel, your escorted NPC was going to run to fight that opponent, instead of letting you lead the fight or do it solo, or walk around the problem. One NPC I had to escort I was able to tell to wait, but then I was never able to get it to follow me to the delivery location--not even an option.

So your typical effort with any sort of sidekick was much more oriented around preventing them from doing something stupid--which would mean YOU have to run towards the fight, faster than the sidekick/escortee, which I seldom wanted to do.

Nothing much changed in Oblivion, the NPCs are just as stupid. Same exact thing happens. And the sidekick won't sneak when you do, or have any of your special skills. It'd be one thing if you could have a sidekick early, train them the same way you train, and have them sneak and not attack when you sneak and don't attack. (Neverwinter Nights is a little better about this, but not much.)

But that's not what happens. Conveniently, when you get the assignment about the Black Bow Bandits in Leyawiin, Mazorga the Orc says "I'll wait here until you say you're ready to go", so that you can go clear out most of the danger and then go back for her. Otherwise, since she doesn't sneak, your doing so won't accomplish much, she'll run into the fight in the cave and get overwhelmed--because there's no "I" in the NPC "AI".

I guess doing this well really does take an Advanced Degree (tm), and it seems no one over at Bethesda has one. GAH!

This is really bugging me at this point. I know already that I'm going to have additional tasks in the future in this game where I'm going to be part of a team where I am the only smart player, and the others will all get killed because they don't know how or when to be careful. Dungeon Siege was better about this in the you could at least click down a retreat path and your team would follow, and there were easily-changed control settings about the team's basic tactics; I don't remember them applying to summoned critters, but really, who cares what they do? At least with DS 2 you could put Healing Hands/Wind as an automatic spell, and not have to worry about it too much.

The other thing that bugs me and happens a lot more often (not too many sidekicks in Oblivion) is that when you summon a helper, that helper can't see opponents even if it is standing right next to them unless/until they move. So your summoned thing might not detect an opponent until its 30-second lifetime is almost over. GAH! I summoned it up close so it could attack immediately, not stand there waiting for some motion to detect. Granted, I'm the one with the Helmet of 100-ft life detection, but surely a summoned thing can detect the opponent that is 3 feet away? If I attack the thing they're standing next to, they see it right away, but that's exactly what I want to avoid.

I can create better NPC AI than this. Will the game let me? Do I even want to bother?

I ask because while you can define some NPC actions, if their decision-making/control scheme is inadequate, there's a good chance that there will be unintentional conflicts between actions/goals.

How this ought to work: a character should be able to have any number of goals, in various states, just as you do in your journal. They can be active to different extents, and there can always be background goals. Goal priority can change over time, sometimes in non-obvious ways. Example: a character could have a goal to eat twice a day, once in the morning around 9am, and once later around 7pm. The urgency of completing those goals would be low, depending on what else was going on, and there should be some time flexibility, so breakfast could be from 7am to 10 am, and dinner from 5pm to 9pm. There wouldn't be any real urgency about the meal goal until time was running out at the end of the day (figuring you can skip breakfast, but not dinner). The problem that could arise is if the character has a scripted behavior between 5pm and midnight, and violating it by going to eat breaks the script. This is where a more complex script control is needed, so that character can make a dynamic decision about eating. The script for eating would have to be lower priority than others, and a quest-related required activity would be higher than most others. Probably max priority is self-preservation, so that a character under attack focuses on battle. You can read more about this in various texbooks under "hierarchical planning"; there really is a lot of past work on this general topic.

If you play a while, you will see a few interesting behaviors, but not as many as you should. I've seen characters (just today, in fact) walk past a weapon, encounter a critter, run back for the weapon, pick it up, and use it on the critter (thus protecting me, albeit unintentionally, the critter was chasing me). That was clever. Saw one run down and kill a deer once, not sure why.

But what you don't see, for example, are NPCs healing themselves or each other. Opponents don't do this either; in one sense this is good, because it means that you can wear them down on an ongoing basis, and you can heal yourself while they cannot, giving you an edge, if you are evenly matched in a battle.

I have not yet investigated TES Construction Kit to find out what's possible. I'm going to have to. (later: well probably not, other games to play, not enough time to waste on figuring out this one if I'm not getting paid for it :)

I've read that in Half-life mods there are some very good squad behaviors, where opponents will take cover, support each other, execute group actions, etc. I'm pretty sure I'm a better squad leader than the default battle behaviors in Oblivion.

------- some months later ---------

I've started playing NeverWinter Nights 2 just after Thanksgiving. There are some seriously stupid behaviors in this, too, which are ultimately worse because the game requires you to have a large team the entire way through because of the quantities of opponents in groups (well, you could mostly play solo, but that's a guaranteed path to failure pretty quick).

Where the teammates are stupid:

1) they run towards fights. well, this isn't unusual, it seems. you can arrange to micro-manage your teammates, but I am not interested in doing that. I AM interested in telling them to stand still, stay behind me, etc. Not possible.

2) doorways are a disaster. entirely too often I have found that I have characters stuck in doorways, because I have a character that is blocking the doorway because it is being attacked and the one behind can't get through or help. This happens a lot.

3) they won't retreat when I do. When I run somewhere, I don't care what they are doing, I want the team to follow me. Always. No exceptions.

4) the NPC behavior is, in general, about equal to Morrowind. Most of your NPCs are doing the random bopping around town 24/7. Merchants are awake nonstop.

-------------

Where they are smarter:

1) the dialog trees are better all around, and the overall story is more complex. Morrowind had a complex story, TOO complex, I thought, and the "journal" did a lousy job of keeping you informed about what you needed to do. I didn't play for a while, forgot what I was up to, and ended up just stopping permanently (except for a couple of returns to test ideas).

-------------

I am going to be thrilled when I can play a game where the NPCs really exhibit intelligence (and no, I don't mean by playing in an MMO).

I'm available if someone wants to hire me to solve this problem. Please!

No comments: