Saturday, March 05, 2011

DQ VI の A.I. (第一章&第二章)

I read an article the other day about computer AI playing StarCraft. While the topic is on computer AI as a player, it reminded me the computer AI I encountered recently playing Dragon Quest VI.

In chapter one, a very cute healer slime joins the party and enters battle with the Soldier. However, the healer slime isn't controllable and acts on its own. Here, the healer slime is smart enough to know when to cast Heal on the Soldier and itself, but not overdoing it so it runs out of MP.

In chapter two, the party starts out with three player characters so the individual action is directly controlled. But because of the way enemies are grouped in Dragon Quest (I think it's the same for DQ III if my memory serves me), AI comes into play during battle.

When there's multiples of a type of enemy, they are randomly grouped into single individuals, one big group, or smaller groups of 2 or more. This affects how you fight unless every single one of the party member is able to defeat the enemy in one strike.

When the enemy gang is recognized as single individuals, you get to choose who to hit which one to maximize on the damage. This way, you can defeat 1-3 enemies depending on the level gap between your party and the enemy.

When the enemy gang is recognized as one group or as smaller groups, you can only choose which group of enemy to attack but not which individual enemy to strike. This starts to create some issues with the widely different attack strength and speed of the party members. Bad AI would result in dragging out the battle longer than necessary and causing the party to sustain more damage.

Here's what I observed in terms of how the AI handles who hits which enemy in a group situation.

In the case where only the Princess (the fastest of the three) can kill the enemy in one strike, the other two would attack the same enemy, whose combined effort is usually enough to terminate the target. Even when the Priest (2nd fastest in speed) moves first, the Princess would attack another enemy so the first enemy can be finished off by the Mage, resulting in 2 enemies down. This is effective AI.

In the case where combining the Priest and the Mage isn't quite enough to defeat the enemy, the AI would determine that the enemy is too strong for the two and moves the Princess (the fastest thus the first to move) on the same enemy. Ideally, the Princess would just defeat another full-HP enemy and the Priest would finish the critically low-HP enemy. But here, the strongest attacker is wasted on a near-death enemy, and the other two might not be able to defeat another one on their own, resulting in only 1 enemy down and the cycle repeats.

It would be nice if the AI keeps a statistics on the character's record and be able to tell if the character can defeat certain enemies with one blow, then move the characters accordingly to limit damage from dying but still standing enemies (hurts the same as a full-HP enemy). And if there's no record or low ratio of the character defeating the enemy in one strike, have them gang up against the enemy.

Overall, I think the AI for DQ VI on NDS is pretty decent. I still remember the frustration I experienced fighting random battles in DQ III whenever the AI did something foolish. Not sure what other type of AI I would see in the chapter 4 & 5 of DQ VI. Hopefully it'll be smart AI. That would make my job saving the world a little easier. XD

0 comments: