Saturday, 26 May 2018

Enemy AI

I have implemented a simple enemy AI, based on what I learned last year with the enemy distance based attacks.

This implementation is much simpler, and uses a node which would have probably helped last year had I known about it. This node simply returns the distance between two actors as a float value, no messing about with vector distance checks.

http://api.unrealengine.com/INT/BlueprintAPI/Utilities/Transformation/GetDistanceTo/index.html

The AI chooses a target from available players (up to 4) then checks the distance.

If the distance is more than a certain value, they will simply move towards the target.

If the distance is below a certain value, they will begin playing their attack animations.

The enemy then checks it's own health before continuing or dying if it is zero.

I added a little flash on the corpse when they die to echo the Streets of Rage style game it is. I could probably do this more efficiently with a loop, but I'll leave it for now.