Custom character tutorial/Sprites

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

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

A custom character consists of a series of sprites that make up the visual design of the character itself in-game. Up to 360 sprites in total can be dedicated to a character. However, many of these sprites will typically be duplicates of each other. Through an abridged naming system for sprites, it is possible to create a complete character with only around 177 sprites on average. This chapter gives an overview of how a character's sprites are created and added to the character's WAD or PK3 file. Note that this tutorial only covers the technical aspects of sprite creation; it will not teach you how to make good sprites.

Creating sprites

Spriting a character is the hardest and most tedious task that you will face when creating a custom character for SRB2. It is also a very time-consuming process – it is not uncommon for this part of creating your character to take months to complete.

Recommended programs

The following is a selection of graphics editing programs available that you can use to create your character's sprites with:

  • Microsoft Paint: This is a simple graphics editing program that is included with all versions of Windows (not included with Mac or Linux). This program is very popular among spriters and is highly recommended for basic sprite editing.
  • Paint.NET: An more advanced tool containing features that Microsoft Paint has as well as a few extras that aid in creating sprite animations. Recommended if you don't want to buy Photoshop. Not available for Mac or Linux.
  • Photoshop: A multi-purpose graphics editing software. Very hard to use if you don't know what you're doing. Not recommended for beginners.
  • GIMP: A free graphics editing program that is supported on Windows, Mac and Linux.
  • GraphicsGale: An animation graphic editor, specially designed for creating sprites and pixel art. Only Windows is supported, however.
  • Aseprite: An animated sprite editor and pixel art tool. A free trial version is available for download, but files cannot be saved with it; you will have to pay for the full version in order to use it for sprite editing.

Technical information

A sample sprite.

