Devlog 2: Derrick Domena-Guzman: Improved crouching, and functional stamina bar


Problem:

This week, I focused on improving the crouch mechanic to make it feel more natural and adding a stamina system that interacts dynamically with sprinting. These changes enhance the overall player experience by making movement mechanics smoother and more immersive.

Crouch Mechanic Improvements

Previously, the crouch mechanic instantly changed the camera position, which felt abrupt and unrealistic. To address this, I implemented an interpolation system for transitioning between the standing and crouched eye positions.

Here’s how I tackled it:

I further expanded implementation on three derived helper functions, OnStartCrouch, OnEndCrouch, and CalcCamera. Instead of setting the camera position directly, I used interpolation in the tick function to smoothly transition between the standing eye position and the crouched eye position and pass this value to my helper functions as my CrouchEyeOffset.

To track the current and target positions, I used the BaseEyeHeight of the Player. Both the OnStartCrouch and OnEndCrouch methods work by adjusting the difference of the two distances and set’s it to CrouchEyeOffset Z position. Then the CalcCamera method would get the camera view, and set the Out Result location to plus equal the CrouchEyeOffset.



Video Example: (Smooth Crouch)

Stamina System for Sprinting

The second improvement I worked on was adding a stamina system that directly interacts with sprinting. Previously, sprinting only increased the player’s movement speed without any cost or limitation. To make the mechanic more engaging, I connected it to the stamina bar.

Here’s what I did:

Stamina Component:

I created a new Stamina Component as a separate ActorComponent, similar to the Health Component I made earlier. This component tracks the player’s current stamina and maximum stamina. It also includes functions to decrease and regenerate stamina.

Sprint Integration:

When the player presses the sprint button, stamina begins to drain over time. I achieved this by checking if the sprint key is held down and reducing the stamina in the Tick function. I also set a condition to stop sprinting automatically when stamina reaches zero, preventing the player from continuously sprinting.

Regeneration:

When the sprint key is released, the stamina component triggers regeneration over time until it reaches the maximum value.



Video Example: (Stamina Sprint)

Next steps:

Work on adding animations for the player movement, since this is a survival game a key part is being able to see arm movement when using any tools for gathering resources. 

Thank you for reading!

Files

EchoesOfCreation_V0.0.2.exe 1.7 MB
6 days ago

Get Echoes of Creation

Leave a comment

Log in with itch.io to leave a comment.