On 2/8/2019 at 2:59 PM, Jman2 said:
Hello,
Games like Assassin's creed and various others position enemies around the player in a meaningful way, I have been wondering how this problem is generally solved. The way i solved it in a previous project was to use UE4 EQS with a Backend system to register attackers into a List. They each would request an attack each tick until the system returned a "token" stating they are now able to attack, this was to reduce the number of attackers to say 2 at a time each with there own offset. The attacker would enter an attack radius defined by there min and max attack distance and perform there attack then back off to an appropriate approach radius signifying they were no longer an active attacker.
However im wondering how other programmers have approached this and weather there are any suggestions to improve this system such as maybe using attack weighting to define which enemy gets an attack as opposed to just handing them out in a first come first serve basis. Also the expensive path finding each time the player moves all the AI's have to re-evaluate the EQS points and create a new path to them.
Note: UE4 and EQS are not specific to the question just a background of my exerpeince as this type of system could be implemented in a custom engine or unity etc.
Thanks!
I was working on this problem with a 2 man team, and we went the kung fu circle route that IADaveMark said. Each enemy could enter the circle and recieve a position in the circle. If there where not enough positions, the circle would increase. The problem i had with our implementation is it looked like a 1980's school fight scene, where there were 10 people circling around and 1-2 guy's fighting at a time. I ended up adding logic to allow an enemy to continue attacking for a random amount of seconds, to allow for more of a feeling your fighting multiple people at the same time. Even added a priority system based on rank (which each enemy had). It was great on paper, but in practice, i couldn't have a lot of AI in the scene at one time, and it didn't feel like it was matching the combat system.
The other big limitation i ran into is that i had enemy's of differn't sizes. So like an ogre was in the same position as a goblin on the circle. Even if the attacks cover the same distance, it felt to much like AI on the rails. We ended up scrapping the system for a simple script that made it so the AI would never be within a certain radius, which i configured based on the size of the enemy, and a chance to dodge left/right/back when the player attacked if they where facing each other (collider check before the actual attack). The big advantage was going from something like 15 AI to 50 for the same Frame rate on a build.
One thing i found very helpful was playing assasin's creed, dark souls, Breath of the wild, and try to figure out how there AI works, and how my combat system would work in their games. Dark souls AI for instance still feels tough and smart, but can be replicated mostly by random attacks at random times, and pretty much having a simple combat state that has strafe movement. The biggest thing i ended up wrestling with, was that with the previous system was to manicured, and combat was to controlled, to same.
Really good AI IMHO allows for "Oh Sh*T!!" movements, where it gives the illusion that the enemy is doing something unexpected that either makes the fight easier (enemy's clump up and take a massive AoE) or harder (Enemy combines 2 or more skills into a combo that if you don't avoid will kill you).
Not sure if that helps, but that was my experience.