Characters

From Open Surge Engine Wiki
Revision as of 23:07, 29 August 2018 by Alexandre (Talk | contribs) (Engine 0.5.0 updates)

Jump to: navigation, search

Overview

Character files are human-readable configuration files located in the characters/ folder. They're used to create playable characters and have the .chr extension.

Each level has one or more playable characters. See also: How to set the players on a level.

Structure

Character files are used to specify the following data:

  • the name of the character;
  • the multipliers. These values are used to specify how fast a character runs, how high it jumps, how fast it accelerates, etc. For example, if you set the acceleration to one, it will accelerate by the default rate (set by the game engine). If you set it to two, it will accelerate two times faster than that. If you set it to 0.5, it will accelerate by half of the default rate, and so on. By default, all the multipliers are set to 1.0;
  • the animations for each action the character performs: walk, run, jump, etc., as well as the sprite name. See also: Sprites;
  • the sound effects this character uses: jump, brake, etc.;
  • the abilities this character has: roll, charge, etc.;
  • optionally, the name of a companion object. If defined, the companion object can be used to develop custom abilities. This object is spawned when the player is spawned.

Example: Surge

//
// Surge (example)
// File: characters/surge.chr
//

character "Surge"
{
    companion_object                ".surge_companion"

    multipliers
    {
        acceleration                1.0    // modifies the acceleration rate
        deceleration                1.0    // used when moving in opposition to the current movement
        friction                    1.0    // modifies the friction (since version 0.5.0)
        topspeed                    1.0    // modifies how fast the character runs
        jump                        1.0    // modifies how high the character jumps
        gravity                     1.0    // gravity modifier
        slope                       1.0    // affects the physics on slopes
        charge                      1.0    // modifies the charge-and-release speed (since version 0.5.0)
    }
    
    animations
    {
        sprite_name                 "SD_SURGE"
        stopped                     0
        walking                     1
        running                     2
        jumping                     3
        springing                   13
        rolling                     3
        charging                    6
        pushing                     14
        gettinghit                  11
        dead                        8
        braking                     7
        ledge                       10
        drowned                     9
        breathing                   12
        waiting                     15
        ducking                     4
        lookingup                   5
        winning                     17
        ceiling                     16
    }
    
    samples
    {
        jump                        "samples/jump.wav"
        roll                        "samples/roll.wav"
        death                       "samples/death.wav"
        brake                       "samples/brake.wav"
        charge                      "samples/charge.wav"
        release                     "samples/release.wav"
    }
    
    abilities
    {
        roll                        TRUE
        brake                       TRUE
        charge                      TRUE
    }
}

Compatibility notes: multipliers friction and charge, animation charging, sounds charge and release, as well as the abilities block are available since Open Surge version 0.5.0.

Curiosity: Tux

Even though Open Surge provides built-in 360º physics (with curvy roads, loops, and so on), careful modification of the character files can make it behave like a regular platformer. Example: if you create a character named SuperTux without the special abilities listed above, set its slope multiplier to zero (and adjust the others), as well as build levels mainly out of rectangular platforms, you'll end up with a platformer like SuperTux.

SuperTux, a jump'n run inspired by Mario