Friday, 10 March 2017

Future Character Design/Gameplay Pre-Production


I am currently running this project with placeholder characters and animation, but in the future, time allowing would like to get my own character designs into the Project as well as different gameplay.

I had planned to implement a weapon system which allowed switching of modes, but realized this would require too many custom animation for the current time constraints.

You can see below a couple of weapon designs.



This allowed for 4 weapon modes, Sword, Pike/Halberd, Scythe and Axe.

For characters, I am hoping to implement a custom player character and main boss enemy. I hope to implement it so that they both use the 'Switchblade' type weapon.

The main playable character would be a Tiger Warrior.

Mood Board:


I have modeled this character up to the point where it is ready for detailing, though I am not sure which program to to use to take it forward, maybe ZBrush.


The main boss would be a Minotaur.

Mood Board:


This is also up to the point where I can take it to ZBrush and detail it.


Future development with the actual level will include improving the graphics and implementing the functions and feature rooms that were not completed, such as the enemy encounters, Puzzles and the Trap rooms.

Controller setup

To make it easier to set up and map my controls, I used the Project Settings > Input screen. This allows you to set a common name for a control input and assign several buttons for various controllers or input methods.


That way, the named inputs can be linked to the blueprint functions and your controls will already be mapped without managing several inputs fer function.

I think this method is actually more efficient on the system as well.

My control scheme was set up as follows:

This screen appears in game to inform the player.

Blood effects

To make the project more interesting with more visual feedback to the player, I created and added a couple of features.

First is a blood splatter generator. This is called when the enemies take damage and spawns varying decal projectors to put blood on the floor.


Theres 3 different blood designs, and they spawn in a random radius with differing scale and rotation, meaning they always look different, shown below after killing some enemies:


Then I decided they need some blood splash particles when being hit.

To create this, I took the starter content 'Explosion' particle and deleted everything except the shower of bits. I replaced the particle material with my own created blood droplet.


Health Pickup

I was finding that players were needing a health top-pup around half way through the level and just before the boss.

I created a simple health item consisting of 3 intersecting cubes making a healing icon. This has a rotation and a collision capsule.


The code checks if the player needs healing, and will only be collected if their health id below full. When collected the actor destroys itself.


Theres nothing more frustrating than a health pickup that collects when you don't need it!


Simple Minion enemies

Due to the maze construction of my level, it is required to have a lot of small minion enemies which die in a couple of hits.

I created these enemies based on my main boss, but used the PawnSensing approach to movement.


The smaller enemies only have a little health pool and will only perform melee attacks.

I created a blueprint object which I can place in my level which spawns a set of minion enemies, in a random scatter, and at different sizes, based on how far away the player is.


and in-game:


This saves manually placing hundreds of individual enemies.

Player and Enemy death/re-spawning

For the game to function fully, it is very important to have the player and enemies die correctly.

To control my death animations, I am going to use the State Machine to detect when the characters have died, then play the death animation.


Here you can see in my enemy state machine, I have three death animations, which when the enemy dies, it chooses one to play at random, so that when a large number of enemies are together and they die, it looks visually interesting.


Here is the code that destroys the character. This is triggered when the character's health hits 0 or below. The timeline is used to sink the body into the ground, so that it doesn't just disappear when it is destroyed.

This setup is almost identical for all my characters, including the player.

The only difference being, the player is able to re-spawn. This is done via an event in the Game Mode event graph.


And a system of Blueprint Checkpoints which update the re-spawn location when they are passed.


This makes it extremely efficient to place as many checkpoint re-spawns as required, anywhere in the level.

Shield Mode

What use is a shield if you can't use it?

Here I have implemented a shield mode to my Sword and Shiled stance, and also a Guard mode to my Broadsword stance.

Both of these use a Blendspace to choose and blend between which animation to play based on speed and direction.


To use this correctly a new set of branches on the state machine was required to go into and out of these modes.


Then finally, to make sure no damage was taken in shielded mode, I added a Branch and a new function on the damage check in my Character Blueprint.


This detects which mode is being used and plays a short 'Deflect' animation and a particle effect at the correct moment.

Ultimate Attacks

As mentioned earlier, Rage is used to perform 'Ultimate' attacks.


I have created two ultimates, one for each weapon mode.

The Sword and Shield mode creates a circle of burining swords, spinning around the player.

This was created by making a new blueprint actor containing all the required parts.


And of course the code to deal damage to the enemies.


The Broadsword ultimate brings down a giant mega sword to crush enemies in a single hit... it is also on fire...


