Thursday, 18 October 2018

Health & Armour

After doing some searching about health systems, specifically, https://www.gamesradar.com/stop-drop-and-heal-history-regenerating-health/ which references several highly popular games and their regeneration systems.

I decided I would like to take the simplistic approach to a health system - to begin with at least. The main reason I want to include a regeneration system is to make things easier overall and most importantly add the fast-paced styled gameplay oppose to slow and tense.

By following a tutorial I was able to learn the basics of implementing progress bars to represent stats such as health and armour.


The first step I have taken is to create the UI with progress bars as the health and armour, which will be visible to the player at all times. I chose the classic colour red for health and blue for armour. I have anchored them to the bottom using the anchor panel, this ensures the bars will remain in the specified location regardless of the players chosen screen resolution.


In the FirstPersonCharacter Blueprint file, I have created two variables. One for health and another for armour. In the tutorial, he used a value of 100 for his health bar, when I have attempted to add regeneration it was not working properly. After doing some searching online, I have found that the progress bar operates between values 0-1 rather than 0-100. Once I adjusted it to use 0-1 to represent a scale of 0-100% the regeneration was functioning as expected.


By adding these nodes, we are telling it to load and display the HealthAndArmourHUD in the viewport when we begin playing (which is the health and armour UI). Without this, the health and armour bar will not be displayed on-screen.


By using the Event Tick node, which is essentially the Start() function in Unity, we can check every frame for changes in the health and armour. The Sequence node is used for multiple outputs, and each one is called in order. However, due to the code being executed at such a fast rate, the ordering of execution would be unnoticeable. In this particular case, the sequence node is not serving a purpose and should be deleted.

The Delay node causes a selected delay to be executed before the next call. This can be particularly useful for slowing down the rate of execution to make transitions smoother in a wide range of situations. In this particular case, the Delay is being used to set 0.001 armour every 0.01 seconds.

Using the Branch node is similar to the if statement in C#. It checks if a condition is true or false, and has a method based on the condition. In this case, if Armour is less than 1 (100%) we set the value of armour to add 0.001. If the condition is false, we do not do anything.

I am pleased with the result of the health/armour system and found the tutorial simple to follow. It is the first time I have used Blueprints to create anything and I feel like once I familiarise myself with a range of common nodes that I can relate to the C#/Unity, I will find Unreal much easier and fun to use.

The one issue with the system is that once the armour reaches a value of 0 and begins draining the health bar, it is visible that the armour bar is continuously attempting to regenerate and there is a flicker. It does not affect the gameplay at all, but it looks unprofessional. The reasoning for the values being particularly low is to reduce the flicker to a bare minimum so it is almost unnoticeable. This is a temporarily solution to the problem, however, it is not a priority.

No comments:

Post a Comment

Unreal: Project Evaluation

Unreal is visually enticing and appears to be extremely user-friendly. In the beginning stages, I found it really nice to use and I was exc...