[UE4] Basic survival attribute system (Replicated)

Games By Hyper - Blueprints - Jun 13, 2021

A survival character with attribute logic: from health, armor, hunger, energy, thirst, oxygen too health states as sick, poisoned, drunk, infected etc. too a temperature system.

  • Supported Platforms
  • Supported Engine Versions
    4.20 - 4.27
  • Download Type
    Complete Project
    This product contains a full Unreal Engine project folder, complete with Config files, Content files and .uproject file, which can be used as a template to create a new project.

Discord 💬 Join the Hyper Game-dev Discord

Demo 📁 Try it out!

Video ▶ To view the product

Made by 🎮 Eric from Hyper!

Modular 🧩 Check out other compatible assets


The survival attribute system:

It includes a fully networked survival attribute with advanced logic. This system is intended for simple survival games. No inventory system is coupled, or included. It manages survival attributes. The product is based of an UE4 character and will not be updated to UE5 techniques. The component can still be used in UE5.


Base player stats:

Health

The character has a health variable. This is the most important one.

The health is affected by damage events.

For instance: Fall, hunger, thirst, no air, etc.

When the health is zero, the charachter will collapse and a die sound is spawned

when the character is very close to dieing, a very low health sound is spawned. In this case a fast heartbeat.

Also a blood splatter screen animation is included. On event damage the blood splatter is activated.

For generic damage events, the armor will decrease first


The character has the option to enable or disable health regeneration.

The amount of regen is determined by the: VariableHealthRegenerationRate

When health is at max, the logic will not be excecated.

Also, when the actor is receiving damage, the health is not regenerated for a couple of seconds 

Armor

The character has armor.

The armor is substracted on event damage.

However, the armor is not substracted on certain damage types such as:

Hunger damage

Thirst Damage

Out of Air Damage

Fall Damage

If the armor is zero, a armor break sound is spawned.

If there is no armor on the char, the UI will adapt

Hunger

The character has hunger logic.

The hunger decreases over time by a consumption rate variable.

When the hunger is in low range, a stomach growling sound is spawned.

When the hunger is at zero, damage will be applied to the health, not the armor.

Thirst

The character has thirst logic.

The thirst decreases over time by a consumption rate variable.

When the thirst is in low range, a stomach growling sound is spawned.

When the thirst is at zero, damage will be applied to the health, not the armor.

Energy

The character included energy logic.

You can sprint with shift. Sprinting consumes energy.

The sprint speed is lerped to the max speed and also reversed via timeline.

You can jump with spacebar. Jumping consumes energy.

Jumping spawns a jump sound.

When the energy is in low range, you can't jump or sprint.

The char will automatically stop sprinting when is zero.

The energy has a regeneration rate variable.

When the energy is in low range, an out of breath sound is spawned.

Oxygen

The character has an Oxygen variable.

This can be used for: under water, but also for "space survival"

Only when oxygen is consumed the UI will show the oxygen bar based on an animation

The consuming of oxygen is triggered by a variable: Consuming oxygen bool.

When the Air is low, an out of breath sound is spawned (gasping). 

When air is regained a regaining sound is spawned

When oxygen is zero, apply damage only to health, not armor.




Generic Penalty system:

This pack includes a generic penalty system. You can easily apply penalties to all stats based on health, temperature or from a pickup e.g.

Rotten Fish

Alchohol

Poiseness berry

Berries

Energy Drink

Antidote

Medicine

Bandage




Health states (Including post process and screen effects):
  • Sick: Bad stats, slowly recovering
  • Healthy: Normal Stats
  • Infection: Need medecine, bad stats and slowly dieing
  • Wounded: bad stats but slowly restoring. Small chance of infection if not attended
  • Poisoned: random chance of recovering. Antidote helps to restore.
  • Drunk: Temp dizzy screen, more hunger and thirst. A bit more energy
Temperature states:
  • Very cold: Bad stats and small amount of damage
  • Cold: Bad stats, faster hunger
  • Normal
  • Hot: Bad stats, faster thirst
  • Very hot: Bad stats and small amount of damage

Based on "external temperature", the temperature state is switched. 

Be aware, the character also has a "Chill" temperature.

The chill temperature can differ per character.

This is depended on a chill temp penalty.

The penalty is determined by e.g. clothing, if is wet, or near a fire and warmed.

Each state has a screen animation effect.




Misc States:

This affects the chill temperature of the individual.

  • Wet: When in rain or just out of water. Faster cold
  • Warming: Near a fire, faster not wet AND faster too hot and less fast too cold
  • On Fire: Fire particle + dying + not wet
Weather based temperature support:

Possible to integrate with a weather plugin.

The weather system should include a temperature variable.

To set temperature state in the char: Call the "Set Temperature State based on external temperature" event


In the weather system you want to set temperature depended on season (spring, summer, autumn, winter)

Depended on time of day (Morning, afternoon, evening, night)


And set penalties and misc states based on weather type:

  • Rainy (Colder and wet) (Call On Event Wet on the char)
  • Cloudy (slightly cold)
  • Partly Cloudy (A bit warm)
  • Sunny (Warm)
  • Snowy (Quite Cold)
  • Foggy (A bit cold)
  • Windy (Cold)
  • Stormy (Wet and cold) (On Event Wet)
Character logic:

Sprint, Run and Walk:

  • Switch between Run and walk with Tab
  • Enable sprint with left shift.

Fall damage:

  • This is triggered on the Event On Landed. There are two variables involved:
  • Required Falling velocity to apply fall damage (This is a threshold so low impact falls are not hurting)
  • Fall Damage Multiplier (Multiplies the impact of the fall)

Identifier:

  • The player has an option to show their statistics and their name above their head which faces the local player.
  • This is for multiplayer purposes. 
  • You will not see your own stats above your head but only in your HUD
  • Currently: Health, armor and name is replicated. 
  • It is optional to replicate the other stats such as hunger.

Double Jump:

  • Double jump system which can be switched via a boolean.
  • Energy logic is also included.

Die:

  • Character collapses when health is zero.



Quality first:

The best and nothing less. Our core principles keep our assets the top of what’s available.

Where possible:

– Complete and flexible, we include most common use-cases in our products.

– Data-Driven approach, so adapting is easy. We provide spreadsheets for mass edits.

– Flawless integrations.

– Blueprint only, so we keep it accessible for you and your complete team.

– Extensive documentation, in code and in docs. Not only what happens by also why. We want you be able to learn.

– Production-ready.

Technical Details

Features:

  •  A fully networked survival character with advanced logic as described above. Including:
  • Base player stats
  • Health state system
  • Temperature state system (Possible to integrate with a weather plugin, no weather plugin included)
  • Weather system support (Possible to integrate with a weather plugin, no weather plugin included)
  • Misc states such as on fire, warmed (near fire) and wet
  • Character logic such as walking, running, sprinting, dieing, fall damage, double jump and an player identifier for network.
  • Including icon's, textures, post processing and screen animations.

Number of Blueprints:45

Network Replicated: Yes

Supported Platforms:

Windows. It is assumed that it works fine on all platforms.

Support, community & Documentation📁:

Initial Support like bug encounters and online documentations are available after verification[Please note that docs are an optional courtesy and web-based]. Easiest way is to access is Discord, but ofcourse also possible via mail.

The discord is a meeting place with forums setup per asset where other game developers with the same asset can discuss the use and also help each-other out including me (Eric) the developer.

All my blueprints are always heavily commented. Not only the what happens, but I try to explain why it happens.