3C project

Context

Self impose challenge to improve my scripting skills in Unreal Engine.

    Project Brief

    I gave myself 1 week to learn how to give the ability to wall run and wall jump in Unreal Engine.

    • Prototype quickly.
    • Create a simple level to test results.
    • Investigate how my solutions scale.
    • Limit hard coding to a minimum. As if I would want to influence variables with other abilities in the future

    Showcase Wallrun, Walljump and dash

    Wallrun

    The Intention

    Plan

    • Infer movement orientation based on the relation between camera and wall’s vectors

    Set up

    • Tagged blueprints of specific walls that can be run on
    • Separate variables for setting velocity by direction and strength

    Execution

    • While the avatar is wall running, update it’s velocity to match intended direction and speed

    The Code

    Research
    • I looked online for how others achieved what I was aiming for
    Adapt and Optimize
    • No need to cast the wall as I only need it’s forward vector
    • Instead of hard coding variables that I could use later, I promote to variable the inputs

    Cam Tilt for Juice

    Plan

    • Detect on which side the wall is relative to the player
      • I used one detection box on either side of the avatar

    Set up

    • Set up a timeline to generate a gradual alpha to lerp with
    • Connect an end overlap event on the reverse play of the timeline to restore camera angle

    Execution

    • Lerp camera rotation to have a smooth tilt
    Impression of wall running
    • The camera tilt help sell the idea that you are running on a wall

    Wall Jump

    The Intention

    Plan

    • Infer movement orientation based on the relation between avatar and the wall’s position

    Set up

    • Gate the logic by verifying if the avatar is in the right conditions to execute
    • Validate that the WallRef is valid

    Execution

    • Launch the avatar to match intended direction and height

    The Code

    Vectors
    • Dot products are really useful to infer directions

    Dash

    The Intention

    Plan

    • Launch the avatar forward on the press of a button
    • Limit the use with a cooldown

    Set up

    • Gate the logic by verifying if the cooldown is over
    • Make a vector using the current orientation as direction AND a dash strength variable

    Execution

    • Launch the avatar to match intended direction and velocity amplitude
    • Start a set timer by event
      • The event reset the condition that enables the dash logic

    The Code

    Delay free
    • Delays are frequently used in tutorials, but they might cause problems in the long run
    • Easily replaced by Set Timer by Event
    • Promote the timer length to be able to adjust it later on

    Next Step

    What would I do to improve the design ?

    • To be able to distribute the ability to different actors in the game.
      • Using Components containing the logic
      • Using Gameplay Ability System