Blog 670: I’d Like a Sword With You

What’s in a melee attack? A sword as swung in any other way would cut as deep — or clip through as much geometry, in this case. Video games!

I’m not worried about clipping, though. I’m worried about control schemes and how to organise my animations to fit. Since melee attacks are going to be the core combat mechanic of all games I intend to make henceforth, there is just a teensy bit of pressure to get it right.

Swords, Not Words!

As always, my problems generally stem from the fact that my character — in this case, the Epsilon, or All-Purpose Assault Mech — has two swords. My control scheme, on the other hand, has only one button with which to trigger an attack. (Left-click to attack/interact, right-click to move.)

When I built Project Y4 in Warcraft III, none of this mattered. The player was detached from the unit, giving it broad orders as if it was an army rather than a solo operative, and it fulfilled them in any way it saw fit. When it actually attacked, it was free to choose totally at random from a selection of animations and it wouldn’t make a blind bit of difference to the player commanding it. Left, right, upper-cut, downward slice, double cleave, headbutt — take your pick.

I could have made more, but then I noticed some structural deficiences which would have made it dislocate its joints for any more flamboyant sequences...

I could have made more, but then I noticed some structural deficiences which would have made it dislocate its joints for any more flamboyant sequences…

My attack system is a bit more complicated than WC3‘s, though. There, an animation is played and damage is done to a single enemy at a specific point in time. Good enough for a strategy game where minutiae are submerged in a mess of ten or twenty individuals, but not so ideal for a game where all your attention is focused on a single character.

So my blades swing through the air, damaging either nothing or any object that they pass through — there is no coupling between you and a target, there is only you and whatever is in the arc of your swing. That means I have three segments to any attack: drawing the blade back, slicing the air, and recovering. Ostensibly, fine, have a single animation and turn the damage taps on and off at the right moments — I already did this, right at the beginning.

How this will fit into the game’s controls is what is worrying me. When you’re totally detached, precise timings aren’t important at all. The character does its own thing in its own time, and you effectively watch the proceedings. When you’re in direct control, however, I wonder how long things like “drawing the blade back” can take before the player gets angry that the character isn’t responsive, and I wonder how people will feel about the unit arbitrary attacking with its left or right arm.

Luckily, the Epsilon's blade-wielding turret fits snugly onto the existing Delta legs -- so it gets walking, running and jumping for free. (This will eventually cause a whole other set of synchronisation headaches, but those are for another day.)

Luckily, the Epsilon’s blade-wielding turret fits snugly onto the existing Delta legs — so it gets walking, running and jumping for free. (This will eventually cause a whole other set of synchronisation headaches, but those are for another day.)

Bearing in mind that the baseline attack cycle lasts no more than 0.8 of a second, I may be overthinking all of this. Is it okay to sacrifice 0.1 or 0.2 of a second to drawing the blade back, or would that be so short it won’t even be visible in-game? How long do I require for recovery, and if the mech has two arms should I let the second arm commence an attack before the first has fully recovered?

I don’t have a definitive answer yet, so I’m going super-granular to hedge my bets. I’ve split up my attack animations into the three distinct parts I mentioned above — they play in sequence but, crucially, the speed of each segment can be controlled independently. Each segment has its own duration, and I scale the speed of each to match durations specified by the weapon currently being wielded. This means I can fine-tune the settings as I go, and then introduce heavier weapons that require longer recovery times.

I still have so many worries about how this will pan out, but I suppose that ultimately, there’s no substitute for simply slamming it in and seeing how it feels…

Advertisements

And you tell me...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s