Custom character tutorial/S_SKIN

From SRB2 Wiki
Jump to navigation Jump to search
  Custom character tutorial [view]

Chapter 1: OverviewChapter 2: S_SKINChapter 3: SpritesChapter 4: Character select


Constructing the S_SKIN lump may be the easiest place to start when designing a custom character. If you already know how fast you want your character to run, what ability it has, how high it can jump, etc., you can start by making an S_SKIN lump to set the appropriate attributes. This chapter explains how to set up the S_SKIN lump – some parts will require you to have already created some sprites for your character, which is covered in the next chapter.

Creating the S_SKIN lump

You can create the S_SKIN lump directly in your lump editor by creating a new lump, naming it S_SKIN and typing out the contents inside the editor. Alternatively, you can write it as an external text file in a text editor such as Notepad and then import it into your WAD or PK3 file with a lump editor and name it S_SKIN.

S_SKIN's placement in the WAD or PK3 file is very important: S_SKIN must be placed immediately before the character's first sprite. The reason for this is that once SRB2 reads an S_SKIN lump, it automatically tries to look for all of the character's sprites – in order – directly after that lump. If they're not directly after S_SKIN and another type of lump is there instead (e.g., a SOC lump), the game will crash. Note that if want to put your character's sprites appear between the sprite markers S_START and S_END (which is not necessary), you must place S_SKIN in-between these lumps as well; as long as S_SKIN appears directly before the first sprite, SRB2 will still recognize them as your character's sprites.

Format

The format of text within S_SKIN is very similar to that of a SOC lump – it consists of a list of parameters and their values. Text in the S_SKIN lump is not case-sensitive, e.g., the parameter "realname" could also be written as "REALNAME", "RealName" or even "ReAlNaMe".

When placed at the start of a line, the # (number sign, or hash) symbol is used to signify the start of a comment, just as in SOCs. However, comment lines can also be started by placing two forward slashes (//) at the start of a line.

The following is a typical example of what an S_SKIN lump looks like:

name = Idreia
ability = CA_DOUBLEJUMP
ability2 = CA2_NONE
normalspeed = 36
thrustfactor = 3
accelstart = 112
acceleration = 42
startcolor = 200
prefcolor = Wave
supercolor = Sky
prefoppositecolor = Peridot
jumpfactor = 1

There are many parameters that can be supplied in the S_SKIN lump; not all of them have to be supplied for a character, however. Any parameters that are left out will be set to default values. The full list of parameters is located at S_SKIN > Parameters.

Constructing the S_SKIN lump

This section explains how to create an S_SKIN lump for your custom character from scratch.

Step 1: Identification

Your character's S_SKIN lump should start off with the following parameters, which are required for the game to identify or represent the character with:

  • name: This is the name of the skin for your character, which is used internally for identifying the character within the game – e.g., the skin console variable will require you to type this name out to switch to this character. For this reason, you should choose a unique name that is memorable and can also be easily typed out (if possible). Spaces are not allowed; use underscores (_) instead. If another skin of the same name is added to the game, the game will automatically add a number to the end of the latter skin's name. To avoid this, ensure that your skin name is unique, for example by adding by your own username or an abbreviation of it to the end.

By default, the name parameter's value will also determine the name displayed for the character everywhere in the game. If this is not wanted – for instance, if your character's name parameter has your username in it to prevent clashes with other custom characters – the following parameters can be used to deal with this:

  • realname: This determines the "real" name of your character to be displayed by the game in general, e.g., on intermission screens, the multiplayer character select screen, etc.
  • hudname: This determines the name of your character to be displayed next to the life icon on the HUD. For example, the hudname for Knuckles is K.T.E. It is recommended to keep this name short so that it fits above the lives counter.

If either one of the two character name parameters above is given but not the other, the game will automatically copy the value for the one you have given to the one you have not included. Neither of them are required to be unique, unlike with the name parameter.

Step 2: Statistics and abilities

Next, you should determine what statistics and abilities your character will have; these are important as they define how the character plays through levels in SRB2. At this stage it is recommended to regularly test out your custom character in-game, and experiment with different stats to find what works best for your character. If you have not yet prepared any actual sprites for your character, use placeholder sprites in the character's WAD or PK3 file for the time being.

