top of page
Search
  • Writer's pictureJoshua Keene

Final Major Project - Combat

Developing the combat for this project has been the most challenging aspect so far and I think it will hold that title even after the game is complete. While I was very pleased with the AI I had managed to produce in such a short time I came to realise it was a far cry from what was required. On top of that I allowed feature creep to slip in and drive me to go beyond the plan of the project.


In the plan I was only going to have one enemy type as the combat is not the focal feature of the project, however I could not help but feel it would impact the fun factor of the game too much for it to be so simple. I decided I would add to more enemy types on top of the sword wielding base enemy; an unarmed enemy type that would suit well for use on skeleton enemies and a ranged magic type that would harass the player from a distance and encourage them to keep on the move and pay attention in combat.


I also decided that I did not want these enemy types to be separate to the existing prefab, so I created a custom editor script that would edit the enemy game object and its enemy behaviour script values (attack range, weapon, front arc etc.) based on an 'Enemy Profile' selected from a drop down in the inspector. This will be fantastic for allowing me to quickly switch out and test combinations of enemies for different combat encounters.

Moving on from the feature creep, an important feature I needed to add was ensuring only a limited number of enemies can attack the player at any one time. This allows the player to confront large groups of enemies and feel like they're fighting them all even though they aren't (Smith, 2009), that empowerment is crucial in this game to let the player take on the role of a highly trained and equipped Daemon hunter.

I achieved this by having a list of 'Engaged Enemies' on the player that enemies have to add themselves to before they can attack. If the list is at full capacity, they can't add themselves and they can't attack. Enemies also remove themselves on death and when they lose sight.


The animator for the enemies has also had to develop greatly from the AIs first iteration in order to accommodate the list of engaged enemies and the three enemies profiles.

The major developments from the previous iteration, aside from the vast increase in the number of attack and idle animations so that each enemy profile has a set of appropriate attack and idle animations to draw from, is the addition of a 'React' state and a cycle moving from chasing to engaged and back again.


The react states allows the enemies to react when hit by the player, this has a chance to happen with a light attack and is guaranteed to happen if the player uses a heavy attack, this adds another layer of tactical choice between using light or heavy besides the standard, one is slower but does more damage, as the guaranteed reaction can be used to interrupt and cancel out enemy attacks. The react state was similarly added to the player so that they have a small chance to be knocked back by an attack. Using similar logic, the player can also parry enemies, this is done with a well-timed tap of the right mouse button and triggers a react animation that looks like a parry and significantly reduces damaged taken.


The cycle from chasing to engaged and back again is to facilitate the enemies adding themselves to the list described previously. The move from the Chase state to the Ready states when they are in attack range and ready to engage the player if there is room on the list, if there is they move to the engaged state and if not the remain ready. Both the Ready and Engaged States have exit transitions back to Chase for if the player moves out of range. The other state, the 'RePosition' is for the enemy to back off and have another approach at the player, this was added as occasionally an enemy would engage and try to hit the player through another enemy which looked very silly and distracting. Enemies now check if there is another enemy between them and the player before attack and if so, they disengage and try to reposition to fix the problem.


The games combat in its current state can be seen in action in the video below, while there is still polishing to be done, I am very pleased with how developed it has become, exceeding the scope of the project plan.


18 views0 comments

Recent Posts

See All
bottom of page