Gods Image Format
| Format type | Image |
|---|---|
| Hardware | EGA, VGA |
| Colour depth | 4-bit (EGA) |
| Minimum size (pixels) | 320×200 |
| Maximum size (pixels) | 320×200 |
| Palette | Internal |
| Plane count | 4 |
| Transparent pixels? | Palette-based |
| Hitmap pixels? | No |
| Games |
All graphics in Gods are stored in P*.PI1 files. These are Atari ST DEGAS low-resolution images, carried over unchanged from the ST version of the game. Each file is compressed with PKWARE DCL Compression; the DEGAS image is what you get after decompressing it. (This is why the files on disk are all different sizes, while a real DEGAS file is always 32034 bytes.)
The same format is used for full-screen pictures, sprite sheets and tile sheets. Sprite sheets are cut into frames using the matching .DAT file (see Gods Sprite Format), and tile sheets are described in Gods Tileset Format.
File format
Every decompressed file is exactly 32034 bytes.
| Data type | Name | Description |
|---|---|---|
| UINT16BE | resolution | Always 0 (low resolution, 320×200, 16 colours) |
| UINT16BE[16] | palette | 16 colours in Atari ST format, see below |
| BYTE[32000] | bitmap | Image data, see below |
Palette
Each palette entry is a big-endian word of the form 0x0RGB, with 3 bits per channel (values 0-7). To convert to 8-bit RGB, use value * 255 / 7.
The palette is only meaningful for full-screen images and sprite sheets. In the twelve tile sheets (PBITS* and PXTRA*) the palette area contains leftover data from the Bitmap Brothers' tools (values with nibbles above 7) and is never read by the game.
Bitmap
The bitmap is stored as 200 lines of 160 bytes. Each line is split into 20 groups of 16 pixels, and each group is four big-endian words, one per bitplane:
| Data type | Name | Description |
|---|---|---|
| UINT16BE | plane0 | Bit 0 of the colour index for these 16 pixels |
| UINT16BE | plane1 | Bit 1 |
| UINT16BE | plane2 | Bit 2 |
| UINT16BE | plane3 | Bit 3 |
In each word, bit 15 is the leftmost pixel. The byte offset of the group holding pixel (x, y) is therefore 34 + y * 160 + (x / 16) * 8.
The DOS graphics drivers convert this layout to EGA/VGA planar format when the file is loaded. No byte swapping is needed, because bit 15 being the leftmost pixel already matches the PC's bit order.
Transparency
When a sheet is cut into sprites, colour 0 is treated as transparent and the driver builds a mask from it. Full-screen images are drawn opaque.
Level palettes
The level palette is not taken from the tile sheet. When a level is loaded, the driver loads both PLEVELnA.PI1 and PLEVELnB.PI1 (the level's sprite sheets) and copies each file's palette into the same buffer, so the palette of the B file is always the one used, whichever sublevel is played. The game then overwrites colours 0 and 1 with 0x000 (black) and 0x247 (blue) in every world. The palette stored in the file has other values there, so a viewer that uses the file palette as-is will show the wrong background colour.
In worlds 1-3 the A and B files have identical palettes, so this only makes a visible difference in world 4.
Files
| Filename | Type | Contents |
|---|---|---|
| PONE.PI1, PSTBACK.PI1 | Full screen | Intro screens |
| PBACKSCR.PI1 | Full screen | Background for the title menu and other menu screens |
| PSTATUS.PI1 | Full screen | Status panel during normal play |
| PSTAT3.PI1 | Full screen | Status panel during a guardian fight |
| PSHOP.PI1 | Full screen | Shop screen |
| PPAYOFF.PI1 | Full screen | Game completion screen |
| PALWAYS1-3.PI1, PGODFONT.PI1 | Sprite sheet | Hero, shared sprites, big font and title logo |
| POBJ1.PI1, POBJ2.PI1 | Sprite sheet | Collectable objects and weapon pickups |
| PLEVEL1A.PI1 ... PLEVEL4B.PI1 | Sprite sheet | Enemies for each level |
| PGUARD11.PI1 ... PGUARD42.PI1, PAMDRAGN.PI1 | Sprite sheet | Guardians (end-of-world bosses) |
| PSMLFNT.PI1, PSHOPFNT.PI1, PSHOPSPR.PI1 | Sprite sheet | Small font and shop graphics |
| PINTROFT.PI1 | Sprite sheet | Font used for the intro and ending story text |
| PBITS1A.PI1 ... PBITS4B.PI1, PXTRA*.PI1 | Tile sheet | See Gods Tileset Format |
Source code
From re-gods, the open-source HTML5 port:
- src/formats/pi1.js – DEGAS decoder (JavaScript)
Credits
This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)