User Tools

Site Tools


Creating GameTank Graphics With Aseprite

Aseprite is a popular image editing program for pixel art drawing and animation. It has a number of features that assist in producing game assets. In this article we'll look at workflows for creating art assets to use in GameTank games and translating them to the GameTank's “native” format.

File setup

To create a file that can be rendered by the GameTank video hardware, the final output should be a Bitmap image with the color mode set to “Indexed”, the palette set to GAMETANK.act (provided in the GameTankEmulator repo), the width set to 128 pixels, and the height to at most 128 pixels.

In table form for easy reference:

Color Mode Indexed
Palette GAMETANK.act
Width 128px
Height At most 128px

Settings when creating a new file:

Selecting the palette file:

Once the new file is created, open the palette menu and pick Load Palette. If you've downloaded the emulator repository, GAMETANK.act is in the “misc” folder. But you can also download that file separately on GitHub.

Manual Export

A .BMP file in indexed mode has a structure that is very straightforward to convert for GameTank use. The reason we want to use a specific palette file is that it assigns colors to each byte value that resemble the color that the video hardware would output for that byte.

Note that the video circuit is not palette-based. Instead each byte encodes packed parameters for the video signal:

BitmaskPhysical ControlEffective Output
11100000Color Carrier Phase Shift Hue
00011000Color Carrier Amplitude Saturation
00000111DC Offset Luminosity

Since each pixel in both a BMP file and in VRAM is represented by a single byte, using GAMETANK.act provides the convenient assignment from all possible byte values in a BMP to a closely matching output color.

BMP file structure

BMP files contain a header that specifies things like color mode, and width and height in pixels. Indexed BMP files will also contain a table of RGB values that describes the palette. At the end of the file is the image data. For our purposes we need only the image data, and will discard the header including the palette.

Making a GTG file

Technically it is not required to name your output file with a .GTG extension specifically. Short for “GameTank Graphics” it's useful for differentiating from other data files you might be importing into your code.

Relative to how they are displayed on screen, BMP files are actually stored vertically flipped. So you'll need to flip (not rotate) your art upside down. Aseprite has this under the Edit menu and the hotkey is Shift+V.

Next you'll need to extract only a certain number of the last bytes of your BMP file. This certain number is the same as the total number of pixels in your image. So if your image is 128 wide and 128 tall you'll need the last 16384 bytes of the BMP file.

On Mac and Linux this can be done with a simple terminal command:

tail -c 16384 myfile.bmp > myfile.gtg

In Windows Powershell the command is a bit more verbose but this should be equivalent:

Get-Content -Path "myfile.bmp" -Encoding Byte | Select-Object -Last 16384 | Set-Content -Path "myfile.gtg" -Encoding Byte

Using the SDK

This section will cover the workflow to prepare sprite files for games made with the GameTank SDK. The SDK includes scripts that perform the flipping and clipping of your BMP files for you, as well as compressing the data and generating macros you can use in your code to load the images into Sprite RAM.

Additionally, the SDK supports frame data that can be exported along with your sprite sheets. This has the benefit of leveraging Aseprite's packing features to store animation frames of different sizes efficiently.

development/aseprite.txt · Last modified: 2023/08/29 13:35 by clyde