Melee Combat System Prototype

Made in Unity as a portfolio piece in about 25 hrs, with scripting done in C#

The goal of this project was to create a prototype of a simple, action, melee-focused combat system. I wanted the system to be simple and easy to use, but have some depth for those who get strategic.

Concept

Before starting designing, there were a few mechanics I had a feeling would end up working. I wanted a light attack that could be used quickly and would stun and lightly damage enemies. To complement the light attack, I felt there should be a heavy attack that would take longer to use, increasing risk of use, but would deal more damage and knock enemies back. To make these melee attacks feel resposive and intuitive to use, I felt that there would need to be a subtle, non-player-controlled targeting system.

In games with a melee combat focus, it is always a huge pain when there is one enemy left who is far away, and you just have to run all the way over to them to defeat them. And so I felt there should be some sort of ranged attack. Because this is a melee combat system, though, I knew the ranged attack needed to be fueled in some way by the melee attacks.

As a way of defending and getting around quickly, I wanted a simple dodge.

Light Attack

The light attack is triggered when the player quickly presses and releases the left mouse button. If light attacks are quickly strung together, the player character cycles through a list of attack animations. This makes each attack feel visually unique, even though each attack is technically the same.

When the player triggers a light attack, the player character's movement is slowed and the character lunges forward slightly. This helps sell the impact of the attack and makes the player feel more in control, making it easier to target specific enemies.

When hit by the light attack, enemies are stunned and very slightly knocked back. The stun cancels enemy attacks and pauses enemy movement, and the knockback creates a little breathing room for the player and gives visual feedback of the stun. There is also a quick particle effect burst and subtle screenshake showing that the attack connected with the enemy.

The light attack is meant to be quick and somewhat weak. It's power comes in successive hits, which is encouraged by having multiple attack animations. It can be used strategically in moments when the player can dash in, get a few hits off, and dash out. However, and aided by the fact that enemies are stunned by all attacks, the light attack can be “spammed” by players who are newer to games and less given to strategizing.

Where the light attack is least effective is when the player is surrounded by multiple enemies.

Heavy Attack

The heavy attack is triggered when the player holds down the left mouse button for a specific amount of time and releases. Unlike the light attack, the heavy attack plays the same animation with every use.

While holding the button down to charge the heavy attack, the player character's movement is slowed significantly, selling the strength of the coming attack. When the heavy attack is triggered, the player character's movement remains slowed and they make a large lunge forward. The damage radius of the heavy attack is larger than the light attack, making it more effective at damaging multiple enemies.

When hit by the heavy attack, enemies are knocked back significantly. This creates a lot of space for the player to dash away, charge up another heavy attack, aim for a ranged attack, or hone in on a specific enemy to attack with light attacks. As with the light attack, the heavy attack cancels enemy attacks and pauses their movement. There is a particle effect and screenshake to show attack connection and sell impact.

The heavy attack is meant to be strong, wide, and risky. It takes less than a second to charge, but that is more than enough time for an enemy to close the gap between them and the player character, especially with the player's movement slowed. It is more difficult to pull off than the light attack, but the payoff is huge. When paired with the quick, weak light attack, the slow, strong heavy attack rounds out the melee combat system.

Ranged Attack

The ranged attack is supplemental to the melee attacks. Each melee attack that hits an enemy adds one ammo to the ammo counter. The maximum amount of ammo that the player can hold is 5 so that the player doesn't stockpile, and therefore needs to keep using the melee attacks.

When the player has ammo, the ranged attack is fired by pressing the right mouse button. In the center of the screen is a small square meant to be “crosshairs”. With the utility of the third person camera, the player can aim by moving the mouse and landing the crosshairs over an enemy. If the player successfully hits an enemy with the ranged attack, the enemy gets stunned, pausing movement and canceling attacks. A small particle effect burst plays to show impact, along with a screenshake.

Intentionally, firing the ranged attack does not affect the player character's movement speed and does not interrupt melee attacks. This is allows for skilled players to fire their ranged attack at a distant enemy while maintaining their melee combo against closer enemies. The ranged attack can also be used on its own, of course, if the player needs or wants to take the time to focus, and it can be ignored all together.

Dash

When the player presses the spacebar, the player character performs a quick dash. Dashes are very short and there is no cooldown, meaning the player can dash as often as they can press the spacebar.

The main use of the dash is to get out of hairy situations. If the player is feeling surrounded or in danger, they can dash away and catch their breath. Another important use of the dash is to close distance between the player and an enemy when the player is ready to attack.

The dash covers fairly short distance, but can be used at any time. This allows for player expression and comfort. They can always dash the exact distance they need, whether that is one quick jump back or several quick lunges forward or anything in between.

Melee Targeting System

With this combat system, I knew I didn't want to use a Zelda-style Z-Targeting method of targeting enemies as that would require more inputs and more complication. Instead, I wanted to go for more of an automated, invisible targeting system similar to those seen in games like Nier: Automata, Devil May Cry, early God of War, and countless others.

In this prototype there's a subtle targeting system that changes slightly based on the player's inputs.

First is how it behaves when the player is not inputting any movement direction: When the player initiates a melee attack without moving the character, a list is made of all enemies within a specific range of the player character. The enemy who is closest to the player character is determined, and that enemy gets targeted. The player character rotates towards the targeted enemy and attacks, the attack's lunge inching them closer to the enemy.

This changes when the player is inputting a movement direction. When the player initiates a melee attack while moving, a list is still made of all enemies within a specific range of the player character. However, this time all of the enemies in the list are compared to the player character's move direction. If an enemy is outside of a specific angle of the player character's move direction, they are ignored. The closest of the remaining enemies becomes the targeted one. Once again, the player character rotates toward the targeted enemy and attacks.

This melee targeting system is meant to feel intuitive and seamless. When the player is inputting movement, the system adjusts the movement direction so that the player's attacks connect as they feel they should. When the player is not inputting movement, which would presumably happen when the player is caught by surprise or is a little slow to aiming when hitting the attack button, the game automatically chooses the enemy thought to be the most likely target. This should all be invisible, only making the player feel more in control and making the combat system feel more responsive.

Previous
Previous

Dilating Rifle System