# What happens when a character attacked in fighting game?

I went through many websites explaining fighting game systems, frames, hitboxes, but i couldn' find the answer so i ask here.

Basically fighting game hitbox system works like this :

1.Player A starts attack(startup frame). *No hitbox exists yet.

2.Startup frame finishes, Attack frame hitbox collides Player B and B takes damage(active frame) *Hitbox exsists now.

3.Player A performs attack finishing move(recovery frame) *No hitbox exists now.

What im curious about is, on step 2, let's suppose total active frames are 3 and then B will get punched 3 times in a row, which is unconvincing...

Maybe adding some invincible frame for Player B will solve the problem, but because Player A's active frame counts will be vary on the moves(normally fighting games have so many attack moves.), calculating every invincible frames per moves will be pain(or not? I haven't tried this method yet:P).

I wonder how other fighting(or action) games solve this kind of problem. Please help! (*And sorry if my english was bad...its not my native language.)

• Fighting game mechanics can be implemented in various ways. You seem to be quite specific about yours; what are you basing this on? – Jari Komppa Apr 15 '14 at 10:24
• Basically i'm planning on XBLA's The Dishwasher style 2d hack&slash game. I wanted to implement more precise fighting system so I took a lot of systems from fighting games. – Sulga Apr 15 '14 at 11:28
• You should edit your question to specify that, because questions asking how other games did something are off-topic here. – user1430 Apr 15 '14 at 15:16

Easy solution 1 : you can mark each attack move with a unique identifier that is regenerated every move, and mark each character with the identifier of last hit received. If during a frame collision the last hit received id matches the attack id, do not count it as a hit. In case there are more than 2 characters, one attack can still hit multiple opponents.

Easy solution 2 : Mark each attack with a boolean flag of “effectiveness”, i.e. whether the hit was delivered to someone or not. When a collision occurs, checks if the flag is set. If it is unset, proceed to perform the hit, and set the flag. If the flag is set, just skip the collision. In case there are more than 2 characters, one attack can hit at most one opponent.

Less easy solution 3 : If there is a hit, consider the next attack frame to be finishing moves frames, without any hitting box. Can hit multiple opponents, but only at the same frame.

• Solution 1 seems reasonable to me cause i'm planning a hack&slash style 2d game. Thank you for the answer! – Sulga Apr 15 '14 at 10:18
• You're welcome. I failed to mention that in solution 1 you must regenerate the unique id every attack. – Lærne Apr 15 '14 at 11:16
• Oh i see. Just make an integer variable on runtime and increment it for each attack, and assign it as attack id would be enough i guess. – Sulga Apr 15 '14 at 12:07

I am also working on a fighting game and I am doing this by having a Move structure which contains different parameters of an attack (or neutral move) including active frames if any. I keep the active frames in a container which I can delete from. Each frame I reset the properties of every hitbox of my character to default, and after that I activate each one of them, which is needed if there is an active frame currently.
If a hit occurs then I remove the current active frame from the Move containing it. I also remove every active frame if my animation finished has ran through it. An active frame can also have a maximum hit count counter which depletes if it hit once and the frame only gets removed if it is depleted.

(This is a method which works for me for the time being, but the game is not fully developed so there may be problems arising from this later (but I hope not))

• Thank you for the answer, it's a bit complicated but sounds reasonable for complex fighting game. I'll give a shot if system gets more complex. Thanks! – Sulga Apr 15 '14 at 10:21
• It is not that complex if you think about it, the focus is just to remove the active frame if it hit. If you got that working you can extend the system further. ;) – János Turánszki Apr 15 '14 at 11:54
• Oh thats more simple and easy explanation, i understand your point. Thanks:) – Sulga Apr 15 '14 at 12:08