Gods Sprite Format
| Format type | Image |
|---|---|
| Hardware | EGA, VGA |
| Colour depth | 4-bit (EGA) |
| Minimum size (pixels) | 1×1 |
| Maximum size (pixels) | 320×200 |
| Palette | External |
| Plane count | 4 |
| Transparent pixels? | Palette-based |
| Hitmap pixels? | No |
| Games |
Sprites in Gods are stored as pairs of files with the same name: a .PI1 sprite sheet (see Gods Image Format) and a .DAT file listing the rectangle of each frame on that sheet. For example POBJ1.DAT describes the frames in POBJ1.PI1. Both files are compressed with PKWARE DCL Compression.
There are 25 such pairs. (Not every .DAT file in the game is a sprite list: PJOY*.DAT are demo recordings, and SINCOS.DAT and BEZIER.DAT are lookup tables.)
File format
All values are big-endian. Every file is exactly 2 + 10 * count bytes long.
| Data type | Name | Description |
|---|---|---|
| UINT16BE | count | Number of frames |
| FRAME[count] | frames | One entry per frame |
Each FRAME is:
| Data type | Name | Description |
|---|---|---|
| UINT16BE | width | Frame width in pixels, minus one |
| UINT16BE | height | Frame height in pixels, minus one |
| UINT16BE | unused | Always 0. Never read by the game. |
| UINT16BE | x | Left edge of the frame on the sprite sheet |
| UINT16BE | y | Top edge of the frame on the sprite sheet |
Frames never extend beyond the 320×200 sheet. Colour 0 is transparent.
Sprite numbering
The game does not refer to sprites by file and frame, but by a single running number. Sprite sheets are loaded in groups, and every frame of every file in a group takes the next number, in the order below. Numbers are taken even for frames that the game decides not to load, so the numbering is the same in every world.
| Group | Files, in order | When loaded |
|---|---|---|
| always | PALWAYS1, PALWAYS2, PALWAYS3, PGODFONT | At startup. First sprite is number 0. |
| objects | POBJ1, POBJ2 | At level load, starting at number 170 |
| leveln | PLEVELnA, PLEVELnB | At level load, after objects |
| smallfnt | PSMLFNT | At level load, after the level sprites |
| shop | PSHOPSPR, PSHOPFNT | On entering the shop |
| guard1, guard2, guard3, guard4 | PGUARD11 + PGUARD12, PAMDRAGN, PGUARD31 + PGUARD32, PGUARD41 + PGUARD42 | For the guardian fight at the end of each world |
| introft | PINTROFT | Intro and completion screen |
Useful fixed numbers:
- Map object of type t (see Gods Map Format) is drawn with sprite 170 + t, for t below 192.
- Weapon pickups (type 192 and above) use sprite 302 + (t - 192).
- Sprite 127 (PALWAYS3 frame 16) is the strip of 8×7 digits used for the score.
- Sprite 169 (PGODFONT frame 41) is the 208×46 GODS title logo.
Not every object sprite is loaded in every world. GAME.EXE has a bit mask per world saying which of the objects frames to load. A frame that is not loaded keeps its number and size but points at the pixels of the next loaded frame, so it appears as garbage if used. None of the shipped levels use an unloaded frame.
Notes
- The parser for this format is in the graphics drivers (VGA.EXE, EGA.EXE, TGA.EXE), not in GAME.EXE.
- PSMLFNT.DAT and PSHOPFNT.DAT are identical.
- In PALWAYS1 most hero frames are 32×48 pixels. The few 32×42/43 frames are the crouching poses.
Source code
From re-gods, the open-source HTML5 port:
- src/formats/atlas.js – sprite list parser
- src/formats/descriptors.js – sprite numbering
- src/formats/object-mask.js – per-world object load masks
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!)