Sign in to follow this  
Brain

Preventing "stun lock" issues in third person melee combat

Recommended Posts

Brain    18906

Hi all,

 

I am currently musing over how to handle hit reactions in melee combat in my third person rpg.

 

It seems that the most realistic way to react to being hit hard with a sword or axe is that the character doubles over or reacts hugely to the collision with a large metal weapon. This is what I've programmed my games animations to do.

 

The problem is that whilst the enemy is bent over in pain from the player attack they are unable to run away or hit back, therefore the player could hit them again and again whilst they are clutching their stomach or otherwise reacting badly to being hit.

 

While realistic it would make combat easy and boring as the first one to get a successful hit in would just pummel the other guy to death with no chance of defense.

 

My question then is how can I keep realistic hit reactions whilst avoiding "stun lock". To prevent the npc doing it to the player is simple, simply introduce delays to make it fair. It's more the player abusing the system to easily win confrontations I'm concerned with.

 

Thanks all!

 

Share this post


Link to post
Share on other sites
Polama    1105

Having the victim stagger backwards buys you a little time for animating, as does slightly slowing down the attacker's recovery, drawing their blade back, resetting their footwork. With a backwards stagger, you still have an issue if the victim is cornered, but that leading to a devastating combo might be acceptable since the victim screwed up his positioning so bad.

 

Another option is to stun attack but leave defensive actions. Maybe his offhand is on his stomach and he's a little bent over, but his sword arm will still parry off attacks as best he can. Getting a major hit then opens up an opportunity to push the advantage (you're temporarily pretty safe from counter attack) but no guarantee you'll land your next blow before he's recovered.

 

Share this post


Link to post
Share on other sites
Ryan_001    3476

In many old 2d side scrolling fighting games this occurred, the enemy when attacked would double over and after a few consecutive hits would fall down, then after a while get back up and continue fighting.  What balanced it was the fact that there were many enemies on screen at a time, so simply unleashing everything on one enemy while ignoring the others meant certain death.  In fact juggling this 'stun lock' was a very important skill in many of these games.  https://www.youtube.com/watch?v=PAs8iT2DNjI is an example.

Share this post


Link to post
Share on other sites
TheRelic    978

Have you thought of different attack recovery times?  If someone is getting a strong hit with a large sword or axe, it will take some time to "reload" aka bring the weapon back to a decent position before they can attack again.  A small sword or dagger may be little reaction and little recovery till next attack time and a very heavy blow from a weapon could in fact take a second or two to recover the weapon to a full ready to attack position again.  Basically your light, medium and strong attacks have differing recovery times for both the attacker and the defender.  Adding push back effect to stronger attacks might be a good idea too.

Share this post


Link to post
Share on other sites
The problem is that whilst the enemy is bent over in pain from the player attack they are unable to run away or hit back, therefore the player could hit them again and again whilst they are clutching their stomach or otherwise reacting badly to being hit.

The movie industry seems to perfectly agree with that:

 
I think it's not a problem as long as you don't make it first-hit-is-insta-win. A penalty for being hit as well as being knocked back adds depth, as long as it's not overdone. Stun-like penalties should happen occasionally or when a special skill is used, but not every time.
 
I'm currently implementing and experimenting with a system where each hit (even one entirely absorbed by armor) gives a small overall penalty which wears off after short time.
 
The idea behind that is that no matter what kind of hero in heavy armor you are, three peasants attacking you with clubs have a reasonable chance of taking you down (whereas one peasant has little or no chance against a knight with a sword). Zerging is an obvious problem in such a model, so there needs to be a reasonable cap. But otherwise, it seems to work pretty well so far (interesting for sieges where large groups of archers shoot volleys of arrows, too -- while you may be "immune" to single arrows due to your awesome armor, a volley still has a chance of hitting you).
 
Also, I'm playing with an optional amount of physics-relevant kickback (not just animations) according to weapon and opponent's size/strength. The idea is that with certain particularly heavy weapons, you may be able to effectively push back or swipe an opponent, including the possibility to push him off a bridge or into a chasm. This seems to be somewhat more problematic and less awesome for players, since it has a lot of insta-win potential (but it should still be great for elite or boss opponents, this has been done for many years). More experiments needed.
Edited by samoth

Share this post


Link to post
Share on other sites
DifferentName    1371

Not every attack should cause a stun, unless maybe you fight against crowds of weak enemies and want the player to feel much more powerful than the enemies. When fighting against a crowd, stunning one weak enemy isn't overpowered when you have other enemies attacking you from other directions. In Diablo, there's a short stun that you see on weaker enemies. I think it triggers when you damage a % of their health in a short time, so weaker enemies can get stunned by ordinary attacks while larger ones only get stunned from your biggest attacks (or not at all). You could also give some immunity or resistance to getting stunned again for a moment, so stuns can't be chained together every time.  

 

If the game is more about one on one fights, attacks that cause stuns might be followed up by a combo, but at the end of the combo the attacking player might have a delay long enough for the enemy to recover from their stun. I don't play a ton of fighting games (like mortal kombat and street fighter), but I understand these short stuns and combos are an important part of them. I think one key to this is fine tuning the timing of short stuns and attack combos. 

 

Mostly, I recommend playing similar games that you like to analyze how they do it. Then copy what works, and/or make it your own with your new understanding of the mechanic. And if realism gets in the way of good gameplay, consider dropping some of the realism.

Edited by DifferentName

Share this post


Link to post
Share on other sites
Brain    18906

Hi everyone,  thanks for the useful replies :)

 

Generally I am drawing from the appearance of elder scrolls oblivion but from a third person perspective. 

 

Under the hood though the combat is driven by a "fighting fantasy" style ruleset so whether or not a hit lands and how much damage it inflicts is a little bit of luck weighted by stats,  as well as the players skill.

 

I think a combination of cooldown on attacks and stagger back on stun will work well in my game (see my journal in my sig for an example of combat without stun behaviours)

 

The game already kind of has cooldown as an attack is a sword swipe or thrust which takes some time to execute and only damages whilst the sword is in overlap with the enemy mesh. Therefore you can't hammer the mouse button to spam attacks as they realistically animate and can't be interrupted once started, this element of combat works well.

 

Any further feedback here or on my journal is always appreciated!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this