Editing Sprites - RetroKoH/S1Fixed GitHub Wiki

In most older-generation video games, a sprite is a graphic made of art tiles that can move around the screen. The combination and arrangement of tiles is referred to as a sprite mapping. Sprites are often a visual representation of an object they are associated with, though this is not always the case. On the Sega Mega Drive, sprites consist of one or more sprite map pieces. Each map piece can be 1–4 tiles wide or tall (so anywhere from 1 to 16 tiles total). By combining map pieces, you can create more complex sprites.

S1Fixed Sprite Directory

A full directory for every sprite in the game can be found here.

What are map pieces?

A sprite mapping piece includes the following data:

  • X and Y position values (Relative to the base position of the sprite (usually its object))
  • A starting tile offset (Added to the base art tile location to get the desired tile to start with)
  • Sprite Mirror/Flip options (Inverts the sprite horizontally/vertically, respectively)
  • A palette line setting (Each piece uses one of four palette lines)
  • A priority setting (controls whether it appears in front or behind other graphics)

These settings apply to the whole map piece, not to individual tiles. When the game draws a sprite, it starts with the assigned tile, then continues through VRAM tile‑by‑tile, filling columns from left to right. All active sprites are stored in a dedicated section of VRAM.

In S1Fixed, sprite mappings are located in the _maps folder. You can edit them:

  • Directly with a text editor
  • Or with a tool like Flex2 Sprite mappings can use different formats. This section explains the sprite mapping formats for all 3 mainline games. S1Fixed uses the Sonic 2 format, so let's cover that first:

S1Fixed (Sonic 2) Mapping Format

Each mapping is 8 bytes long, taking the form:
TTTT-TTTT 0000-WWHH {PCCY-XAAA AAAA-AAAA}1 {PCCY-XAAA AAAA-AAAA}2 LLLL-LLLL LLLL-LLLL.

  • TTTT TTTT is the relative signed top edge position of the mapping piece from the center of the sprite.
  • WW is the width of the mapping, in tiles minus one. So 0 means 8 pixels wide, 1 means 16 pixels wide, 2 means 24 pixels wide and 3 means 32 pixels wide.
  • HH is the height of the mapping, in the same format as the width.

The next 4 bytes carry identical information, with the first 2 bytes applying to one-player mode, and the latter 2 bytes applying to split-screen mode (Unused in S1Fixed):

  • P is the priority-flag. If P is set, the mapping will appear above everything else.
  • CC is the palette line (0-3).
  • X is the x-flip-flag. If X is set, the mapping will be flipped horizontally.
  • Y is the y-flip-flag. If Y is set, the mapping will be flipped vertically.
  • AAA AAAA AAAA is the tile index.

The final two bytes (LLLL-LLLL LLLL-LLLL) are the relative signed left edge position of the mapping piece from the center of the sprite.

The VRAM offset specified in an object's SST will be added to the PCCY XAAA AAAA AAAA word.

Sonic 1 Mapping Format

Each mapping is 5 bytes long, taking the form:
TTTT-TTTT 0000-WWHH PCCY-XAAA AAAA-AAAA LLLL-LLLL.

  • TTTT-TTTT is the relative signed top edge position of the mapping piece from the center of the sprite.
  • WW is the width of the mapping, in tiles minus one. So 0 means 8 pixels wide, 1 means 16 pixels wide, 2 means 24 pixels wide and 3 means 32 pixels wide.
  • HH is the height of the mapping, in the same format as the width.
  • P is the priority-flag. If P is set, the mapping will appear above everything else.
  • CC is the palette line (0-3).
  • X is the x-flip-flag. If X is set, the mapping will be flipped horizontally.
  • Y is the y-flip-flag. If Y is set, the mapping will be flipped vertically.
  • AAA AAAA AAAA is the tile index.
  • LLLL-LLLL is the relative signed left edge position of the mapping piece from the center of the sprite.

The VRAM offset specified in an object's SST will be added to the PCCY XAAA AAAA AAAA word.

Sonic 3K Mapping Format

Each mapping is 6 bytes long, taking the form:
TTTT-TTTT 0000-WWHH PCCY-XAAA AAAA-AAAA LLLL-LLLL LLLL-LLLL.

This is basically the Sonic 2 format, without the 2 bytes used for that game's interlaced mode. S1Fixed will transition to this format in the future.