Gnomeward Bound
In this project I was in charge of engine optimization and making the designed mechanics in blueprint. A lot of the work crossed over with other roles in the project. Here I will layout the blue prints for the climbing mechanics shown in the video the fall damage and the sounds the character makes when walking on different terrain.
Climbing
I tried to minimize the use of event ticks because they actively tax the processing resources of the engine. The most active sentinel calls were for modes like tracing for climbable objects, fall damage, etc. I used a sequence node to make the most use of the Event Tick Node.
Event Tick Sequence
Here 2 overlap events enable or disable the code for actively tracing for climbable objects.
Collision Events
On top I set a condition for the max distance a character can be from the ledge to be able to grab. From the Sequence node in the tracer annotation above (in event ticks picture), I continued to create the actual tracer that scans for the height of the object in the front vector of the character. For the sake of reducing encumbrance (spaghetti code) I reduced the vector calculator into a macro called ledge tracer.
Conditional requirements and Height tracer
This is the ledge tracer macro. It calculates the height for the sphere trace node.
Height and Vector Calculator Macro
If the character meet the vertical and horizontal distance requirements and the object is climbable and the character is not already climbing then the character executes this animation and changes his state to hanging. A Move Component To Node is added in case the character in his animation or mesh needs to be reoriented and stop all movement.
Grab Ledge State Check , Animation Slots, character orientation + Movement Control
This is the horizontal trace to verify the distance to the object in front of the character.
Wall Tracer
This is the code that calculates the forward horizontal vector distance of the character.
Horizontal Distance and Vector Calculator Macro
This event code is tied to the control action to actively grab a ledge. It sets the mode to hanging and includes a macro that calculates the distance a character has to move to reach the top of the ledge when it climbs to the top.
Grab ledge Event
This Macro calculates the distance to the top of the ledge.
Distance to Pull Up and Final Location Calculator Macro
This event initiates the mode to ClimbingLedge when the character is moving from hanging to reaching the top of the object.
Pull Up Event and state check
These events control the input when a player lets go of the ledge. It resets all modes.
Let go of Ledge
This resets the movement mode for the character while the character is climbing
Control Pull Up State
The jump key controls affects climbing while the character is in the hanging mode.
Climbing Controls
Falldamage
I tried to minimize the use of event ticks because they actively tax the processing resources of the engine. The most active sentinel calls were for modes like tracing for climbable objects, fall damage, etc.
Fall Damage BP
Terrain Sound
I added a blueprint to create different stepping sounds when walking on different terrain types. Our sound engineer added the sounds and I created a physical material lists in the projects settings to apply them to.
Engine Physics Settings
I created 3 variables referencing each of the surface types in the character blueprint. I also created 3 physical materials each referencing the appropriate sound.
Character Variables
Physics Material
Variable Defenition
I added the physical material to the material that I wanted to produce the sound when interacting with my character.
Terrain Material
In the character walking animation I added an event every time the character's feet was about to strike the floor.
Animation Window
In the Animation blueprint I included a character reference upon initialization so that I did not have to cast every time I needed a character attribute or parameter blueprint reference.
Animation BP
These nodes allow the character's left foot produce appropriate sounds depending on the material the tracer interacts with.
Adding Sound to Left Foot
The same for the right foot.