Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:games:star_trek_armada_1:modding:sprites [2024-01-15-21-51] – [Sprite Animations] 7saturn | en:games:star_trek_armada_1:modding:sprites [2025-03-03-20-08] (current) – [Sprite Files] 7saturn |
---|
====== Sprite in Star Trek: Armada ====== | ====== Sprites in Star Trek: Armada ====== |
Many aspects of the look and feel of //Star Trek: Armada// are created by so-called //sprites//. Sprites essentially consist of two aspects: | Many aspects of the look and feel of //Star Trek: Armada// are created by so-called //sprites//. Sprites essentially consist of two aspects: |
- A graphics file, containing some sort of bitmap graphic, that is used entirely or in part, the [[en:game_tech:texture]]. | - A graphics file, containing some sort of bitmap graphic, that is used entirely or in part, the [[en:game_tech:texture]]. |
===== Sprite Files ===== | ===== Sprite Files ===== |
The text files of sprites are located in the folder with the same name in the Armada installation. They end with the extension //.spr//, e.g. //weapon.spr//. These are the so-called sprite files. There is a number of different types of sprites, defined in their corresponding sprite files. | The text files of sprites are located in the folder with the same name in the Armada installation. They end with the extension //.spr//, e.g. //weapon.spr//. These are the so-called sprite files. There is a number of different types of sprites, defined in their corresponding sprite files. |
* //gui_global.spr//: Used for the looks of [[buttons]] and [[wire frames]]. | * //gui_global.spr//: Used for the visual parts of [[buttons]] and [[wire frames]]. |
* //tex_anim.spr//: Defines the way weapon sprites are displayed and what kind of animations they represent (texture animations or moving textures). | * //tex_anim.spr//: Defines the way weapon sprites are displayed and what kind of animations they represent (texture animations or moving textures). |
* //weapon.spr//: Used for optical weapon effects. | * //weapon.spr//: Used for optical weapon effects. |
Any new use of //@reference=// opens up a new section in the file. This has the side-effect, that they don't need to be in any particular order and even sections of the same definition may occur in the same file. | Any new use of //@reference=// opens up a new section in the file. This has the side-effect, that they don't need to be in any particular order and even sections of the same definition may occur in the same file. |
===== Sprite Definitions ===== | ===== Sprite Definitions ===== |
A single sprite definition defines //one// sprite, but uses aspects of the block definition that came before it. It may look like this, for example: | A single sprite definition defines //one// sprite, but uses aspects of the block definition that came before it. The meta-format of sprite definition lines is the following: |
| |
| ''//<Sprite Name> <Graphics File without .tga> <Starting X> <Starting Y> <Width> <Height> <optional Animation>//'' |
| |
| The sprite name **must** be unique, while the same TGA file might be used by different sprites. However, the texture file for a specific sprite must fit its block definition (e.g. //@reference=64// requires the TGA files used by sprites in that section to be 64 pixels x 64 pixels in size). The given file name will be looked for in folder //Textures/RGB// of the Armada installation. ''//<Starting X>//'' to ''//<Height>//'' are the [[#sprite coordinates]]. The ''//<optional Animation>//'' is the definition for the [[#Sprite Animations]]. |
| |
| It may look like this, for example: |
| |
<code> | <code> |
cAccelCannon wAccelCannon 0 0 256 64 @anim=tex1x4 | cAccelCannon wAccelCannon 0 0 256 64 @anim=tex1x4 |
</code> | </code> |
While the first line is a simple comment (comments start if a ''#'' sign, and end and the end of the line), the second line is the actual sprite definition. The name of this particular sprite is //cAccelCannon//. This is what the game uses to refer to this specific sprite wherever it is needed in the game. The definition references the file //wAccelCannon.tga//. As you can see, the //.tga// extension is omitted. The next four values are the [[#Sprite Coordinates]]. The sprite definition is finished with //@anim=tex1x4//, the animation type for this sprite. It tells the game that this is a 1 x 4 animation, meaning that it is 1 frame wide and 4 frames high. This already hints at the concept of animation. An animated texture sprite consists of one texture, that is interpreted in sections that are to be used as frames, just like in a video animation. So the game will display the single frames one after the other, depending on the situation looping over them multiple times. | While the first line is a simple comment (comments start if a ''#'' sign, and end at the end of the line), the second line is the actual sprite definition. The name of this particular sprite is //cAccelCannon//. This is what the game uses to refer to this specific sprite wherever it is needed in the game. The definition references the file //wAccelCannon.tga//. As you can see, the //.tga// extension is omitted. The next four values are the sprite coordinates. The sprite definition is finished with //@anim=tex1x4//, the animation type for this sprite. It tells the game that this is a 1 x 4 animation, meaning that it is 1 frame wide and 4 frames high. This already hints at the concept of animation. An animated texture sprite consists of one texture, that is interpreted in sections that are to be used as frames, just like in a video animation. So the game will display the single frames one after the other, depending on the situation looping over them multiple times. |
| |
The meta-format of sprite definition lines is the following: | You can find an extensive list of sprites used by the stock game in the article [[Sprite Names]]. |
| |
''//<Sprite Name> <Graphics File without .tga> <Starting X> <Starting Y> <Width> <Height> <optional Animation>//'' | |
| |
The sprite name **must** be unique, while the same TGA file might be used by different sprites. However, the texture file for a specific sprite must fit its block definition (e.g. //@reference=64// requires the TGA files used by sprites in that section to be 64 pixels x 64 pixels big). ''//<Starting X>//'' to ''//<Height>//'' are the sprite coordinates. The ''//<optional Animation>//'' is the definition for the [[#Sprite Animations]]. | |
===== Sprite Coordinates ===== | ===== Sprite Coordinates ===== |
In the previous section the parts //Starting X//, //Starting Y//, //Width// and //Height// were not explained very detailed. They are the actual sprite coordinates. As was stated, an animated sprite may consist of multiple frames. Each frame is taken from the same animation, meaning, one texture contains all frames of the animation. TGA does not support animations, such as GIF does. Instead of that, specific sections of the given graphic are interpreted as being one single frame of the entire animation. | In the previous section the parts //Starting X//, //Starting Y//, //Width// and //Height// were not explained very detailed. They are the actual sprite coordinates. As was stated, an animated sprite may consist of multiple frames. Each frame is taken from the same animation, meaning, one texture contains all frames of the animation. TGA does not support animations, such as GIF does. Instead of that, specific sections of the given graphic are interpreted as being one single frame of the entire animation. |
But this method of addressing sections of the graphic also allows to partition a texture for use in animations. | But this method of addressing sections of the graphic also allows to partition a texture for use in animations. |
===== Sprite Animations ===== | ===== Sprite Animations ===== |
The given section (0/0) to (256/64) of the described animated sprite defines only one frame, while the initial animation stated something along the lines of being it a 1 x 4 animation. 1 column (x-direction) and 4 rows (y-direction). This means, there are to be 4 frames found in this TGA file, each one stacked below its predecessor. Meaning, the definition of (0/0) to (256/64) is only the starting frame, with three more coming below it, having the same dimensions. (This also shows, why sprite coordinates are not starting-point + end-point but starting-point + dimensions. The dimensions are re-used for animations and locating the other animation frames.) | The given section (0/0) to (256/64) of the described animated sprite defines only one frame, while the initial animation defined something along the lines of being it a 1 x 4 animation. 1 column (x-direction) and 4 rows (y-direction). This means, there are to be 4 frames found in this TGA file, each one stacked below its predecessor. Meaning, the definition of (0/0) to (256/64) is only the starting frame, with three more coming below it, having the same dimensions. (This also shows, why sprite coordinates are not starting-point + end-point but starting-point + dimensions. The dimensions are re-used for animations and locating the other animation frames.) |
| |
So all frames together are 256 pixels wide and 256 pixels high. Of course the TGA file has to have at least this size. While the example uses a 1 x 4 animation, others are also possible, like a 4 x 4 animation (like the ones used for certain photon torpedoes). For a 256 x 256 TGA file that would give each frame a 64 x 64 size, but 16 of them. They are displayed in the order left to right and then top to bottom (just when reading a book). | So all frames together are 256 pixels wide and 256 pixels high. Of course the TGA file has to have at least this size. While the example uses a 1 x 4 animation, others are also possible, like a 4 x 4 animation (like the ones used for certain photon torpedoes). For a 256 x 256 TGA file that would give each frame a 64 x 64 size, but 16 of them. They are displayed in the order left to right and then top to bottom (just when reading a book). |
| |
| A list of animation names from the stock game can be found in the article [[Texture Animation Names]]. |
| |
{{page>footer&nofooter}} | {{page>footer&nofooter}} |
| |
[\_[[..:modding|Back to Modding]]\_] | [\_[[..:modding|Back to Modding]]\_] |