AI jamming

Hi,

so I have this beginner problem…

I am working on an AI system. What it does:

-On sight he runs at me and shoots

-When I shoot to much often in his direction he strafes or is taking cover until he decides to leave the cover

-When he looses sight I gets to the last location he saw me

The initialy run a BT where they all the stuff outside a battle. When the battle starts they switch the BT to a battle BT.

With 2 Enemies it works okay. They sometimes run towards me and stick very very close to me allthough the acceptance radius is at 1000 units at least.

But when having 36 AI enemies I get heavy fps drops.
It happens when I walk around them and some of them losing sight. But it already starts getting bad when they run towards me. The can never reach me, since they are jammed (I guess…).
Here are some screenshots: (if you need more pics, let me know) …

I’m trying to keep everything as simple as I can as a newbie…
Later I want the AI also to decide whether he should throw a grenade depending on whether another AI is nearby the player. …

PlayerLookDirectionService:
Imgur

I count the milliseconds from the first LMB press to the next one to determine whether the player is shooting really often and at the same time calculate the view direction via the dot product. Is that even a good idea ?^^ (Cone check doesn’t work very well. I always needed to be pretty precisely at a certain angle for the cone check to trigger)

The BT :
Imgur
Imgur
Imgur

AI Controller where the AI sets the PlayerLocation when losing sight:
Imgur

And here are two screenshots with the AI making a nice, polite group shot for you guys, lol :

Imgur
Imgur

Sorry for posting so many pictures, but I’m trying to describe my situation as good as I can…
So what am I doing wrong exactly and how can I improve the BT ? Any help would be appreciated. :slight_smile: