Monday, 27 February 2017

Idea Generation for Computer Games - Summary

To summarise this unit, I feel I have learned a lot about the implementation procedure for characters in video games, though there is still a lot more to learn however, through breaks and issues I have learned workarounds and actual fixes to issues.
Whilst this is a 3rd person perspective action game. a lot of the blueprinting processes I have learned will be transferable to other types of games.
I'm not going to pretend that everything I have done has properly sunk in yet however, as I am pretty sure I would not be able to replicate more than two thirds of the work I have achieved if I was sent away to do this again with no assistance from the internet, for I have run into many stumbling blocks along the way. I feel I would have absorbed more of the functionality going into the physical blueprints if I had a thorough understanding of multiple types of variables and other such elements within the engine but time, amongst other circumstances has simply not allowed me to expand as much as I would have liked.

From what I feel has sunk in on the other hand, I have a good standing on a level from which to build my knowledge of blueprinting, character implementation and game design as a whole and I am happy with the progress I have made throughout the unit.
With the assistance of various YouTube videos and the Unreal Forums, I feel have been able to somewhat competently produce and fix where appropriate, an implemented character, NPC and a moveset for each.

Going forward from this point, any issues outstanding within my character implementation, as small as they may be, will be assessed and dealt with as and when I have the time to apply to them, and I will at some point try and expand further, adding in many more enemies as was my original intention due to my overall project within the academic year in level design. I will also be looking at implementing gunplay further into the development process, adding in a cover and blindfire system, adding firearms and the player's own thrown projectiles.

Idea Generation for Computer Games - Changelog v1.01

Since finalising my current character implementation setup, I have been able to implement controller support as I had previously wished to do. I did not realise however, that it would be as simple as it actually turned out to be.
As I had a controller at my side giving me the ability to test my build right away on implementation of each new button input, this made the process a lot faster also.

The simplicity of the gamepad input lays in the events within blueprints, as with a very quick search for resource on the matter I found a completely referenced layout of a controller, using Unreal Engine 4 terminology.


Taking this into account, I set the button layout according to my current blueprint, making use of the fact that two inputs can be set simultaneously to the same piece of code. My allocated controller functionality was mapped as so;

- Standard Attack/Combo: Gamepad Face Button Left (X on Xbox controller)
- Special Attack: Gamepad Face Button Top (Y on Xbox controller)
- Dodge Roll: Gamepad Face Button Right (B on Xbox controller)
- Switch Weapon: Gamepad Left Shoulder (RB on Xbox Controller)
- Shield Mode: Gamepad Left Trigger (LT on Xbox controller)
- Slow walk: Gamepad Left Thumbstick (LS on Xbox Controller)

I purposely set aside two gamepad functions for other features I decided to add;

- Jump: Gamepad Face Button Bottom (A on Xbox controller)
- Auto Lock-On: Gamepad Right Thumbstick (RS on Xbox Controller)

-----------------------------------------------------------------------------------

Elaborating on the two button inputs which had been left vacant for features to be implemented, I have also added an auto aim/lock on feature, set on a toggle, and a jump.

Firstly, the jump is a very simple animation setup, set up in accordance with the setup in the base character blueprint.


I simple have the Gamepad Face Button Bottom and Space Bar input options set into a branch, which makes sure the played is not attacking, switching weapon or currently jumping. This branch, when read as false, communicates with the next branch, which is set to read whether or not the player is in Sword 1 or Sword 2 mode, this then triggers the difference in animation, as both stances have their own jump animation.
The animations themselves are set simple with "set att montage" nodes and a 'play anim montage' node.


I have no current means to test the functionality of this within my level in terms of geometry, but I will be looking to perform a quick test and and when I get a moment, to see whether or not this jump allows me to mount higher objects. I would ultimately have liked a higher jump animation, but the animation in use is the one within the specific set of animations, I would add an upward launch value in but feel the jump would then look completely unrealistic.

-----------------------------------------------------------------------------------

Alterations have been made to the core blueprinting process of my NPC, which have now allowed my NPC to die successfully without firing off other attacks prior to the actor being destroyed, I have also allowed my character to die and respawn just outside of the battle area.
As the fix was slightly confusing I consulted my peers for any opinions and knowledge they may have been able to lend on the subject and I have subsequently fixed the animations to fire appropriately, making the NPC die upon hitting 0 health.

There still appears to be a very minor issues with collision components casting damage, but I am happy with having fixed what was more of a core problem.
This was a pressing issue which I am thankful I have been able to rectify before my deadline, as the the NPC was dying, but not dying properly, as it could still fire off attacks.

I will look to fix the collision issues also, but right now they do not appear to unbalance the game too much, the boss fight has a certain tier of difficulty and can be beaten, but can also beat you if given the chance.

-----------------------------------------------------------------------------------

The final piece I have added to this point is a lock-on feature, set on the Right Stick Button and Tab, on a controller and Keyboard respectively.
To set the camera lock, I needed to implement a timeline and gate into my blueprint, the Timeline set to enter the gate, and the toggle occupied by a series of 'get all actors of class' and 'lock on' nodes.
The gate is then followed by a cast to game instance followed by a 'Set Control Rotation' node which contains all of the appropriate rotational information necessary on every axis.
Any Roll/Pitch and Yaw information which is applied through the core camera sequence is then plugged into the new rotation socket on the eventual set control rotation node.

The final product of the lock on is set to a toggle so that when I click in the right stick once on the controller or hit tab once on the keyboard the camera will lock to the NPC, with another press being required to remove the lock and return the camera to free movement.

The structure of the blueprint can be seen below;



Idea Generation for Computer Games - Shield Setup.

For added functionality, which could ultimately be utilised as a blocking mechanism to void damage later on, I have implemented a shield stance, in line with the riot shield mesh I originally created.
For this, I needed to create a multi directional blendspace and add in each of the blocking strafe animations necessary. After linking the actual functionality in terms of how it would be used into the character blueprint, I needed to assign it correctly in the animation blueprint, and this presented a problem.

A prior error which had arisen for both me and my peers arose again, when changing weapons, after a single attack with the secondary weapon, the character would automatically switch back to the primary sword and shield combo.
Whilst the shield mode was meant to be given its own state machine and its own slot, referred to as 'waist', the animations did not sync correctly at all, and resulted in the character being able to move backward and forward correctly, but strafing both left and right with only the right strafe leg movement in use, giving the effect that the character was walking forwards, whilst moving backwards.

This issue was fixed by adding the shield mode into the initial motion state machine, and altering the animations in use within the blendspace, as the initial guideline for the blendspace simply did not work with the suggested animations.

After the animations were added and the shield mode connected correctly within the state machine, and after a simple hook up in the character blueprint, the shield was able to be visibly raised when not attacking. This animation in question  was hooked up to the right mouse button on the condition that no attacks were in progress, otherwise a special attack would be linked in instead.

Below is a shot of my motion state machine with the workaround fitted in, and a shot of my blendspace once fixed;



I had at this point, implemented everything I had been provided resource on, with only two features missing, this is a damage buffer for whilst the shield is raised, and an ultimate attack.
I am quite happy with where I am but I will be continuing to make tweaks as and when I get time amongst other work prior to my deadline for this unit.
I will almost certainly be blueprinting in a damage buffer whilst the shield is raised, to either stop damage being taken completely or minimise the damage received from projectiles only. This will be a design decision made on the basis that my NPC is a large mutant/alien and could easily breach the defences of a small shield with melee attacks.
I have made a design decision to not add an ultimate attack at this point in time as I do not think the ultimate attack variants I have been shown are either suited to my character, or appropriate for my theme. This is based on my character being a humanoid Bounty Hunter, with no superpowers to make such ultimate attacks work, only heart, determination and the will to succeed driving him onward to capture his targets.

The main features I am looking to implement right now, are a jumping animation and controller support. The jumping animations are not in any way necessary taking my level into account as every surface is mountable already so jumps are not really a requirement. I am looking to add the controller support so that my level can be played not only with a keyboard and mouse, but with a controller also. To test this functionality, I will be using both the Wired Xbox 360 Controller for Windows, but the Wireless Xbox One Controller for Windows also, dependent on my location and the operating system I have at my disposal.

