dimanche 2 juin 2019

[Unreal Engine] Enemy artificial intelligence and behaviors

It's a continuation of the 3D "Demon Soul Character" and the dialog system projects

The subject is to create a enemy actor , for that I implement a behavior tree with C++ and blueprint.

Conception

The enemy will use this state machine





At first the enemy will patrolling (patrol state) , when he detect the player , he will run to him (Chassing State) , and finally when the enemy is close enough the player, he will attack the player

Patrol

During the patrol , waypoints will be randomly generated around the enemy. This will make the enemy walk around his position and try to cover many area.

When enemy see the player he will enter the "chase state"

Chase 

During the state, the enemy will pursue the player and try to be closer to the player. To avoid the enemy to be very near the player. Player character have a "sphere " around him , when the enemy enter this sphere , that mean he is close enough to attack so he enters the "attack state"

Chase 


Attack

In video game, enemy are no too aggressive that why the enemy is not too aggressive

- On the first stage the enemy can turn around the player or stay idle

Strafe


- After this stage, enemy can attack the player or block.. enemy have to attack : one basic and another one when he jumps to attack the player ("run attack") . The attack are select randomly. If the enemy is behind the player, he will 100% attack the player, that will add strategy to the game

Attack the player


Block