Age of Empires Graphics File
Hamhock666 (Talk | contribs) m |
m |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
[[Age of Empires Graphics File]]s are a way of storing graphics for the PC game Age of Empires. They are usually found archived inside of another file like a [[Data Resource File]]. They can store multiple frames for animation, and simple chroma keying so that graphics can be drawn with different colors to represent different teams within the game. | [[Age of Empires Graphics File]]s are a way of storing graphics for the PC game Age of Empires. They are usually found archived inside of another file like a [[Data Resource File]]. They can store multiple frames for animation, and simple chroma keying so that graphics can be drawn with different colors to represent different teams within the game. | ||
− | + | __TOC__ | |
− | + | ||
− | ==External links== | + | == Format == |
+ | |||
+ | : ''The following information was retrieved from: https://web.archive.org/web/20130411064914/http://www.digitization.org/wiki/index.php/SLP'' | ||
+ | |||
+ | The first item in an SLP file is the header, of the following format: | ||
+ | |||
+ | <pre> | ||
+ | struct file_header { | ||
+ | char version[4]; | ||
+ | long num_frames; | ||
+ | char comment[24]; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | * <code>version</code>: Given as a string, usually <code>"2.0N"</code>. | ||
+ | * <code>num_frames</code>: Total number of frames in the SLP. | ||
+ | * <code>comment</code>: The string <code>"ArtDesk 1.00 SLP Writer"</code>. | ||
+ | |||
+ | Following is frame information, one of the following structures for each frame (see <code>num_frames</code> above): | ||
+ | |||
+ | <pre> | ||
+ | struct frame_info { | ||
+ | unsigned long cmd_table_offset; | ||
+ | unsigned long outline_table_offset; | ||
+ | unsigned long palette_offset; | ||
+ | unsigned long properties; | ||
+ | long width; | ||
+ | long height; | ||
+ | long hotspot_x; | ||
+ | long hotspot_y; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | * <code>properties</code>: This value is suspected to change which palette the SLP uses, but the possible options seem to be the same so this has never been confirmed. | ||
+ | * <code>hotspot_x</code> and <code>hotspot_y</code>: These points set the hotspot of a frame, which is the "center" of the unit. A unit's coordinates in a scenario specify the location of this pixel. | ||
+ | |||
+ | === Per-frame data === | ||
+ | |||
+ | The following data are repeated as a whole for each frame. | ||
+ | |||
+ | The first data are edge structures, one for each row. To conserve disk space, commands (see below) are only included for the necessary area, and these edges specify the blank space surrounding a unit. Rows that do not have any data in them (i.e completely transparent) will have left and right values of <code>0x8000</code>. There are no "End of Row" command bytes for these rows. | ||
+ | |||
+ | <pre> | ||
+ | struct rowedge { | ||
+ | short left, right; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | Following are an array of longs, specifying the offset for the commands (see below) for each row. These are not actually necessary as the commands can be read sequentially, but can be used for checking purposes. | ||
+ | |||
+ | After the array is the command data itself. Each command is a single-byte integer followed by command-specific data. To make the data very compact, the command byte sometimes also contains the command-specific data. For example, the Color List command (0x00) only uses the least-significant bits to specify the command type and the rest of the byte is the number of palette indices to follow. | ||
+ | |||
+ | The following are the known commands: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Value | ||
+ | ! Command name | ||
+ | ! Pixel count | ||
+ | ! Description | ||
+ | |- | ||
+ | | <code>0x00</code> | ||
+ | | Color list | ||
+ | | <code>>>2</code> | ||
+ | | An array of palette indices. This is about as bitmap as it gets in SLPs. | ||
+ | |- | ||
+ | | <code>0x01</code> | ||
+ | | Skip | ||
+ | | <code>>>2 or next</code> | ||
+ | | The specified number of pixels are transparent. | ||
+ | |- | ||
+ | | <code>0x02</code> | ||
+ | | Big color list | ||
+ | | <code>>>4 * 256 and next</code> | ||
+ | | An array of palette indexes. Supports a greater number of pixels than the above color list. | ||
+ | |- | ||
+ | | <code>0x03</code> | ||
+ | | Big skip | ||
+ | | <code>>>4 * 256 and next</code> | ||
+ | | The specified number of pixels are transparent. Supports a greater number of pixels than the above skip. | ||
+ | |- | ||
+ | | <code>0x06</code> | ||
+ | | Player color list | ||
+ | | <code>>>4 or next</code> | ||
+ | | An array of player color indexes. The actual palette index is given by adding ([player number] * 16) + 16 to these values. | ||
+ | |- | ||
+ | | <code>0x07</code> | ||
+ | | Fill | ||
+ | | <code>>>4 or next</code> | ||
+ | | Fills the specified number of pixels with the following palette index. | ||
+ | |- | ||
+ | | <code>0x0A</code> | ||
+ | | Player color fill | ||
+ | | <code>>>4 or next</code> | ||
+ | | Same as above, but using the player color formula (see Player color list). | ||
+ | |- | ||
+ | | <code>0x0B</code> | ||
+ | | Shadow transparent | ||
+ | | <code>>>4 or next</code> | ||
+ | | Specifies the shadow for a unit, but most SLPs do not use this. | ||
+ | |- | ||
+ | | <code>0x0E</code> | ||
+ | | Shadow player | ||
+ | | <code>next</code> | ||
+ | | Unknown. | ||
+ | |- | ||
+ | | <code>0x0F</code> | ||
+ | | End of row | ||
+ | | <code>0</code> | ||
+ | | Specifies the end of commands for this row. | ||
+ | |- | ||
+ | | <code>0x4E</code> | ||
+ | | Outline | ||
+ | | <code>1</code> | ||
+ | | When normally drawing a unit, this single pixel acts normally. When the unit is behind something, this pixel is replaced with the player color. | ||
+ | |- | ||
+ | | <code>0x5E</code> | ||
+ | | Outline span | ||
+ | | <code>next</code> | ||
+ | | Same function as above, but supports multiple pixels. | ||
+ | |} | ||
+ | |||
+ | Possible pixel count values: | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | <code>Next byte</code> | ||
+ | | Stored in the next byte. | ||
+ | |- | ||
+ | | <code>>>2</code> | ||
+ | | Command byte right-shifted 2 bits. | ||
+ | |- | ||
+ | | <code>>>4 or next</code> | ||
+ | | Either the command byte right-shifted 4 bits or in the next byte if the former is 0. | ||
+ | |- | ||
+ | | <code>>>2 or next</code> | ||
+ | | Either the command byte right-shifted 2 bits or in the next byte if the former is 0. | ||
+ | |- | ||
+ | | <code>>>2 * 256 and next</code> | ||
+ | | The command byte right-shifted 2 bits and then added to the next byte's value. | ||
+ | |- | ||
+ | | <code>>>4 * 256 and next</code> | ||
+ | | The command byte right-shifted 4 bits and then added to the next byte's value. | ||
+ | |} | ||
+ | |||
+ | == External links == | ||
*[http://artho.com/age/files/slpcnvt.html A command line tool for extracting slp files] | *[http://artho.com/age/files/slpcnvt.html A command line tool for extracting slp files] | ||
*[http://aoe.heavengames.com/dl-php/showfile.php?fileid=1714 SLP Studio] | *[http://aoe.heavengames.com/dl-php/showfile.php?fileid=1714 SLP Studio] | ||
*[http://aoe.heavengames.com/siegeworkshop/graphicslpediting/ How to use SLP Studio] | *[http://aoe.heavengames.com/siegeworkshop/graphicslpediting/ How to use SLP Studio] | ||
+ | |||
+ | [[Category:Graphics]] |
Latest revision as of 12:31, 2 August 2023
Age of Empires Graphics Files are a way of storing graphics for the PC game Age of Empires. They are usually found archived inside of another file like a Data Resource File. They can store multiple frames for animation, and simple chroma keying so that graphics can be drawn with different colors to represent different teams within the game.Contents |
[edit] Format
- The following information was retrieved from: https://web.archive.org/web/20130411064914/http://www.digitization.org/wiki/index.php/SLP
The first item in an SLP file is the header, of the following format:
struct file_header { char version[4]; long num_frames; char comment[24]; }
-
version
: Given as a string, usually"2.0N"
. -
num_frames
: Total number of frames in the SLP. -
comment
: The string"ArtDesk 1.00 SLP Writer"
.
Following is frame information, one of the following structures for each frame (see num_frames
above):
struct frame_info { unsigned long cmd_table_offset; unsigned long outline_table_offset; unsigned long palette_offset; unsigned long properties; long width; long height; long hotspot_x; long hotspot_y; }
-
properties
: This value is suspected to change which palette the SLP uses, but the possible options seem to be the same so this has never been confirmed. -
hotspot_x
andhotspot_y
: These points set the hotspot of a frame, which is the "center" of the unit. A unit's coordinates in a scenario specify the location of this pixel.
[edit] Per-frame data
The following data are repeated as a whole for each frame.
The first data are edge structures, one for each row. To conserve disk space, commands (see below) are only included for the necessary area, and these edges specify the blank space surrounding a unit. Rows that do not have any data in them (i.e completely transparent) will have left and right values of 0x8000
. There are no "End of Row" command bytes for these rows.
struct rowedge { short left, right; }
Following are an array of longs, specifying the offset for the commands (see below) for each row. These are not actually necessary as the commands can be read sequentially, but can be used for checking purposes.
After the array is the command data itself. Each command is a single-byte integer followed by command-specific data. To make the data very compact, the command byte sometimes also contains the command-specific data. For example, the Color List command (0x00) only uses the least-significant bits to specify the command type and the rest of the byte is the number of palette indices to follow.
The following are the known commands:
Value | Command name | Pixel count | Description |
---|---|---|---|
0x00
|
Color list | >>2
|
An array of palette indices. This is about as bitmap as it gets in SLPs. |
0x01
|
Skip | >>2 or next
|
The specified number of pixels are transparent. |
0x02
|
Big color list | >>4 * 256 and next
|
An array of palette indexes. Supports a greater number of pixels than the above color list. |
0x03
|
Big skip | >>4 * 256 and next
|
The specified number of pixels are transparent. Supports a greater number of pixels than the above skip. |
0x06
|
Player color list | >>4 or next
|
An array of player color indexes. The actual palette index is given by adding ([player number] * 16) + 16 to these values. |
0x07
|
Fill | >>4 or next
|
Fills the specified number of pixels with the following palette index. |
0x0A
|
Player color fill | >>4 or next
|
Same as above, but using the player color formula (see Player color list). |
0x0B
|
Shadow transparent | >>4 or next
|
Specifies the shadow for a unit, but most SLPs do not use this. |
0x0E
|
Shadow player | next
|
Unknown. |
0x0F
|
End of row | 0
|
Specifies the end of commands for this row. |
0x4E
|
Outline | 1
|
When normally drawing a unit, this single pixel acts normally. When the unit is behind something, this pixel is replaced with the player color. |
0x5E
|
Outline span | next
|
Same function as above, but supports multiple pixels. |
Possible pixel count values:
Next byte
|
Stored in the next byte. |
>>2
|
Command byte right-shifted 2 bits. |
>>4 or next
|
Either the command byte right-shifted 4 bits or in the next byte if the former is 0. |
>>2 or next
|
Either the command byte right-shifted 2 bits or in the next byte if the former is 0. |
>>2 * 256 and next
|
The command byte right-shifted 2 bits and then added to the next byte's value. |
>>4 * 256 and next
|
The command byte right-shifted 4 bits and then added to the next byte's value. |