AI for Framework Mobs
While working with educational material for The Game Assembly I Took the opportunity to expand the basic behaviours of some mobs I developed and at the same time picking up some additional knowledge of AI. In the two mobs on this page I have used Enviornmental Quary Systems (EQS) to add flexibility to a basic guard AI and I’ve used Animation notifiers to get make animations guide if the player gets hit by a melee enemy.
The Mobs are also used as Mobs in the Spline Controlled AI Boss Scenario
A ranged Patrolling Guard with Cover Behaviour and EQS
A melee Monster using animation notifiers embedded in the animations
Created in Unreal 4.21
The Patrolling Guard
The Patrolling Guard is a classic AI and for the students to use such a asset when working on assignment would be useful to the learning process.
While the basic behaviors would not be the most interesting project to set up I decided to make parts of the Behavior Tree use a EQS to generate locations.
For the Guard I also created a patrol point system and a cover point system. The cover point system was in a way created as an assurance if the experimental EQS system did not work as planned. But in the end I could integrate the date from the cover points in the EQS.
Behaviour Tree with EQS
While it is still labelled as a experimental feature in Unreal 4.21 the EQS works fairly well. The documentation is somewhat lacking and one has to be prepared do some thinking. I decided to use the EQS for two occasions one what when the Guard panic behaviour kicked in the other was to select new cover points. My reasoning for this was that I wanted to include both the actor pick and the grid based finder of the EQS system. The pictures below show the debug feature of the EQS queries.
Additional Work and Debug
In order to make the AI a bit more fun I included some animations such as reloading, crouching and death.
With these features added the Guard could work as a rough prototype for a guard.
To make it easier to follow how the cover booking system worked when several AIs were running a simulation at the same time I added some widget debug features on the Guards and the cover points.
Melee Enemy with scripted notifiers
The Melee AI uses a fairly standard behavior and detection. It is roaming around until a player is sighted and the charges for an attack. In order to make it a bit more interesting I scripted in a stun animation that triggers after taking heavy damage. Play testing I noticed that the attack animation was quite slow and in many occasions the player had moved away after the animation was completed. In order to make this more realistic I added Animation Notifiers and scripted the damage to be dependent on the player being close to the blow.
Melee Enemy Behavior
The general behavior of the melee enemy is left intentional quite simple. The point of this is for the users (in this case the students) to have something they can use in a shake and bake setting to try out various designs. The simplicity of the behavior made the melee enemy quite easy to integrate as a spawned enemy in the Spline Boss Scenario.
Conclusion and Lessons Learned
While to AI of the two mobs are not the most complex I still had fun designing and scripting them. The EQS system, with the lack of proper documentation, was the most challenging part but also the most rewarding. If properly implemented EQS can be quite powerful but I definetly think a more thorough profiling than the ones I tried is needed if it is to be used.