Any further implementations I make from this point onward will be detailed in changelogs.

Idea Generation for Computer Games - Rage Meter

In addition to the health and energy bars within the UI, I have created a rage bar (Note the final product is not currently in use due to a design decision). This bar is set up somewhat like the health bar, however when attacks hit the player, rage is gained as opposed to lost.
Another difference between the two is that the bar fills from a central position, and not from the left hand side.

The damage dealing nodes within the script have a woven in "Get Rage" node, which call to a custom event that controls the Rage. The custom event itself decides how much damage is taken, in comparison to how much rage is received.

Below is a shot of a section of code, from the character blueprint, referring to the 'get rage' node and custom event;


The UI was all fairly straight forward apart from one minor hitch in the process that I should have noticed was wrongly placed sooner than I actually did, other than this though, the widget setup was simple and I had no other problems with the setup.

Idea Generation for Computer Games - Health and Energy setup.

The next pieces of the puzzle which needed to be made functional were the health and energy bars, represented in a HUD Widget using progress bars.

This was set up in exactly the same way as the widget which was applied to the NPC character implemented earlier in the overall procedure, only with more elements.
I added two progress bars and created progress bindings to allow the progress to be reflected based on a series of blueprints.
Once the levels of health and energy had been determined, I implemented the script within the character blueprint to allow these to interact with the respective 'min dmg' and 'max dmg' values which had been previously implemented into my system within a damage application string.

Once functional, I turned my attention to the energy depletion, and set the attacks to deplete my characters energy as previously seen, this further development however added some restrictions and varied amounts of energy required for specific moves.
Within each of my special attacks I simply set two extra nodes, one of which was a "Set energy' node attached to a minus float, and the other was a branch instructing the engine that if my characters energy was under a specific amount, any special moves could not be triggered. These branches made use of '>=' floats as I have used before in things like my distance check.

Below is a shot of a section of my blueprinting, showing that the special attack string can only fire if the energy levels meet the requirements, also shown is the dependency on certain moves within a primary combo to be active for the special attack to trigger;


Idea Generation for Computer Games - Energy Regeneration.

To implement a proper health and energy setup into my character, I needed to add in another set of functions, the first of which was designated to the restoration of energy following special combo attacks which use up energy.
Within the function itself, the maximum energy and amount restored in each chunk are set, this is then referred to by a custom event in the Character blueprint which sets the energy restoration speed, this is the speed at which the set amount of health is restored.

A stop on the regeneration is then implemented within the character blueprint, via a branch set so that the regen cannot occur whilst the player is attacking.

Below is a short clip of my energy bar setup, showing the restorative effect upon the use of a special attack through the heads up display in the lower left corner (The creation of which is elaborated on in the following post.);


Idea Generation for Computer Games - NPC implementation: Speed Debuff

Another effect I have chosen to use within my NPC setup is a speed debuff, cast directly at the player.
This is created through a Blueprint Interface, within the blueprint a speed debuff function is set and applied in blueprint class settings.

With the blueprint set appropriately, the NPC character blueprint can be rigged to cast speed reduction, this would be in the form of a call to a custom event, in this case named 'cast_speed_reduction', this in turn is linked to a message node, utilising the Speed Debuff within the NPC Debuffs blueprint interface.
Switching from the NPC to the character blueprint, this is also linked in turn to the NPC debuffs, casting a straight reduction in speed reflected in character movement in game. This is set using a simple branch, with the condition being set to Sword 2 mode, therefore allowing two different speed reductions.
Once the duration of the debuff has passed, the player will return to the respective normal running speed for the weapon they are carrying.

Below is a snippet of the blueprinting setup used to make the speed debuff function;


Having completed the movement and attack setup of my NPC, I feel as though I have learned some more, albeit not as much as I learned through the creation of my own playable character. This is only down to the fact that the character attacking sequences are somewhat still fresh in memory, and I am sure I'll still benefit from the knowledge of setting up NPC attacks.
On reflection I feel I have learned a lot more vital information about pawn sensing, debuffs and projectiles, this is all information which will be transferable, along with everything I have learned into any projects going forward from this point on.