I wanna make a fighting game! A practical guide for beginners — part 7
Hit stun and combos — or how to setup a combo system for your game and which pitfalls you need to care about
The seventh entry in this running series of tutorials about making a fighting game moves again into “beginner level” territory. After two fairly technical articles on determinism and input buffers, which are about fundamental concepts for a responsive game with online modes, we go back to square one and tackle one of the fundamentals of modern fighters: combo systems, hit stun, and everything that can go wrong with them.
Anatomy of a combo
In fighting game terms, a “combo” (short version of “combination”) is a series of attacks that hit the opponent in sequence and are guaranteed after the first of them connects. In other words, combos can be used to deal consistent damage, as — aside from certain exceptions — cannot be escaped once the first hit has landed. Despite originally being just a glitch in the original Street Fighter 2, the concept gained popularity and became a staple in the fighting game genre.
As of 2021, there are very few modern fighting games that do not have combos, with significant outliers like e.g. Divekick and HYPERFIGHT, thus it is pretty much expected that your game will allow them, in one way or another.
But how does a combo work? To get to this point, we need to talk about the concept of “hit stun”.
Hit where it hurts
Hit stun is a concept that can be found in a plethora of game genres and is a catch-all term to indicate the time a character cannot act normally after being hit. During this state, the actions that a character can perform are severely limited: some games allow for specific defensive maneuvers to be activated while affected by hit stun, but the number of such options can be counted on the fingers of one hand at most.
While a character is in this unactionable state, every follow-up attack by the opponent is guaranteed to connect — thus creating a combo — provided that it is fast enough to come out before the hit stun runs out.
In game development terms, when an attack hits the opponent, we start a timer that ticks down at every update. When the timer reaches zero, the character that was hit exits the hit stun state and can act normally again.
Here you can find a pseudocode example of how this might look like — notice that this is not runnable code, it is just something to help you thinking about the concept in terms of logic:
If the defending character is not yet in a hit stun state when being hit by the opponent, the combo counter goes back to one. Otherwise, a new hit will increase the combo counter. The hit stun value is kept track on by each character’s update function and decreased at every logic update. When the hit stun timer reaches zero, the defender is free to move again, and the combo naturally drops.
Juggling left and right
So far, so good. We went through the basic concepts and ideas behind how a combo works “behind the curtain”. Of course, there are also variations of the basic formula highlighted above. For example, the Tekken series and 3D fighters in general are better known for their “juggles”: after having sent the opponent flying with specific moves, you can keep on hitting them while they are in the air and until they fall back to the ground, where they become actionable again.
The core concept is substantially the same, except our hit stun is now affected by how long the character will stay in the air after each hit, ending only when they finally land.
To schematize this interaction in programming logic, you can use the same example as before, just adding a condition that doesn’t remove the hit stun state until the character lands on solid ground.
Of course, you might want to tweak your system specifically for juggle combos: you might want to have some moves not able to hit an airborne opponent or — in turn — have moves that work specifically for that purpose. This fine balancing is required for a satisfying combo system. There are some examples in the wild worth taking inspiration from: ROBO OH, a retro indie fighting game, doesn’t allow normal moves to juggle a launched opponent, unless using specific resources, and limits the combo potential by making only attacks that require super meter be able to keep the combo running.
But no good thing lasts forever — and so, combos too, must be somehow limited.
Stopping infinites in their tracks
Okay, so everything is nice and dandy. We have our hit stun counters, we have our juggle system, we play our game prototype… and we find out that we can perform an infinite combo just by keeping on pressing the jab button over, and over, and over.
“How could that possibly happen?” is the first reaction one might have, but the answer is simple: you didn’t put enough care in adjusting your move properties and frame data. Frame data are an internal representation of how a move works. You can roughly use them to understand which move can be used in a combo and which doesn’t.
A move is usually comprised of three distinct phases:
- startup: the phase where the move cannot deal damage;
- active: the phase where the move can deal damage;
- recovery: the phase where the move isn’t dealing damage anymore and the character is unactionable (notice that in some cases, this phase can be shortened or skipped).
If you find yourself in this “infinite jab combo” situation, it can mean that the recovery and startup of the jab move are too fast compared to the hit stun value applied on hit. For a concrete example, let’s suppose we have a move which becomes active on frame 4, is active for 1 frame only and has 3 frames of recovery. If that move applies e.g. 9 frames of hit stun on hit, this means that the SAME move will be able to hit again for free, over and over and over, since the recovery plus startup adds up to 7 frames, potentially causing an infinite combo.
Why “potentially”? Well, frame data are not everything. The move in question might combo into itself but have very short range, pushing the opponent out of harm’s way after the second repetition. However, not thinking enough about this aspect can be a recipe for disaster (or for a very fun game precisely based around infinites, depending on how you play your cards).
The Holy Trinity: damage scaling, gravity scaling, hit stun scaling
Stopping infinites in their tracks is just one of the concerns of building a good combo system. Ideally, you don’t want a player to be able to juggle the opponent around the screen for the next 255 seconds (admittedly, there are games that strive around that concept, but you DON’T want to be on the receiving hand of one such combo, do you?). This is where three different kinds of scaling come to the rescue:
- damage scaling: the longer the combo goes on, the smaller the damage of each hit. There are several ways to implement proper damage scaling, and it might be a topic for a next article in this series, but the basic idea is that each hit of a combo deals progressively less and less damage. The simplest, suboptimal implementation is a linear function that applies a decreasing multiplier to the damage of the next hit, proportional to the current combo counter. This has drawbacks when dealing with e.g. multi-hitting moves, so a more refined solution might be required;
- gravity scaling/increasing pushback: that juggle cannot go on forever, right? To avoid having a character spend more time in the air than on the ground, you can decrease the height at which they are sent with every following hit or send them farther and farther away as the hits connect. This means that, as the combo draws longer, the juggled character will be nearer and nearer to the ground and/or farther from the attacking player, eventually shutting down the combo chances entirely. However, code this wrong, miss an overflow, and you get Hokuto no Ken;
- hit stun scaling: you may want to have moves that combo a certain number of times into themselves, there’s nothing inherently bad or fiendish about it. This is where hit stun scaling enters the fray: each new hit in the combo may apply a multiplier to the hit stun gain, effectively reducing the time a player has to string a move into another the longer the combo goes. Anime fighters (like Dragon Ball FighterZ) make use of this type of scaling to eventually put an end to their already long combos.
Notice that you don’t have to implement ALL of these in your game, but a sensible combination of any the three above can and WILL make a difference.
One, last nuclear option: infinite combo prevention systems
Even with all of the above in place, there might be weird edge cases or borderline silly, unexpected interactions that can still result in an infinite combo. Not even blazoned games like Street Fighter V are immune to this — see the infamous Danfinite that plagued the game shortly after the eponymous character Dan was added as a DLC to the roster.
Thus, to be absolutely sure you have an option to prevent this, on top of damage scaling, gravity/pushback scaling and hit stun scaling, you can add yet another safety system in place that:
- automatically breaks the combo after a certain amount of time or a certain number of hits have connected or…
- gives the comboed player an option to break the combo if they make a correct guess (as it works for example in Killer Instinct and Skullgirls) or…
- both of the above, at the same time, with various amounts of tweaking.
Summary and conclusions
Combos are a prominent feature in modern fighting games and something most of the new traditional fighting games must include.
Combos are tied to building hit stun when hitting the opponent, causing them to be unable to act for a short amount of time, in which a second move can hit them again, thus building up unescapable damage.
Infinite combos are usually detrimental to the player experience, so you need to hamper or keep them under control somehow. For doing this, you can use a combination of damage scaling, gravity scaling, hit stun scaling and — in case of need — a hard limit on the combo itself, be it time, damage or number of hits.
Balancing a combo system and hit stun generation is challenging, but it is fortunately a sort of solved problem with a lot of practical examples. You just need to stick to your guns and tweak the systems to steer the game in the direction you want, by using some or all the tools we went through in this article, plus some you might invent yourself to add some spice to your game.
Notes, credits, and additional useful material
[1] Game: Divekick (PC), official screenshot from the Steam page: https://store.steampowered.com/app/244730/Divekick/
[2] Game: Street Fighter V (PC) — own screenshot: https://store.steampowered.com/app/310950/Street_Fighter_V/
[3] Game: Tekken 7 (PC) — own screenshot: https://store.steampowered.com/app/389730/TEKKEN_7/
[4] Game: Beatdown Dungeon (PC) — GIF from my previous article on the game:
https://phil-airdash.itch.io/beatdown-dungeon
[5] Game: The Chaos Gene (PC) — own GIF: https://store.steampowered.com/app/1503000/The_Chaos_Gene/
[6] Infil’s fighting game glossary: https://glossary.infil.net/
[7] Street Fighter V Devs Fix Dan’s Infinite Combo By Making Him More Random [Kotaku]: https://kotaku.com/street-fighter-v-devs-fix-dans-infinite-combo-by-making-1846928265
[8] Hokuto no Ken — Advanced mechanics[Shoryuken Wiki, contains an explanation of what triggers the “basket combos”]: https://srk.shib.live/w/Hokuto_no_Ken/Advanced_Game_Mechanics
Other articles in the series
- Part 1 — Introduction;
- Part 2 — Design decisions;
- Part 3 — Characters as state machines;
- Part 4 — Hitboxes and hurtboxes;
- Part 5 — Determinism;
- Part 6 — Input buffers and “reading” moves;
- Part 7 — Hit stun and combo systems;
- Part 8 — Implementing a simple block/guard system;
If you are interested in more game-making tutorials, you can find me on Twitter at @AndreaDProjects. My DMs are open!