1
\$\begingroup\$

I am developing a 2D fighting game in C++. I have made the basic components such as moving, guarding and even a combo system that works perfectly well.

My main concern now is that I want the game to be as balanced as possible, and thus I am entering a testing phase. I am even requesting the help of my father to play against as no AI has been implemented (yet).

In the game you can chain attacks using a punch/kick (PK) button. But you can also charge the attack by pressing the PK button longer, which basically pauses the animation, resuming it when the attack is fully charged or the player releases the button. One thing that I have noticed is that if your opponent is simply pressing the PK button when being hit, it can counter attack pretty easily if you end up charging your attack. This behaviour basically makes charging useless, because it can never go through if your opponent knows that.

So my point is that I need to add a delay so that the counter cannot occur (I do not want it to, because the game is based on an actual PS2 game where you cannot counter that way - for the record, there is a way to escape, either by pressing the guard button, or by hitting a button at the right timing to teleport behind and counter).

To add this delay, I can either modify the actual duration of the "damage" animation so that it does what I want or I can internally add a timer where the character enters a state where he cannot do anything.

I would want to go for the first one, since that way you SEE that you cannot counter using a punch since you are still in the damage animation. But the thing is that each character has its own set of animations and thus in theory, the developer or the designer (which is me in both cases) can modify the duration of one character while the others still have an old value.

My question is thus more on the design level. Is it a good idea to let the timing be decided via animation duration? Is it what is actually done ? If I have fifty characters when I discover another timing issue, it would mean to modify the animation of each and every one of them... But adding a timer internally seems more like a patch that actual fine tuning...

\$\endgroup\$
  • \$\begingroup\$ Just a small idea about parametrization : You might set all correct times for a default fighter, then only use relative settings for the others. The other times would be defined by a factor (0.9 means 10% slower...) and/or a constant ( +20 ms). It would be easier to balance, because strong / weak character can be spotted easily. \$\endgroup\$ – GameAlchemist Oct 6 '14 at 16:44
1
\$\begingroup\$

Personally I am not a fan of tying up animations and states or events. I rather keep both of them separate and, if anything, sending events between them (think MVC).

You say that a timer seems like a hack, but actually I think the opposite is true. Doesn't stretching your animation length just to prevent your character from performing a counter seems even more hackish?

Since you give no details about your implementation, I will suggest some general tips. First, I guess your characters have some kind of state machine to control their behavior/animation. If this is not the case, you should give it a try. Then, the character would transit through the following states:

IDLE --(gets hit)--> HIT [play hit animation] --(after delay)--> HELPLESS --(after delay)--> IDLE

I think this implementation has several advantages, such as more faithfully represent the character state, being more flexible, and decoupling state from animation.

If you are concerned that much about players getting a visual clue of the HELPLESS state, you can add some kind of animation such as blinking, so that it becomes more explicit.

\$\endgroup\$
  • \$\begingroup\$ I am indeed using a state machine. The thing is that, either I transit from one state to another independently of the time that has passed (think of idle -> moving -> idle, which only depends on the input) or I stay in a state for a given amount of time. Sometimes I know it at "compile-time" (the time the character is thrown away after a strong hit) and can play an animation that repeats itself. But in a combo, the character is in ATTACK state, but stays so during the animation time, which varies depending on the attack. Therefore I cannot decouple states and animation that easily. \$\endgroup\$ – Nightzus Aug 11 '14 at 15:34
  • \$\begingroup\$ I am thinking of using a unique file to record the duration of basic and shared animations (such as precisely damaged but also flying or running). That way, I can tweak in one file, and every character will benefit from the modification(s). Would that be a suitable workaround ? \$\endgroup\$ – Nightzus Aug 11 '14 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.