Devlog 1: Derrick Domena-Guzman: Player movement, and basic survival mechanics
Problem:
This week, I focused on implementing a player with movement mechanics and some basic survival mechanics, including health, hunger, thirst, and stamina.
Player Movement
I started by working on the player's first-person camera perspective. To achieve this, I attached a derived C++ script from ACharacter
to the player blueprint, giving me more control for future implementations. I then added SpringArm
and Camera
components to the player and adjusted their transforms to achieve the desired view.
Player Blueprint:
In-game first-person view:
Once the perspective was set, I moved on to implementing player movement. Since the player blueprint already had a UCharacterMovementComponent
attached, I created a variable called PlayerMovement
for this component. I then overrode the SetupPlayerInputComponent
function, binding axis inputs for mouse movement and directional movement.
I followed similar steps to implement sprinting, crouching, and jumping. For crouching and jumping, I used the pre-defined functions in ACharacter
. For sprinting, I modified the max walk speed to increase when the player is sprinting and reset it to the default value when they stop.
Player C++ script (Input function):
Survival Mechanics
After completing the movement system, I added basic survival components: health, hunger, thirst, and stamina. These will later connect to the UI being developed by a team member. For each component, I created a separate ActorComponent
C++ class.
Each class contains:
- A delegate to broadcast changes,
- A current and maximum value (e.g.,
CurrentHealth
andMaxHealth
), - A function to handle value changes (e.g.,
HandleDamage
in the health component).
In the HealthComponent
, I initialized the current health to the maximum health in the BeginPlay
function. The HandleDamage
function updates the current health value and includes checks to ensure the player still has health remaining. If health is depleted, it triggers the appropriate delegate to broadcast the update, allowing the UI to reflect the change.
Health Component C++ Script:
To test these features, I set up action inputs in the player C++ script to trigger changes, ensuring they update correctly.
Next Steps
Next week, I plan to refine the hunger and thirst systems to decrease gradually over time. I’ll also add functionality to reduce stamina when sprinting and regenerate it when the player stops sprinting.
Thank you for reading!
Files
Get Echoes of Creation
Echoes of Creation
Status | In development |
Author | FrogBoots |
Genre | Survival |
Tags | Crafting, First-Person, Singleplayer |
More posts
- Devlog3- Vivianne Zsoldos-- Player UI (PauseMenu, InventoryUI)8 hours ago
- Devlog 3 Drake Curry: Breakables v2, Navmesh, Enemy AI12 hours ago
- Devlog 3: Jazmine Chargualaf: Reworking Item Colliders & Setting Up a Sound Syst...14 hours ago
- Devlog 3: Derrick Domena-Guzman: Data Oriented Building Menu, Showing Building P...19 hours ago
- Devlog 2: Jazmine Chargualaf: Weapons, Tools, and Crafting System6 days ago
- Devlog 2 ~ Drake Curry: Level v2.0 and Learning Pains6 days ago
- Devlog2- Vivianne Zsoldos -- InventoryUI (Started)6 days ago
- Devlog 2: Derrick Domena-Guzman: Improved crouching, and functional stamina bar6 days ago
- Devlog 1 Drake Curry: Level Design, Breakables, Pickups13 days ago
- Devlog1- Vivianne Zsoldos-- Player UI (Main Menu, Player Stats)13 days ago
Leave a comment
Log in with itch.io to leave a comment.