# Improved Belgian AI Algorithm for Dynamic Management in Action Role-Playing Games
## 2 Belgian Artificial Intelligence Algorithm
BAI has a sounder mechanism and better adaptability compared with kung-fu circle, but it still has much room for improvement. According to the detailed analysis with combined research methodologies, the flaws of BAI can be concluded as below:

1. BAI holds the enemy in the form of eight rectangular grids, each of which can hold only one enemy and cannot be adjusted adaptively according to the specific game mechanism. Additionally, the interaction area between enemies and the player in the four grids at a 45-degree angle to the player is significantly smaller than the ones at a 90-degree angle. Moreover, BAI can only manage melee attacks rather than ranged attacks. 2. When multiple enemies register requests to attack the player simultaneously, the stage manager will reject them even if the player's CGC is large enough and the sum of these enemies' GW is greater than the player's CGC. Additionally, when the number or position of enemies that have gained the attack right changes, the position where enemies that have gained the attack right before the change may not be the closest attack position after the change, or the enemy that is not assigned has already been in the grids after the change, but its position conflicts with the position where enemies that have gained the attack right before the change. The enemy may possibly not gain the attack right. 3. In case the enemy is authorized by the stage manager to attack the player, it will use an attack type to attack constantly until the number of enemies that have gained the attack right changes. Furthermore, it is impossible to prevent the same type of enemies from attacking the player with the same attack type simultaneously, which will reduce combat diversity and game balance. ## 3 Improved Belgian Artificial Intelligence Algorithm

Based on the definition of variables and the stage manager in BAI, IBAI is proposed to include three components, melee-ranged buffer-pursuit (MRBP) ring model with DDA introduced, grid priority (GP), and real-time induction and distribution (RID) algorithm, as well as attack weight threshold (AWT) and global cooldown (GCD). ### MRBP Ring Model

In action role-playing games, enemies usually own some common behaviors and attack rules. It means that enemies using melee attacks and ranged attacks can share the common behavior set of ones with the same type. This design pattern adds behavior reuse to some extent [30], thus, the MRBP ring model addresses the problems of BAI. Compared with BAI, which uses rectangular grids to hold enemies, the MRBP ring model is a player-centric four-ring one (shown in Figure 2). The rectangular plane coordinate system is created with the current position of the player, where the directions of the x-axis and the y-axis are determined according to the game world, which does not change with the orientation of the player. Four circles with the radius of \(a\), \(b\), \(c\), and \(d\) (\(a<b<c<d\)) are created with the player at the center, melee circle, tanged circle, buffer circle, and pursuit circle, from small to large. The four ring areas, from the inside out, are the melee area, ranged area, buffer area, and pursuit area. The outer area refers to the area outside the pursuit circle. The authors rotate the y-axis clockwise by 22.5 degrees,

Figure 1: Combat example. 67.5 degrees, 112.5 degrees, and 157.5 degrees, respectively, to form four straight lines along with four-line segments. The melee area, ranged area, and buffer area are then equally divided into eight sectors. In the model, the melee area and the ranged area are utilized to hold enemies using melee attacks or ranged attacks that have gained the attack right, respectively. The buffer area is used to hold enemies that have not gained the attack right, while the pursuit area is for the ones that are pursuing the player. The radii \(a\), \(b\), and \(c\) of the melee circle, ranged circle, and buffer circle are fixed variables, and \(d\) of the pursuit circle is dynamic.