Energy/Rage generation and use

Energy is useless without things to use it on and ways to regenerate it.

In this project, Energy is used to perform Special Attacks during an attack combo to do extra damage.


In this screenshot, it shows that a special can be performed only if there is enough energy available. If the attack is performed successfully, then the appropriate amount of energy is removed from the Energy pool.

Energy is regenerated by a function timer which runs when not in combat.


Which contains this code:


Rage is generated when dealing and taking damage, as shown below:


GetRage is called when damage is received and adds based on damage taken, GenRage is called when dealing damage to enemies and adds based on damage dealt.

When Rage is at maximum, it is used to perform a high damage ultimate attack:



Player Health, Energy, Rage HUD

As with the Boss health, the player's Health, Energy and Rage meters were relatively simple to set up, with the widgets set up to be progress bars and bound to the correct variables in the Character Blueprint.


When the character is initialized, the Health and Energy variables are set to maximum and the HUD is displayed to the screen.


And in game:


As stated previously, these HUD elements are good to use when tracking health in pretty much any game type.

Other uses include EXP gain for leveling up, Quest progress, for example if you are required to kill a certain number of enemies, and timers, say counting down to a bomb exploding, or capturing a control point in an FPS.

Enemy Debuffs - Speed/Burn

To allow the enemy to cast 'magic' style de-buffs on the player, we need to use a blueprint interface, to help the enemy and player character blueprints communicate with each-other.


Next, in the class settings of both characters, we need to register this interface, so that both blueprints know it is there.

In my boss enemy blueprint, I create the systems that will cause the debuffs to happen. The first one calls it directly, the second spawns a fire object, which attaches itself to the player, then calls the debuff.



In the player character, there are corresponding events which receive the calls via the interface and take appropriate actions.



The provided documentation didn't show how to implement the fire damage, so I decided to use a function timer which calls a function to take health off over time.

Not only is this good for magic attacks, it can also be used in helpful situations, for example a friendly NPC casting a heal spell on the player, which triggers a health restoration in the player blueprint.

Enemy Projectiles

One of the Long Range attacks from the Boss is a thrown rock.

The first task is to create the thing which will be 'thrown'. This involves making a projectile blueprint, which is one with the Projectile Movement properties.

This also contains a mesh to represent the projectile and some code to communicate damage to the player when a hit is detected.


The code in the Enemy will spawn the projectile on the enemy so that the projectile is facing the player, then the projectile code takes over and it goes flying at the player!


This is good to know for things like bullets, rockets, etc. but also these could be helpful things like a helper NPC throwing powerups or health at the player.

Activate Enemy

As we don't want the Boss going crazy trying to find the player as soon as we start the game, I've implemented an activation which will keep them 'dormant' until activated.

This code waits for the signal to activate the boss and set it's health.


I created a blueprint containing a trigger box which activates the boss and adds the Boss Health menu widget created earlier to the screen.


Enemy Health System Preparation

To give more of a presence to our boss enemy, we are going to add an on screen health bar.

This is a progress bar menu widget linked to the health of the boss enemy.


And the code which reads the enemy health and feeds it to the bar.


This is extremely useful for not only enemy health bars but for the player as well.

Health, energy, rage can all be created in the same way.

This would be useful for creating a 2D fighting game. The two players health, and their special bars could all be done in this exact same way, shown on the screen.

Enemy Attack Distance Check

To allow our enemy to perform different attacks depending on the distance from the player, we require a Distance Check.

The code below finds the distance to the player then compares the distance check to feed into performing different attacks.


These attacks are set up in a similar way to our player character in that they play animations which have animation montages that activate and deactivate collisions on the enemy limbs.


And the Collision Controls


This is quite versatile in that the enemy can be controlled in any way depending on the distance from the player. It doesn't have to be an enemy it could be a helpful NPC who when close to the player will heal them, and when father away will throw helpful items to the player.

Enemy Follow Setup

The creation of a NPC or enemy character is similar in setup to the creation of a player character at first.

The main difference is that the movement is controlled by blueprints, which allow the NPC to perform program controlled tasks.

Our NPC is an enemy, so we want it to find the player!

This piece of blueprint code allows just that, finding the player position and telling the NPC to move towards that position.


I noticed that when the NPC was moving towards the player, it's animation was glitching. This appeared to be caused by the enemy's speed being reset every time it received a new move to command.

In my version of this code there is a temporary variable which stores the speed before the move command, and feeds it back into the character afterwards, allowing it to keep the same speed constantly and avoiding the animation glitch.