Player System Modularity


Benjamin Dixon - Project Lead/ Gameplay Engineer

2/23/2024

This sprint we had a lot of great progress toward establishing our main game systems. I was primarily tasked with working on the integral player systems including enhanced input, movement, sprinting jumping, crouching, sliding, health, and stamina. I had a lot of success especially working with the enhanced input system that Unreal provides, it is a significant upgrade to the old system and learning how it worked was invaluable in the process of the set up for these systems. 

The problem

I ran into an issue with the player stamina, in that my first instinct was to create this function in the tick of a component. However, this meant not only creating extra overhead for the system by using tick, but I also needed to have some circular dependance between the player class and the actor component. Overall this single function being used in tick may not have caused a problem now, however the way that it was done at first would have lacked the tune-ability of a less dependent system. In the game we want there to be many different ways to not only modify the stamina drain but also the stamina regeneration, different classes will even have different values for each. 

Using such an interdependent system would  create more unnecessary complexity in the future and would ultimately affect any child classes created subsequently. In terms of performance if the stamina is directly tied to the tick, "band-aids" would be needed to compensate for lower or higher performing systems because the stamina could be slightly higher or lower depending on the framerate of the system. Also for this project in particular I wanted to challenge myself to use the event handling system wherever possible because it is more efficient when compared to passing references around between classes.  

The Solution

After doing some research I was able to use the enhanced input triggers as the call to the stamina decrease,  so each frame that the sprint is activated the stamina decreases, but when it is not activated it does nothing. Then conversely with the regeneration of the stamina, I was able to use an fTimerHandle to invoke a function on the stamina component that regens stamina on a fixed update cycle independent of tick, and when the stamina was sufficiently incremented the timer is cleared and invalidated until the next time sprint is activated. 

This minor change may not improve the user experience directly but the design philosophy behind it will ensure that the player is getting maximum performance. The biggest improvement will come in the flexibility of the system allowing more interactions with powerups, weapons, perks, and other systems that will augment the player and create a more varied and dynamic experience. 

Get Deadlands Duel: Time Rift Rumble

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

Cant wait to see more from the base player and its respective children. Amazing work

(+1)

The player system will soon be more modular after the overhaul. Thank you for setting up the basis of the player.