3rd Person Melee Prototype

This is my first prototype in Unity using PlayMaker. The goal of this project was to learn Playmaker and see how far I could take it to create gameplay quickly.  My idea was to create a prototype that mimicked Disney Infinity’s melee combat.   I created this prototype in 2 and a half weeks (100 hours). I did not make the environment, character model, or animations.

The initial steps I took to start the prototype:
Basic movement using Unity's Animation Controller

3rd person camera system

Combos, jumps, and other combat moves

Eventually I cut the jump because the raycast was not detecting the ground causing the player to be stuck in a falling state infinitely.

When I had a basic setup for the player, I moved on to the AI:

Copied the Animation Controller from the Player over to the AI giving it the same set of moves.

Scripted AI detection of the player using raycast and a sphere collider for range.

Calculated a vector(direction) for the AI to pursue the player.  

Created attack combos that the AI could perform at random, with also included a block.

The player could move and perform combat moves and so could the AI but they had no real combat interactions with each other.

For that, I had to attach colliders to their swords, body, and one for blocking. Each time a sword collider passed through a body collider it would detect it as a hit. When the collider for block was activated it would negate the damage.

At this point, I decided to move the characters to a prettier environment and use a better looking character model. The environment was setup nicely and all I had to do was refine some NavMesh in Unity, where I knew the fighting would take place.

Combat was probably the most challenging aspect to get to work and resolve issues for.  I setup health variables for the AI and the player.  I ran into 3 issues:

Any animation where the characters where near each other would result in a hit causing AI and Player to lose health being next to each other.

I could see the health in the inspector but it was not shown on screen anywhere

When the health was depleted nothing would happen to the AI or player.

To fix the first issue: The sword colliders for the AI or Player enabled only when they were performing an attack. I deleted the collider for blocking because it was overly complex. The simpler solution: While in a block animation, no health could be reduced.

For The second issue: I wired the health to the UI display in the form of healthbars for AI and Player.

Finally for the 3 issue: I created death states for both AI and Player when their health reached zero, which I felt was a good way to define a Win/Lost condition for the player.

After creating the prototype trailer at the beginning of this blog, I went back to refine a few things.

Camera and movement:
I felt the previous camera and movement system was rather restrictive and not very responsive. The camera also has limits on horizontal rotation and always snapped back to center when the player let go of the right stick. The new movement system allows for quick snappy 90 degree and 180 turns. The new camera system allows full 360 horizontal rotation, and only re-centers on command.

Dodge System:
I added a dodge system to add more gameplay to the 3rd person melee combat.

Overall I felt this was a good project to learn PlayMaker and rapidly prototype to create the type of gameplay I want. I hope to create more of these prototypes in the future and continue to sharpen my skills.