A sprite is a collection of images used in-game. Depending on how a sprite is used, the individual images may be frames of an object’s animation or angles in an object’s rotation. It is defined by three files:

1   Do I need it?


If you’re adding new ships or other objects, you’ll probably need sprites for them. If you have no new objects, or are just modifying existing objects, then you don’t need to add any sprites.

2   Naming

A sprite has three associated files in the sprites directory. The sprite map has the .pn extension. The sprite image ends in /image.png. The overlay image ends in /overlay.png.

By convention, sprites have the same name as the object that uses them.

3   Definition

A sprite map is a procyon file with the following fields:

Field Req? Type
frames yes array of frames

A sprite’s image and overlay are PNG images. They must have the same size. The frames in the sprite map reference parts of the image and overlay.

By default, only the sprite image is used, and the sprite overlay is ignored. The overlay is used to re-color sprites when a player has a hue.

3.1   frames

24 frames of a rotating Ishiman HVD, with the first three frames highlighted.

Sprite image for the Ishiman HVD. The {left, top, right, bottom} rectangles for the first three frames are highlighted, with a “+” mark at {cx, cy}.

An array of maps specifying the individual frames, each with the following fields:

Field Req? Type
left yes integer
top yes integer
right yes integer
bottom yes integer
cx yes integer
cy yes integer

The sprite image is bounded by the rect contained in {left, top, right, bottom}. The center of the sprite is the point at {cx, cy}. Both are offset from the upper-left-hand corner of the image and overlay.

3.2   Re-coloring

A sprite’s overlay image is used to re-color sprites when owned by a player with a hue. Re-coloring works as follows:

  1. Discard the green and blue channels from the overlay.
  2. Map the shade of red to the corresponding shade of the new hue.
  3. Composite the re-colored overlay atop the original sprite.