Garou - Mark of the wolves was my last game as an amateur before I entered to work on Commandos. The idea was to recreate the arcade game with the same name in Windows with DirectX 6 (using an emulator to rip the graphics). In the end, just one scene and two fighters were added to the game, but the combat system and hit trees are almost complete, so adding new players must be relatively simple.
All information needed by a player is defined using configuration files. Every fighter has these files:
# WEAK PUNCH [ .KEYS_SECUENCE # keys necessaries to generate the hit (could be any number of them) ( [ .BUTTON "WEAK_PUNCH" ] # this constant (weak_punch) is linked to a keyboard key ) .STATES # valid states to do this hit ( [ .STATE "STANDING" .ANIMATION_SECUENCE "WEAK_PUNCH" .DAMAGE 5 ] [ .STATE "STANDING" .CLOSE 1 .ANIMATION_SECUENCE "CLOSE_WEAK_PUNCH" .DAMAGE 7 ] # a punch very close to other fighter and the damage is bigger. [ .STATE "CROUCH" .ANINATION_SECUENCE "CROUCH_WEAK_PUNCH" .DAMAGE 5 ] [ .STATE "JUMPING" .ANINATION_SECUENCE "JUMPING_WEAK_PUNCH" .DAMAGE 6 ] ) ] # HADOUKEN [ .KEYS_SECUENCE ( [ .BUTTON "DOWN" ] [ .BUTTON "FORWARD" ] [ .BUTTON "WEAK_PUNCH" ] ) .STATES ( [ .STATE "STANDING" .ANIMATION_SECUENCE "HADOUKEN" ] ) ]
When the fight begins, besides other things, the hits file is loaded and parsed and hit trees, where the last key of the combination is the root, are built. In the example above, the tree hit looks like this:
[ WEAK_PUNCH ] -> Weak punch hit | [ FORWARD ] | [ DOWN ] -> Hadouken
While the game is running, there is an input buffer where keys pressed are saved and the time that key has been pressed (if no key is pressed, every 100ms a no_key_id is inserted in the buffer). For example, if our input buffer is [ BACK, WEAK_KICK, DOWN, FORWARD, WEAK_PUNCH ] the steps when a key is pressed are: