Developing By Me

Project Development and Design

Neural Networks for Groups

Neural Networks [NN] also work well in groups. In part one it was demonstrated how the concept could be utilized for a single mob. However groups react differently. This is because there should be two different mentalities at work. The first is the individual personality and second is the group personality. Each has weight within the mob social structure. This can be treated in different ways however all of which like the individual mob NN AI in the previous article need to be enacted to provide a realistic feel.

First thing to note that is different about group AI’s is that they should be semi-independent. This means that the different mobs should have the ability to interact with the single mob NN or with the group NN. In order to implement the dual AI’s the mob AI needs to know what the group AI state is and be able to make a choice to follow or ignore it based on its own logic. Table 1 illustrates different states for the two different AI types that could be used.

Table 1

State Solo Group
Attack Single True True
Attack Group False True
Independent True True
Dependant True False
Single Attack Type True False
Mixed Attacks True True
Call for help False True

Upon review of the table it is obvious that both the single and group AI’s have similarities. However there are some differences. The examples show that the single AI will not attack a group or call for help. This is because the AI is focused on a single target and does not have any friends to call in. This type of AI is common for a boss or lone mob. However in contrast the group AI has both available. That means that it could split the party to attack several targets and if one target is taking too much damage it can rely on its friends to help out.

In contrast the group AI is not dependant on another AI form. This is because the group AI is the parent AI if both are available. Group AI’s in this example do not have a parent group AI to fall back on if a condition is unknown. However, a solo AI could use the group AI’s states to find a target or help an ally if it returns to an inactive state. This keeps the fight moving when a foe has fallen. The second of importance is the single attack type. The group AI will never have this benefit since it is normally a mixed party of ranged and melee Mobs. However, the solo AI has the ability to isolate a single attack that is highly effective and use that if it chooses.

The concepts of using a group NN AI may seem complicated, but the usage as displayed above has the added benefit of keeping the fight moving. In many games this type of AI may not be noticed because the NPC’s die quickly to over powered players. This is achieved by either greater numbers of NPCs or insane statistics. The idea behind a NN is not to overpower the player but to outsmart him. Most gamers know that the AI within the game is simple and predictable. The group NN has the advantage to change the dynamics of the fight by reviewing the current fight state and adjusting the tactics of its members logically. Table 2 is a typical player team and target order in most games.

Table 2

Player Class Type Target NPC Class Priority
Tank Any 2
Melee DD Tanks Target 3
Ranged DD Stray Targets 4
Caster Group 5
Healer Party 1

The party will typically target the NPC healer then move on to the closest target starting with the hardest to kill and moving to the easiest. This is not always the case the party could split and have some of the group take out the weaker NPCs while the heavy hitters work on the harder ones. These two tactics are used heavily by the players. Since the goal of a NN is to make the NPC feel more human than the AI should mimic some of these methods. The best way to do this is for the group AI to review the individual AI goals. If the group AI has 5 members with 3 going after large opponents and 2 wanting the weaker healer or caster types then the AI could split the party and isolate the biggest threats from the groups.

The first set of 3 would review the player dynamic and choose what it thinks is most likely to be the tank. Those three NPCs would then cycle through their individual combat AI’s to find the most effective attack. Each time one of the group members finds an effective attack type, such as physical attacks, the others will consider the option. If the attack is a preferred type then the NPC will follow suit. However, if it has a different preferred type it has the option to try a different attack keeping in mind that an effective solution has been found. This gives the NPC a fall back in case its preferred is not suitable. It also keeps the dynamic that if an attack is reduced in effectiveness a new attack can be chosen to balance out the difference. A good example is if the party can do both physical and fire based damage but the physical is the more effective then they will perform that attack. But if the player uses an ability that boosts resistance to physical attacks then the group could fall back on the fire attack because it is now more effective.

The second set of 2 will do the same as the first set. But this group will determine which of the caster types would be a bigger threat. If there is both a Direct Damage [DD] and a Healer in the party the individual AI’s will talk trying to resolve which to attack first. If the two AI’s choose separate targets then the group AI will select one based on its table. This keeps the NPCs working as a group to achieve the goal of survival.

From a programming perspective the group NN and the solo NN are identical. The only difference is that as explained above the group can override the solo during a critical decision. The choices of the group should always be to achieve the goal of that group. But it should also be created by the goals of the individual NPCs that create the group. Table 3 shows some common logic that can be used in creating individual target selections.

Table 3

Tank Melee DD Ranged DD Caster Healer
Tank 1 1 2 3 2
Melee DD 2 1 2 3 2
Ranged DD 3 2 1 1 1
Caster 3 2 1 1 1
Healer 4 3 1 2 3

The numbers in the table represent the different target orders that the individual AI’s would prefer. The columns are the attacking NPCs and the rows are the player targets. As an example if there were two teams of 5 members with one of each class the group AI would target. In this example the NPC’s would target in order of Ranged DD, Caster, Tank, Melee, and Healer. However if the table is read the other way they would go in order of Ranged DD, Melee DD, Healer, Caster, Tank. Even though the two different AI’s in this example start with the Ranged DD they cycle through the opponents in a different order. This preferred method of attack can be used to throw off the players expectations because the group AI could choose either method.

In the previous example where the NPC party split then they would follow their own AI’s unless a tie is found. If the party of 5 was listed as above and the Caster and Ranged DD went on their own while the Tank, Melee DD and Healer worked as a group it could look like Table 4 assuming the first method was chosen.

Table 4

Target Melee Group Ranged Group
Tank 4 5
Melee DD 5 5
Ranged DD 6 2
Caster 6 2
Healer 10 3

With the lowest collective number being the first target the Melee Group would start at the tank and end with the healer. On the other hand the Ranged Group would pick either the Ranged DD or Caster then move on. By allowing the group AI to split the team it can create more confusion on the players. This confusion is what will simulate the feel of fighting players instead of static NPC AI’s. It can create the unpredictability that the human mind could use.

The last thing about a Group NN is that it is important to note that the team should be able to change targets at will. This can be generated by a distraction from the players or based on how the fight is progressing. Assuming the healer is keeping the tank alive the Melee Group may choose to change tactics and follow the Ranged Group tree. That will move the whole NPC party in a different direction potentially devastating the player party. But the Melee Group could also decide that the Healer is in the way of their goal and aside from the fact that it would normally be the last target. The group could choose to attack the Healer and upon his death move back into normal rotation. The third option is to call on the Ranged Group. This poses a similar logic question. The call for help could be interpreted two ways by a human player. The first is to focus fire on the current target allowing the group to move on to the next one. The second is to eliminate the disruption created by the Healer. As with the Melee Group this could be done by use of the other groups AI, its own AI or an overriding logic isolating the Healer out of rotation.

The group AI’s have complex concepts however it is important to remember that simple AI logic can be expanded with the basics of a Neural Network providing a dynamic and more humanistic response. The simple thing to remember is that there are two unique AI’s working simultaneously, the Solo AI and the Group AI, these two can talk or argue depending on how it’s programmed but like players they will resolve the conflicts quickly and determine the best solution to achieve the goals of the group. Much like a player group they can either focus on one target or break up to multiple targets which ever appears to be the best solution.

Related pages

  1. Finite State Machines
  2. Genetic Algorithms
  3. Neural Networks for a Single Mob
powered by Related Pages WP plugin

%d bloggers like this: