Sharing Information Between AI


Author: Alejandro Morales




While learning how to create AI in unreal, I came across many bumps and hurdles that I had to overcome. One of these problems was sharing information between the enemies. I want the enemies to attack the player one or two at a time while the rest strafe around the player waiting for one to die so it can take its place. One solution I found was using Unreal Environment Query System (EQS) to gather data. This looked like the right solution but after more research, the EQS is best used for squad behaviors in shooter games. Now I was back on square one and I had to figure out how I would go about it in the next day or two.


After talking with professors and colleagues we were able to come up with a solution that was much simpler than what I imagined. All that had to be done was have an integer that counted how many enemies were attacking the player and check if the number exceeded the number of enemies that could attack the player. At first, I thought of creating the int inside of the AI controller but since this is a multiplayer game I ended up creating it inside of the player class. Then I created a new task that assigned roles, first it checks the variable in the player if it's less than two it will assign the role as engager to the enemy and increment the number by one, then if it's greater than two it will assign the role of ambusher. I also had to decrease the count if the enemy dies and if the player runs out of range. Now my base enemy will attack the player two at a time and if that enemy dies another enemy will take its place. For next week I'm going to polish up the enemy's behaviors and work on a new enemy and a boss.


Leave a comment

Log in with itch.io to leave a comment.