The following parameters should normally be set to determine the character's speed statistics:

  • normalspeed: This detemines the character's "top speed" – i.e., the maximum speed in fracunits/tic your character can move up to. The values for SRB2's default characters are 36.
  • accelstart: Together with acceleration and thrustfactor, this value makes up your character's acceleration. When you start running from a complete standstill, this value determines how fast you will accelerate initially. The values for SRB2's default characters are 96.
  • acceleration: As your character starts gaining speed, the acceleration increases until you reach the top speed. This value determines how fast your acceleration increases. The values for SRB2's default characters are 40.
  • thrustfactor: This value is multiplied onto both accelstart and acceleration to form your character's acceleration. The values for SRB2's default characters are 5.

These parameters determine the character's abilities:

  • ability: This determines the character's primary special ability – this usually determines the action your character performs when pressing the Jump button in mid-air. Examples of a primary ability include Sonic's thok, Tails' flight and Knuckles' glide and climb abilities, which would each be given as CA_THOK, CA_FLY and CA_GLIDEANDCLIMB, respectively, for this parameter. If the character should not have a primary ability, CA_NONE should be used here. A full list of primary abilities, along with full details on each, can be found at S_SKIN > ability.
  • ability2: This determines the character's secondary special ability, such as whether to spindash (CA2_SPINDASH) or not (CA2_NONE). A full list of secondary abilities, along with full details on each, can be found at S_SKIN > ability2.
  • actionspd: For some primary abilities, this parameter determines the speed the character moves at when performing the ability. The exact effect of actionspd on the character may differ depending on the ability you chose for your character; some may not use this parameter at all, in which case this parameter can be left out.

These parameters are optional, but you can apply them to your character as well if you wish:

  • jumpfactor: If given, this determines the character's jump strength – more specifically, this determines the percentage of the default thrust the character will have at the start of a jump, expressed as a decimal (e.g., 1.0 equals 100%). For instance, Knuckles has a jumpfactor value of 0.85, which gives 85% of the full default jump thrust, while a jumpfactor of 1.5 would give 150% instead. The default value for jumpfactor is 1.0 (or 100% the default jump thrust) – if the character is meant to jump at the default strength, this parameter can be left out.
  • mindash and maxdash control the minimum and maximum speeds that the character can spin at after charging up a spindash. For example, Sonic, Tails and Knuckles all set these to 15 and 70, respectively (these are also the default values for the two parameters). These require ability2 to be set to CA2_SPINDASH; if this is not the case, these parameters can be left out.

Step 3: Appearance

Lastly, if you have already made significant progress with your character's sprites, you can start configuring how your character appears in the game via the S_SKIN lump. Ideally you should plan this part of the S_SKIN lump well in advance of adding the character's sprites, so that you can design them around the expected values you will set in the character's S_SKIN lump – this will save you from from having to make tweaks to the sprites later on.

The following parameters control how your character's sprites appear in-game:

  • prefcolor: This specifies your character's default skin color. This is required for Single Player, where the character's color cannot be changed under normal circumstances. Note that this parameter accepts the name of the color itself as the value – e.g. Blue, Orange, or Red. See S_SKIN > prefcolor for the full list of color name strings that this parameter can take.
  • supercolor: This specifies your character's super color. Note that this parameter accepts the name of the color itself as the value – e.g. Sky, Orange, or Red. See S_SKIN > supercolor for the full list of color name strings that this parameter can take.
  • prefoppositecolor: This specifies the default color of the signpost's background when using the character's preferred color. Note that this parameter accepts the name of the color itself as the value – e.g. Blue, Orange, or Red. See S_SKIN > prefoppositecolor for the full list of color name strings that this parameter can take.
  • startcolor: This specifies the range of colors in the palette on the character's sprites that will be replaced with the palette colors of the character's skin color. This is a range of 16 colors, starting from the palette color index specified by this parameter. See List of skin colors for more information.

Step 4 (Optional): Custom sounds

As a optional feature, the S_SKIN lump also allows you to give your character custom sounds – these replace any one of a selection of existing sounds in SRB2, but will play only for your character if they originate from them. For more details on setting up custom sounds for your character, see S_SKIN > Custom sounds.

  Custom character tutorial [view]

Chapter 1: OverviewChapter 2: S_SKINChapter 3: SpritesChapter 4: Character select