Garden 2 February updates

Custom damage event

One thing I wanted to do for a while was to create a custom event for applying damage to actors. This allows passing more detailed information about the damage than Unreal's default Apply Damage event. The custom event passes a structure of variables. One key variable is the type of incoming damage, which is based on an enumeration that contains all the damage types.

Damage info structure is created and sent to the actor receiving the damage.

The actor receiving the damage parses through the structure and for example, uses the information to determine what type of defensive stat should be used to reduce the damage.


The defensive stat is selected and whether the attack can be avoided is based on the received damage info.

The damage info is passed via an interface for combat actors, so any actor not participating in combat can't receive damage.

Player respawn

Previously, when the player character died it would simply get restarted at a designated location, but problems started to pile up slowly as everything had to be put back to their original positions, meaning enemies had to respawn with everything else that was supposed to reset on player respawn. So every time I add something to the level, I'd have to make sure it behaves correctly when the player respawns.
Instead, I decided to just reload the level, which would automatically put everything to their original state, and then check from the save file if they required any alteration.

Enemy respawner

The enemy respawner was created to keep track of killed enemies and then respawns them when necessary. However, since I changed the player respawn to reload the level instead of just creating a new pawn for the player, the respawner was no longer needed for enemies that are supposed to respawn.
Now it only tracks the enemies that are not supposed to respawn and whenever the level is loaded, it checks if those enemy actors exist in the level and destroys them.
In a nutshell, a dying enemy actor sends a reference of itself to the enemy respawner actor, which then creates a structure of variables based on it. This structure is then added to an array of defeated enemies which is also added to the save game file, so the enemies stay dead when loading the game. When the level is loaded the respawner gets the array from the save file and checks if it can find any actors that are not supposed to be alive and destroys them.

The enemy respawner creates the enemy info structure and saves it.

Other stuff

While working on the save system, I noticed that actor references in the save file are unknown when loading the game after a restart and those references would lead to any system trying to use it not knowing which actor it is referencing. To go around this, I started saving object names (and any other relevant variables) instead of a reference to the actor. This can be seen in use in the previous picture where the enemy respawner is saving actor information into a structure. Then any actor that needs to be checked has its object name compared to the ones in the save file.

I also added a quick system in the character menu to add effects from different equipment to character can use. As I hadn't planned to create the equipment system before the next playtest, I figured it would be a good idea to allow modifying the player's stats in the same way as the equipment. Hopefully, this should give me a better idea of how my idea of equipment fits the game and how it could be improved.

Additionally, I added some previously made textures to the level to see how it would look like.

Level with textures in place.