The usual dimensions (image size) of a sprite for a character are 70×70 pixels, with the actual character size being roughly 40×63 (Sonic's size).

Cyan (palette color #247) is commonly used as a background color for sprites – this is because lump editors such as XWE automatically convert all instances of cyan to transparent pixels when sprites are loaded. However, SLADE does not do this unless it is specified to do so.

To allow your character to switch skin colors, the parts of your character that you want to change color in each sprite should all use a specific range of colors in the palette. This should be a range of colors that aren't used by body parts or clothes that you don't want to change color, and one that allows your character to look correct in the skin color you want your character to use in Single Player (as well as in other skin colors, if possible).

For instance, the main color of all of Sonic, Tails' and Knuckles' sprites is green (or palette colors #160 through #175) rather than blue, orange or red, respectively. This green range is also the one most commonly used by custom characters, as it is considered the easiest color range to work with. If you don't want your character to use this range of colors, use the startcolor parameter in the character's S_SKIN lump to choose a different range of colors to work with. Note that this will always be a range of 16 colors, with startcolor determining the first color in the range.

The prefcolor parameter is then used to determine the default skin color used by your character in Single Player. Ideally, you should test out how your character's sprites appear in this skin color for best results. Refer to the previous chapter of the tutorial for more details on setting up your character's skin color in the S_SKIN lump.

Keep in mind that the actual size of the sprite file does not matter, as the sprite offsets can be modified in your chosen lump editor. What actually matters is the size of the character minus the transparent (or cyan) pixels.

Importing sprites

Once you have created your character's sprites (or at least a portion of them), you now need to add them to the WAD or PK3 file containing your character's lumps. This section explains how to import your sprites and how to name the lumps within the WAD or PK3 file.

SLADE

An example of how the S_SKIN lump and the sprites should appear in a WAD file's lump list. Click to view an enlarged version of the image.

To import the images for your character in a blank WAD or PK3 file, click Archive → Import Files in the menu bar, browse to the folder where your images are located, select them and hit enter. If you are importing sprites into a file already containing placeholder sprites, you can alternatively replace them directly one-by-one by clicking Entry → Import; this will directly replace the lump for the old sprite with your imported sprite.

The next task is to convert all sprites to the correct format; typically your imported sprites will be in a format such as "Graphic (PNG)" or "(BMP)" in the WAD or PK3 file – if these lumps are not converted, they will crash the game if SRB2 attempts to access them. Select all imported lumps at once, right-click on them, and select Gfx → Convert to... The conversion window will pop up. Select "Doom Gfx (Paletted)" as the format to convert to and make sure SRB2's palette (which should be "Existing/Global" if you have set up srb2.srb as your Base Resource, otherwise use "Sonic (SRB2)") is selected. If the sprites contain a cyan background rather than actual transparent pixels, enable "Enable Transparency" in the window to automatically convert them for you. Press Convert All to convert all the images at once.

If it is necessary to rename the lumps to follow the sprite naming format, right-click on them and click Rename Entry. If multiple sprite lumps are being renamed at once, the text characters that differ between them will be given as asterisks (*) in the "Rename" window that pops up. For instance, PLAYA1 and PLAYA5 will appear as PLAYA*; lump selections such as PLAYA1 and PLAYA2A8 will appear as PLAYA*** in the "Rename" window. Note: From SLADE v3.1.1 onwards, sprites for the ^ frame cannot be mass-renamed, as SLADE uses carets (^) as part of its extra formatting features for renaming multiple sprite lumps at once. These sprites must be renamed individually instead.

If your S_SKIN lump is not already present in your WAD or PK3 file, but is ready to be added at this stage, you can import it here too – click Entry → Move Up (shortcut: Ctrl+U) to push up the position of the S_SKIN lump until it is immediately above the first sprite.

XWE

In order to import your character's sprites into the WAD or PK3 file, you need to set up XWE to use SRB2's palette if you haven't already. If you don't do this, the images will be converted into the standard Doom palette, which is different from SRB2's palette, and their colors will be messed up as a result. This article explains how to set up the palette in XWE.

To import the images for your character in a blank WAD or PK3, Click Entry → Load in the menu bar, browse to the folder where your images are located, select them and hit enter. If you are importing sprites into a file already containing placeholder sprites, you can alternatively replace them directly one-by-one by clicking Entry → Replace; this will directly replace the lump for the old sprite with your imported sprite.

Unlike SLADE, XWE will automatically convert the images into the Doom Graphics Format, and will automatically convert all cyan pixels in them into transparent pixels as soon as the images are loaded into the file.

If it is necessary to rename the lumps to follow the sprite naming format, right-click on them and click Rename Entry. If multiple sprite lumps are being renamed at once, the text characters that differ between them will be given as asterisks (*) in the "Rename" window that pops up. For instance, PLAYA1 and PLAYA5 will appear as PLAYA*; lump selections such as PLAYA1 and PLAYA2A8 will appear as PLAYA*** in the "Rename" window.

If your S_SKIN lump is not already present in your WAD or PK3 file, but is ready to be added at this stage, you can import it here too – click Entry → Move Up (shortcut: Ctrl+U) to push up the position of the S_SKIN lump until it is immediately above the first sprite.

Naming format

See also: Sprite > Format

As with all sprites, character sprites must have a lump name of the format NAMEXx. How this format is used slightly differs for character sprites, however:

  • NAME is a four-letter prefix of your choice that should be unique to your character – unlike other custom sprites you do not need to create a sprite freeslot for this prefix.
  • X designates the frame that a sprite belongs to; see the Frame list below for determining which frames to place your sprites in for each animation for the character.
  • x designates a sprite's rotation. It is a number between 1 and 8, starting with the front view at 1 and then continuing clockwise – for example, 2 is the diagonal front-left view, 5 is the back view and 8 is the diagonal front-right view.

As with normal sprites, the condensed naming system can be used to condense 8 rotations into five sprites instead of eight. For example, the standing frame of the player would consist of the following five sprites:

PLAYA1
PLAYA2A8
PLAYA3A7
PLAYA4A6
PLAYA5

However, if the frame has non-symmetrical features, using the condensed naming system will cause these features to be flipped as well. For example, if the character carried a weapon on their right hand, it would also appear on their left hand by error when the game flips the sprite, as if they were "switching hands". This problem is solved by falling back into the uncondensed naming structure for any frames where this problem occurs, i.e., PLAYA1 through PLAYA8 as eight separate sprites.

If your character appears the same from all angles for a particular frame, a single sprite can be used with a rotation of 0 (e.g., PLAYA0) – this means the game will use the sprite for all 8 rotations in the frame. This trick is generally used only for frames used by super transformation, death, and the Level End Sign/Extra Life Monitor icons.

Frame list

This is the full list of sprite frames that exist for all characters in SRB2:

A Standing
TAILA2A8.PNG
B Boredom 1
TAILB2B8.PNG
C Boredom 2
TAILC2C8.PNG
D Walking 1
TAILD2D8.PNG
E Walking 2
TAILE2E8.PNG
F Walking 3
TAILF2F8.PNG
G Walking 4
TAILG2G8.PNG
H Walking 5
TAILH2H8.PNG
I Walking 6
TAILI2I8.PNG
J Walking 7
TAILJ2J8.PNG
K Walking 8
TAILK2K8.PNG
L Spinning 1
TAILL2L8.png
M Spinning 2
TAILM2M8.png
N Spinning 3
TAILN2N8.png
O Spinning 4
TAILO2O8.png
P Spring falling up
TAILP2P8.png
Q Running 1
TAILQ2Q8.png
R Running 2
TAILR2R8.png
S Running 3
TAILS2S8.png
T Running 4
TAILT2T8.png
U Special ability 11
TAILU2U8.png
V Special ability 21
TAILV2V8.png
W Special ability 31
TAILW2W8.png
X Special ability 41
TAILX2X8.png
Y Special ability 51
TAILY2Y8.png
Z Special ability 61
TAILZ2Z8.png
[ Grab a bubble
TAIL-2-8 leftsquarebracket.png
\ Hurt2
TAIL-2-8 backslash.png
] Dead
TAIL-2-8 rightsquarebracket.png
^ On the edge 1
TAIL^2^8.png
_ On the edge 2
TAIL 2 8.png
` Falling 1
TAIL`2`8.png
a Falling 2
TAILa2a8 lowercase.png
b Item hang/Tails pickup
TAILb2b8 lowercase.png
c Level End Sign face3
TAILc0 Lowercase.png
d Extra Life Monitor face3
TAILd0.png
e Super transformation 1
PLAYg0 lowercase.png
f Super transformation 2
PLAYh0 lowercase.png
g Super transformation 3
PLAYi0 lowercase.png
h Super transformation 4
PLAYj0 lowercase.png
i Super transformation 5
PLAYk0 lowercase.png
j Super transformation 6
PLAYl0 lowercase.png
k Super transformation 7
PLAYm0 lowercase.png
l Super transformation 8
PLAYn0 lowercase.png
m Super transformation 9
PLAYo0 lowercase.png

1 The purpose of these frames depends on the character's special ability. Most special abilities only use some, but not all of these frames. However, even the unused frames should always be supplied for the character to function properly. See S_SKIN > ability for more information.

2 The backslash character cannot be used in PK3 files because it is reserved for referring to a lump's path in the folder structure (e.g., SOC\Character select.txt). To circumvent this issue, the plus (+) character is also accepted for this frame.

3 To figure out the correct sprite offsets for these frames, you can refer to the offsets of the Level End Sign/Extra Life Monitor sprites, as well any existing character's own sprite offsets for these frames.

Lowercase lump names

The last thirteen frames in the above list all have lowercase letters in them. That means that the sprites for these frames will look like this:

PLAYa1
PLAYa2a8
PLAYa3a7
PLAYa4a6
PLAYa5

In PK3 files, lowercase lump names are not a problem. In WAD files, lump editors generally do not allow them by default, but there is usually an option to allow them. If you would like to know how enable this option, check the SLADE or XWE article.

  Custom character tutorial [view]

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