Friday, 2 November 2018

AI: Zombie Character

Zombie: Mixamo
Animation: Third Person Template
Animation Retarget

To set-up a zombie, I found a zombie character in the Mixamo Character Pack that I could use for visuals. I created a new project in Unreal so I could gain access to the Third Person files for the animated character.

Using the Retargeting Animation technique as before, I created an animated zombie. It does not currently have animations for a zombie and runs human-like. I hope to change this in the future, but I was unable to find any free zombie animations at this stage.



To begin with, I went into the Volume tab and located the Nav Mesh Bounds volume. This sets up a perimeter for the AI to move around in.


In the ThirdPersonCharacter blueprint Viewport, I added a PawnSensing component which will allow the detection of the character. The peripheral vision angle representation is visible on-screen, displaying the vision the AI will have in terms of detection. By default, it is set to 90, but for a better sense of realism, I will use around 70.


In the Event Graph, I have used a node to use the PawnSensing that I previously set up, which searches for the First Person Character, which is our player. Then using a node to specifically move the AI targeting the player.

This enables basic AI functionality, resulting in the zombie chasing the player as long as we are in range. At this stage, the zombie simply chases the character, and does not proceed to do anything else, or have a sense of life.


I have set-up two variables to detect whether the zombie is InRange of the player, and whether it IsMoving, both being booleans.

Every tick it is checking to see whether it is in Range, and whether it is currently moving. If they are both false, then we tell the AI to move to a random location within a set radius. By setting up the Delays and Sets, it means there will be small pauses between random movements and we are ensuring we are tracking whether the player is moving or in range of the player.


Previously, I set up a damage volume which inflicts damage if the player is within the box. I have duplicated this and made it a child actor of the Third Person Character (zombie). Which means it follows the movement and inflicts damage when it has caught up to the player.

This is mainly for testing purposes, but could potentially be used as a method to damage the player with a longer delay between hits. If I manage to implement animations, specifically attack animations then I will need to investigate the way I inflict damage if I can not make the animations in sync with the damage volume.


At the moment there are a couple of issues with the AI getting stuck. Once in a while, it appears to stop and get stuck until the player moves in front of it, then it seems to reset the AI. The player tracking seems slightly off and I will try to resolve this with further work on the AI blueprint.

The other issue is the AI getting stuck at the top of the spiral stairs. I do not believe this to be an issue with the AI blueprint, but rather the shape and potentially the height of the stairs which I will investigate at a later time. As I am focusing on the downstairs at the moment, and intend to make the upstairs inaccessible if I find myself lacking time to complete it, I do not want to spend too much time trying to resolve the AI being able to get from the ground floor to the first floor.

No comments:

Post a Comment

Unreal: Project Evaluation

Unreal is visually enticing and appears to be extremely user-friendly. In the beginning stages, I found it really nice to use and I was exc...