Difference between revisions of "Characters"

From Open Surge Engine Wiki
Jump to: navigation, search
m (Example)
(Engine 0.5.0 updates)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
  
Characters are human-readable .chr files located in the characters/ folder. They're used to create playable characters.
+
Character files are human-readable configuration files located in the characters/ folder. They're used to create playable characters and have the .chr extension.
  
See also: [[Level_specification#players]]
+
Each level has one or more playable characters. See also: [[Level_specification#players|How to set the players on a level]].
  
 
== Structure ==
 
== Structure ==
  
.chr files contain the following information:
+
Character files are used to specify the following data:
  
 
* the '''name of the character''';
 
* 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 '''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. See also: [[Sprites]];
+
* 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 '''sound effects''' this character uses: jump, brake, etc.;
* optionally, the name of a '''companion object'''. If specified, the companion object can be used to develop special moves. This object is spawned when the player is spawned.
+
* the '''abilities''' this character has: roll, charge, etc.;
** '''Note 1:''' the companion object should have the [[API_Reference#always_active|always_active]] flag specified;
+
* 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.
** '''Note 2:''' you usually want to make the companion object [[API_Reference#Cooperative_play|observe]] its owner character.
+
  
== Example ==
+
== Example: Surge ==
  
// ---------------------------------------------------------------------------
 
// Open Surge Engine
 
// http://opensnc.sourceforge.net
 
 
  //
 
  //
  // File:   characters/surge.chr
+
// Surge (example)
  // Desc:  character definition: Surge
+
  // File: characters/surge.chr
// Author: OS Team
+
  //
// ---------------------------------------------------------------------------
+
 
   
 
   
 
  character "Surge"
 
  character "Surge"
 
  {
 
  {
 
     companion_object                ".surge_companion"
 
     companion_object                ".surge_companion"
   
+
 
     multipliers
 
     multipliers
 
     {
 
     {
         acceleration                1.0
+
         acceleration                1.0   // modifies the acceleration rate
         deceleration                1.0
+
         deceleration                1.0   // used when moving in opposition to the current movement
         topspeed                   1.0
+
         friction                   1.0   // modifies the friction (since version 0.5.0)
        jump                        1.0
+
         topspeed                    1.0   // modifies how fast the character runs
        jumprel                    1.0
+
         jump                        1.0   // modifies how high the character jumps
         gravity                    1.0
+
         gravity                    1.0   // gravity modifier
         rollthreshold              1.0
+
         slope                      1.0   // affects the physics on slopes
         brakingthreshold            1.0
+
         charge                      1.0   // modifies the charge-and-release speed (since version 0.5.0)
         slope                      1.0                                                                                                
+
         rolluphillslope            1.0
+
        rolldownhillslope          1.0
+
 
     }
 
     }
 
      
 
      
Line 56: Line 48:
 
         springing                  13
 
         springing                  13
 
         rolling                    3
 
         rolling                    3
 +
        charging                    6
 
         pushing                    14
 
         pushing                    14
 
         gettinghit                  11
 
         gettinghit                  11
Line 66: Line 59:
 
         ducking                    4
 
         ducking                    4
 
         lookingup                  5
 
         lookingup                  5
         winning                    10
+
         winning                    17
 
         ceiling                    16
 
         ceiling                    16
 
     }
 
     }
Line 76: Line 69:
 
         death                      "samples/death.wav"
 
         death                      "samples/death.wav"
 
         brake                      "samples/brake.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''.
 +
 +
[[File:Supertux051.png|256px|thumb|left|SuperTux, a jump'n run inspired by Mario]]
 +
<br clear="all">
  
 
[[Category:MODs]]
 
[[Category:MODs]]
 
[[Category:Characters]]
 
[[Category:Characters]]

Revision as of 23:07, 29 August 2018

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