main:garou

OVERVIEW


Garou - Mark of the wolves was my last game as an amateur before I entered to work on Commandos. The idea was recreate the arcade game with the same name in Windows with DirectX 6 (using an emulator to rip the graphics). At the end, just one scene and two fighters were added to the game, but the combat system and hit trees are almost complete, so to add new players must be relatively simple.


FIGHTER DEFINITION


All information needed by a player is defined using configuration files. Every fighter has this files:


  • Secuences: define all fighter animation secuences. Besides typical information (image file, pivot position, etc) every frame can have information about collision zones and attack zones. This zones are any number of rectangles that define if a frame can hit the oponent o receive damage from them. And a list of FXs (dust, sparkles,...) that the frame can generate.
  • Hits: define all hits and special moves the fighter can do. E.g. to define a weak punch and a hadouken we will do this:
  • # 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" ]
      )
    ]
                    

    HIT TREES


    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 builded. 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 a 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:


  • Check if that key generates a hit or a special move, this is, that key is a root in the hit trees.
  • Yes, WEAK_PUNCH is a root, so we look for the hit info that the tree nodes can contain. Just press WEAK_PUNCH generates a hit, so we saved this information and look further for a larger secuences.
  • Previous WEAK_PUNCH we founded FORWARD and is possible goes from WEAK_PUNCH to FORWARD in our tree, so we moved to it. FORWARD node hasn't hit information, so to this point WEAK_HIT is still active.
  • Previous FORWARD is DOWN, so we moved to it. DOWN node has hit information, so we saved it.
  • Previos DOWN is WEAK_KICK, but is not possible it goes from DOWN to WEAK_KICK, so we finish the process and return HADOUKEN found in DOWN node as hit to do.