top of page
image_2022-12-31_160307998.png

Unreal Showcase

|

C++ / Blueprint

Acknowldeging the importance of implementing c++ in Unreal Engine as a programmer, here are my array of Unreal Engine C++ oriented showcases.

Simple AI Patrol

The enemy is a character class that uses an AI controller. The patrol behavior is executed by the enemy behavior tree which stores the blackboard components that controls the data stored in the behavior tree. The blackboard component holds two patrol points which are vectors based on the world location. In the enemy class, the patrol points values are declared and assigned to the blackboard keys.

Screenshot 2022-12-31 172113.png
Screenshot 2022-12-31 173844.png

Using the "Move To" task node, the enemy character will move to the patrol point, with the delay of  "Wait for" task node. 

Simple AI Follow Player If Detected

The logic behind the enemy following the player is similar to the patrolling behavior. In the behavior tree, the enemy will execute the "Move To" task node in which the target is set to an "Object" blackboard component key. In order to execute the task, the target value must be valid.

Screenshot 2023-01-01 151213.png
Screenshot 2022-12-31 173658.png

The targeting system to implement for the enemy involves the calculation of the dot product between the enemy's forward vector and the vector of the player from the enemy (normalized). The dot product is then compared to the cosine of the angle of the enemy's viewing angle. If the player is within a threshold range and the dot product is more than / equals to the cosine value (radian), then the enemy will set the value of the target as the player character reference, hence making the execution of the following task as valid.

Screenshot 2023-01-01 144939.png
Screenshot 2023-01-01 152253.png
Screenshot 2022-12-31 173658.png
portfolio logo.png

© 2022 by Loo Zheng-Jie created with Wix.com

  • w-facebook
  • Twitter Clean
  • w-flickr
bottom of page