Post-Play'em - Observations on Game AI

Posts Tagged ‘utility’

Skyrim AI Weapon Selection

Saturday, January 14th, 2012

Say what you want about Lydia and her lack of pathfinding prowess, she does do some things right. The problem is (as is the case with all good AI), unless you are looking for it, you might not notice.

Early on in my relationship with her, I had noticed that she would switch between her bow and a sword. Later on, as is part of her duty (which she will remind you of in her sarcastic, resigned drawl), I had given her a bunch of stuff to carry for me. That included a few different weapons and 3 different magical staves with varying abilities.  During a combat, I noticed that she was using a paralysis staff to disable a mage we were fighting. After knocking his ass to the ground in such fashion, she joined me in whacking him into oblivion (not to be confused with “into Oblivion”).

I’ve seen her in other situations use the paralysis staff, switch to using two other more offensive damage staffs, and then pull out an axe in place of one of the staffs… all as the situation warrants and all in the same combat sequence. This is something I’ve  been looking for in games for quite some time.

I haven’t been able to completely discern whether she is using a specific rule-based system or if there is some sort of underlying utility model at work. I would tend to say that it would be at least a portion of the later. That is a model that is far more expandable which is necessary when you include the number of potential weapons (and other objects, I’m sure) and potential factors to consider. If I notice more, I will mention it.

Skyrim: It’s a Free-for-All!

Sunday, January 1st, 2012

Just had a battle out on the plains west of Whiterun. It was bad enough that I got jumped by a dragon. Then, the dragon flew a ways away and started chillin’ a nearby mammoth. Lydia and I continued to take potshots at Mr. Dragon (Mrs. Dragon?) while the mammoth ineffectually stared down its assailant. Eventually, the mammoth started running (right past me and Lydia!) and the dragon seemed to give up on it.

Unfortunately, I soon realized that there were a couple of mages wandering around the area who, for some reason, apparently decided that Lydia and I were far more menacing than the circling beast. And then there was the skeleton — who may or may not have been the product of the mages who started attacking me. By the time I dispatched the skeleton, the dragon had gotten bored with whatever it was he (she?) was fighting nearby and came back to visit. This all came to a rather unfortunate end… but that’s not what I came to tell you…

“There seems to be a serious lack of proper prioritization of targets.”

The point of all of this is that there seems to be a serious lack of proper prioritization of targets. For example, despite the fact that a mammoth might look awful tasty to a dragon, said morsel is not going to be able to attack you. Better to dispatch the pair of annoyances that are pumping arrows into you and come back for the hairy buffet later.

The same can be said for the mages. If there is a dragon cruising around, it seems rather silly to attack two relatively harmless bipeds. In fact, the chances of defeating the dragon (and therefore surviving) would go up considerably if it was attacked by a group rather than by a couple of individuals. An additional bonus would be that the dragon might take such a toll on your secondary opponents that it leaves you an advantage you might not otherwise have.

Obviously the target selection algorithm doesn’t take a lot of this into account. It’s really a matter of mathematical modeling. Ironically, it is the same sort of modeling that goes into non-combat games such as The Sims. The good news is that it is relatively simple to put together and can adapt to pretty much any situation that your NPCs find themselves in. It can also be  tied into the entire combat selection system so that the possible actions could include not attacking anyone at all (even running away, if necessary).

For those that are curious as to how such utility-based systems can be built, it is pretty much the entire point of my book, Behavioral Mathematics for Game AI.