
Baldur's Gate III Monster AI Analysis
Author:AI Design Master Ziming Wang
Contents
1. AI Design Policy
To make AI act like real people, AI can cooperate with and support each other, and AI behavior matches the image of the character itself.
2. AI Design 0 to 1
2.1 Preparation
What information does the AI need to “gather” to guide his actions when he starts his turn?
- Where are the enemies: Find the location of each enemy. Note that to make the battle more realistic, the AI is not going to see the enemies outside the view range, but can hear the movements of the enemies outside the view range. If you hear the enemy’s movements, then the equivalent of the AI knows the direction of the enemy, and the enemy will try to move in the direction of the enemy when the action. (Of course, if the monster has a higher priority movement command, such as to sound the alarm or to escape, it will not do so. This is the part that will be expanded in the section on AI behavior types.)
- Where are the teammates: The AI knows the location of all teammates by default, which is equivalent to the information in the player’s way.
- Where are the teammates: The AI knows the location of all teammates by default, which is equivalent to the information in the player’s way.
- What do I do and how do I do it: After determining the goal of this action, the AI needs to decide what to do based on its current state. This is the most important point to make the AI look better and act like a real person, instead of moving first and then judging how to do it. To make this clear, it is important to talk about the “cost-effectiveness of action” of AI.
2.2 “Cost-effectiveness of action” of AI
The AI will judge the impact of all the behaviors andtake the best one as the logic of this turn·
As an example: the AI is a goblin mage, he knows 3 kinds of spells: arc, fireball, and arcane missile. The enemy is only one person, and this person is standing on the ground of oil (oil can be ignited and exploded by flame attacks, or flame spells), the cost-effectiveness of the AI’s actions is analyzed as follows.
- Arc can cause 4-8 points of damage, need to move 10m (distance enough), hit rate of 80%, after hitting the player turn will be additional 1-3 points of damage
- Fireball can cause 3-6 points of damage, hit the player needs 8m, hit the oil needs 7m, oil explosion damage is fixed to 10, every round of continuous burning 2-4 points of damage for 3 rounds, hit the player 70%, hit the oil 100%
- Arcane missile deals 4*(1-5) damage, hit player needs to move 5m, hit rate 50%
AI has three ways, then according to the judgment, the fireball hit the oil, lets the oil explosion will cause more damage to the enemy, and the arcane missile although the damage cap is higher, the hit rate is lower, not cost-effective.
Therefore, in this example, the monster would choose to move 7m and use the fireball spell to attack the oil, dealing 10 points of damage to the enemy.
For another example, it’s the same example as above, but with a goblin warrior beside the player, a teammate of the goblin mage. If the point is fuel, the teammate will also take the explosion damage. So what would the goblin mage do at this point? He will move 5m and release the arcane missile. Because at this point, the act of point fuel explosion is less cost-effective, andnot conducive to the big picture of the battle.
But it’s worth noting that the AI doesn’t need to think about the big picture so much as humans do in Go, thinking about the behavior of the next three or five turns on the current turn. Designers can do that, but it can make for a bad experience: your players are likely not as smart as the AI and can’t see why he doesn’t do that this turn. So for now, it’s enough for the AI to think of behaviors that will benefit the next turn and use that as a guide for behavior this turn.
2.3 Design AI Behavior Types
In Baldur’s Gate III, the AI behavior of monsters is divided into external AI and internal AI.
External AI: AI behavior during non-combat scenarios, usually patrol, standby, guard, relax, and other routine behaviors.
Internal AI: AI behavior in the battle scenario, is divided into aggression (the goal is to kill the enemy), support (to provide gain for teammates as the highest priority), and tasks. (to perform the tasks given to the character as the highest priority)