The Art of Dodging

Greetings game devs! Today we’re talking about dodging, the different kinds of implementations for this mechanic, and things to consider when adding it to your game.

The different types of dodge

“What do you mean different kinds of dodge? You just get out of the way.”

That would be correct in the real world but in games dodging is a different animal. The implementation of which depends on what kind of game you’re making and the desired experience you are trying to give to the player. So what are the different types?

  • Displacement – The first of these methods is the one most people naturally go to when thinking of a dodge. We want players to have the ability out of the way of an attack and what better way than moving them quickly in a direction?
  • Invulnerability Frames – Grant the player a certain number of frames in the animation to receive no damage. This way, even if they technically get hit they can still avoid damage because their timing was on point.
  • Interference – I couldn’t find the technical name for this so I wrote down the first thing to come to mind. Basically when the player dodges it interferes with the AI’s targeting, fudging their aiming stats to make them far less likely to hit.
  • Statistical Dodge – The player can’t dodge but if an attack is inbound the game rolls a series of checks against one another to see whether or not the attack hits.

Pros and Cons

So why would you choose one over the other? It depends.

Displacement for example is a very easy method of dodging to implement.

User input direction + dodge button = Go fast that way. Profit.

This method works with games where players are dodging traps or even shooters. Big boulder coming the players way? Just roll out of the way! Enemies pouring lead on the players position? Sure they can sprint to cover but it would be much faster to throw themselves behind it, even if it means catching a few rounds.

But this doesn’t cover a lot of potential combat scenarios. What if the game has enemies with melee combat? The player dodged but they still got hit! What do we do?

This is where Invulnerability Frames come in and I learned this first hand when I was working on Reaver.

The problem:

Enemies tracked the player facing fairly accurately through the dodge and the size of melee weapons made it so players had to break off from melee combat to avoid a melee attack. We didn’t want that for the game, we wanted the players to bob and weave through attacks and keep pressing the assault.

The drawback to I-frames is that they take a fair bit more set up to implement because it involves knowledge of the number of frames in the dodge animation. At which frame in the animation does the player become invulnerable? What frame restores their vulnerability? These things are better sorted before animations are made. In our case we realized how important I-frames were for Reaver after. Thankfully we used jet packs to dodge so we got away with with an animation notify and a very small timer to maintain that invulnerability through the dodge.
With this in place, a player could time their dodge to move through an enemy attack and keep pressing the assault in keeping with the aggressive gameplay we wanted to have for Reaver.

What if the goal is to dodge bullets?

Interference will take care of this but it requires a lot more set up still. First you need to have an AI that doesn’t have perfect accuracy, they need a stat to interfere with that dictates how accurate their shots are. Once that’s set up, the dodge roll needs to notify any AI shooting at the player that they are dodging and temporarily change this accuracy stat.
EX: An AI normally has a 75% chance to hit a stationary player but when a player dodges their accuracy is reduced by 50%.
This way the player dodging into cover won’t just catch every single bullet aimed at them during the dodge. This looks even better with tracers so the player can actually see everything they just dodged.
“But Waldo I’m not making an action game! I’m making an RPG!”
Well that’s why you want a statistical dodge.
The implementation itself is fairly simple here. Whenever the damage function is called on a character it first has to run through whatever dodge chance they have. Using DnD as an example a character with 20 AC basically dodges any attack that doesn’t match or beat that score, and if that score isn’t beat, the character would have “Dodged!” or “Missed!” pop up over their head to convey what just happened.
The draw back to this method is that, on its own, it’s not very juicy. You’re going to have to find ways to make that dodge look more interesting than text popping up over their heads. This could be done through flashy animations or just pure tension like XCOM does it.

What dodge is right for your game?

Like all great questions the answer is: It depends.

Keep in mind the kind of genre you’re developing for and the design goals of the game. Simple platformer with traps? Displacement is the quick and easy way to go. Want a more intense, action packed combat experience? Definitely look at Invulnerability Frames and Interference.

As with any game design project, keep in mind the goals you and your team have for the game. The experience you want to craft for players.

Still can’t decide what kind of dodge to implement in your game?  Look at examples in the genre you’re developing for, the popular games in particular as they just might be doing something right!

Speaking of which that’s what I’ll be posting about next time. Examples of different games and how they handle dodging. Hopefully I can find some specifics on I-frames for the ones that implement them.

Add a Comment

Your email address will not be published. Required fields are marked *