Portobelly Production Journal #23


Today I focused on adding functionality to the BFF (big fungal fella) enemy. This class is a child blueprint of the PO_BP_PickupCharacter so that it can be absorb by Belly. At the moment, Belly’s absorb ability is fairly unpredictable when absorbing characters so I will aim to fix this once I have added all of the functionality to the enemies. This will be easy to make changes to all of the enemy classes because they all have the same parent blueprint.

Fig 1 - BFF AI behaviours overview

As the overview above shows, the enemy starts in a idle state, then starts patrolling between two points, after it sees the player it becomes alert, retreats away from the player and then starts to attack the player with long range arced projectiles.

Fig 2 - BFF launching itself using an arc

Fig 3 - BFF launching itself blueprint

I wanted to tackle the projectile arc first because I felt that this was going to be the most complicated state to complete. To my surprise, this was fairly easy to accomplish using the SuggestProjectileVelocity Custom Arc node which calculates an arc based on the start position and end position of the projectile and outputs the velocity to create the desired arc. The arc curvature can be changed by altering the gravity and arc param float values. To test this out I decided to launch the player so that they would land at 0, 0, 0 and this worked as intended (as can be seen above).

Fig 4 - BFF launching a projectile in an arc

Fig 5 - BFF launching a projectile blueprint

Fig 6 - BFF behaviour tree for the basic projectile

Using what I had learned about creating projectile arcs, I applied it to a projectile that is spawned out the top of the BFF’s head and instead of launching the character I added an impulse using the suggested velocity from the projectile node. The projectile is set to hit 0, 0, 0.

Fig 7 - BFF firing projectiles at Belly’s location

Fig 8 - Getting the players location blueprint task

Having the projectiles firing at a set location is not useful when creating a challenging enemy as it would be incredibly easy to avoid the projectiles. Instead I wanted the BFF to fire the projectiles at the players location. To achieve this I created a task that gets the players current location and updates the end point of the projectile so that it is launched at the players location. This makes the enemy far more challenging than just firing at a set location.

Fig 9 - BFF activation radius

Fig 10 - Activate and deactivate the BFF service

To allow the player to become active in the level a create a large spherical volume around the player that when the player overlaps with the volume the enemy becomes active. During this active state the enemy is able to perform actions such as patrolling, alert, retreat and attacking. This system is almost identical to the system used for the Boomshroom in which it checks for how many player are within the sphere volume. If this number is above 0 the state is changed to active.

Fig 11 - BFF Patrolling between two points

Fig 12 - BFF behaviour tree setup for patrolling

Fig 13 - Custom event that switches between the two target points

The patrolling state consists of two tasks, setting the next patrol point and moving to that patrol point. The move to task is a default task within the Unreal Engine and requires a vector as input and the character will walk to the location. The setting next patrol point event switches between the two selected patrol points (target point actors). I added two IsValid checks for the two patrol points that will output some text on a print string if the variables are not populated. Adding this debug message will prevent the user from accidentally placing the BFF in the level without applying target points to the character.

Fig 14 - BFF alert state

Fig 15 - BFF pop up alert blueprint

The alert state is triggered by a spherical trigger volume that if overlapped with the player the BFF state will be changed to the alert state. When the alert state is entered, the custom event above is activated that makes text above the enemy visible and makes the text scroll up from the players location. The character also jumps when the alert state is activated.

Fig 16 - Changes rotation of the character to follow the characters velocity

I applied the orient rotation to movement check box on the BFF character movement so that the enemy faces the direction of their movement. This looks far more believable than an enemy that doesn’t rotate when it changes direction. This is something that I will apply to all of the enemies apart from the spiral spore as many of it’s attacks will involve rotation.


Figures List

  1. Rees, O (2019). BFF AI behaviours overview. [offline]. [Accessed 20/02/2019].

  2. Rees, O (2019). BFF launching itself using an arc. [offline]. [Accessed 20/02/2019].

  3. Rees, O (2019). BFF launching itself blueprint. [offline]. [Accessed 20/02/2019].

  4. Rees, O (2019). BFF launching a projectile in an arc. [offline]. [Accessed 20/02/2019].

  5. Rees, O (2019). BFF launching a projectile blueprint. [offline]. [Accessed 20/02/2019].

  6. Rees, O (2019). BFF behaviour tree for the basic projectile. [offline]. [Accessed 20/02/2019].

  7. Rees, O (2019). BFF firing projectiles at Belly’s location. [offline]. [Accessed 20/02/2019].

  8. Rees, O (2019). Getting the players location blueprint task. [offline]. [Accessed 20/02/2019].

  9. Rees, O (2019). BFF activation radius. [offline]. [Accessed 20/02/2019].

  10. Rees, O (2019). Activate and deactivate the BFF service. [offline]. [Accessed 20/02/2019].

  11. Rees, O (2019). BFF Patrolling between two points. [offline]. [Accessed 20/02/2019].

  12. Rees, O (2019). BFF behaviour tree setup for patrolling. [offline]. [Accessed 20/02/2019].

  13. Rees, O (2019). Custom event that switches between the two target points. [offline]. [Accessed 20/02/2019].

  14. Rees, O (2019). BFF alert state. [offline]. [Accessed 20/02/2019].

  15. Rees, O (2019). BFF pop up alert blueprint. [offline]. [Accessed 20/02/2019].

  16. Rees, O (2019). Changes rotation of the character to follow the characters velocity. [offline]. [Accessed 20/02/2019].