Sunday, April 11, 2010

Bitchslapping

While making a game you'll have to treat yourself once in a while. That ussually comes down to throwing a machinegun somewhere in the game so I can start shooting lights from the ceiling. This time I decided to introduce some other type of violence: boxing. Most zombies and other monstrous types do not have a weapon license, so I had to teach them some Mike Tyson lessons anyway. What is a game without getting pummeled?

When I did my first 2D fighting game ~8 years ago, I had my sprites killing each other within hours. This time however I spend an entire week on getting that stupid DumpBot performing a punch, and not just because my animating skills suck. How come?

Anyone who programmed a more "universal" (game)engine knows that the abstraction of things can deliver you quite a lot more work. With quick & dirty programming it's easy to quickly add specific jobs such as controls, object behavior, performing a move, firing a gun or enemy AI. However, each new specific "thingy" may require another block of code, resulting in a big mess.

Universal code/modules on the other hand should be reusable for a wider range of tasks. A single punch isn't just a punch anymore. The same mechanics must work for kicks, mauling dogs, vomiting Matroskas, nunchucks, swords, headbutts, giant Japanese battle robots, and Chuck Norris. So prepare yourself for a lot of work. But once you got it, even Steven Seagal must admit it's usefull.

You want some too? Take that communist bastard!

When I decompose that punch into sub effects/techniques, a whole list suddenly appears:
- What exactly happens when I press/click the action button? Depends on what I'm controlling at that point... a soldier, a tank, or maybe BA Baracus...
- Battle pose (raise fists, wanna get some punk?)
- Torso punch animation (while the legs may keep walking)
- Retract animation after hitting something (instead of, oops, fistf#cking a concrete wall)
- Let the torso and fist animation follow your mouse (watch up and down)
- "whoosh" sound
- Collision info. How to check that swinging arm?
- Impact sound. Fist on flesh. Fist on glass. Fist on Guinua pig. Colossus fist on house. Axe on head. Lightsaber on Jar Jar... So many combinations.
- Physics. Launch head with 40 kiloNewton after succesfull baseball strike.
- BIF!, BLAM!!, CRIKEY!!! Batman sprite effects, in case you like them.
- Blood splatters on the wall. Or green soup for the German variant.
- Debris, smoke, sparks or dust on impact.
- Impact decals; cracks in the walls, bumps in your new car, scratches in your face.
- Bonus points for the Sender, enable combo's.
- AI Script callbacks on hit or miss.
- Environment script callbacks for environment (Streetfighter II crowd goes wild, alarm goes off, kill 20 enemies before you can continue, and so on)
- Oh yes, and health reduction of course. Activate ragdoll if it's dead, or trigger an "ouch" animation. And don't forgot to make a difference between kneeshots, headshots or kicks in the balls.

And probably I still forgot a few things. When looking at that list I realize I'm not even halfway. Physics, sounds, collision detection and animations finally work. But I still need that Batman "BONK!" sprite effect.

"Pigboxer"

No comments:

Post a Comment