Catfish's Cave - Resources For Civilization 2: Test of Time

Those Damned Sprites!

A perennial bugbear for Test of Time scenario designers seems to be the nagging persistence of those damned sprites. Sprites from the Original game have a nasty habit of popping up in the middle of scenarios - but it shouldn't be this way. If the scenario designer has a handle on the game's sprite options, then it really should be a piece of cake for the player to switch them off. There's no need to go around moving, deleting or renaming files. I guess it's time to put this one to bed and explain exactly what the sprite settings do.

Sprite Types

Firstly, it might be worth explaining that there are 3 types of sprite file in Test of Time. They are:

  1. Animated Unit Sprites (unitXX.spr): There are 79 of these files in the Original folder, one for each of the 52 unit types in the Original game (including the barbarian leader), 26 from the Extended game, plus the train animation for rail movement (unit99.spr). Each file contains frames for movement, combat and death, plus an idle animation. Animations are displayed only for the unit currently selected by the player, even the idle animation sequence is not used by non-selected units. Additionally, each frame has a complimentary mask layer, used to define the region on the unit marked by tribe colours. The Fantasy and Sci-Fi directories have their own sets of animated sprites, but they will rarely interfere with scenarios: only if the scenario began as one of those game types.

  2. Animated Terrain Sprites (resource.spr): One file contains frames for all animated resources. Each game type, Original, Fantasy and Sci-Fi, has its own file.

  3. Static Unit Sprites (static.spr): One file contains 5 frames for each unit, each frame depicting a different orientation: facing N, NE, E, SE and S. The three east-facing frames are mirrored by the game when a unit moves in a westerly direction, creating a total of 8 orientations. As with the animated sprites, each frame is mapped with a complimentary tribe colour mask. Static unit sprites are used in most areas of the game, with the exception of the Civilopedia, the city @PRODUCTION box and some of the other game.txt boxes (eg, diplomat and spy menus); these always use the units.bmp file.



Sprite Options

From the designer's point of view, an understanding of these options is essential if one is to successfully disable the appearance of sprites from the Original game within a custom scenario. If these settings are in order, there's no need to tamper with the sprite files in the Original folder. I use custom static.spr and resource.spr files for my Original game, and I ain't moving them for no-one. The game's sprite options are found in 3 locations:

1. Game menu

Under Graphic Options (Ctrl+P) in the Game menu, you will find two options:

  • Animated Units: Checking this box will turn on animated units. The setting is universal, ie, it will be applied across all game types and scenarios. If you're playing a custom scenario, leave this box unchecked; I've yet to see an unofficial scenario that uses animated units. Simply put, animated units cannot appear in the game unless this option is selected.

  • Animated Terrain: Checking this box will turn on animated terrain. Again, this setting is universal. One might expect that if this option is left unchecked, animated terrain will be switched off completely. Well it is - almost. Strangely, one frame from the Original game's oil resource (a looping animation) is still rendered by the game. Clearly it's a bug. It's no big deal; there's a simple solution. Any sprite file in your scenario folder will override the one in the Original folder. Therefore, if you include a dummy resource.spr file with your scenario, the bug is bypassed. You can download such a file here. It's only 369 bytes unzipped. Because the dummy file overrides the Original game's file, the animated terrain sprites from the Original game will not be loaded. This eliminates any possibility of animated terrain appearing in the scenario, even when the animated terrain option is enabled.

    Update: In June 2014, the looping animation bug was fixed in version 0.6 of the Test of Time Patch Project.

If either of these options is unavailable, ie, they have been greyed out, it is because you are playing a scenario in which the author has enabled the animation lockout parameters in the Cheat menu (see below). Lockout does not actually disable animation, it only prevents you from making changes to your current animation settings. If, however, you wish to change your options, you're not completely locked out; you can switch to a game in which the animation options have not been locked or alternatively, disable the lockout parameters by editing the scenario file.

2. Cheat menu

Select Scenario Parameters (Ctrl+Shift+P) in the Cheat menu. Go to Edit Special Rules. There are three parameters here and they are the cause of most of the sprite confusion.

  • Terrain animation lockout: This parameter disables (greys out) the Animated Terrain option in the Graphic Options menu. Yep, that's all it does. So don't use it.

  • Unit animation lockout: This parameter disables (greys out) the Animated Units option in the Graphic Options menu. Again, don't use it.

  • .SPR file override: This parameter blocks static unit sprites only. It does not affect animated unit sprites. If your scenario uses a custom static.spr file, leave this setting disabled. Actually, there's really no reason to use this parameter at all; blocking static sprites can be done with precision in the rules.txt file (see below).

Much of the confusion surrounding the two animation lockout parameters is due to the fact that they simply don't work as advertised by the game's developers. Here's an excerpt from the official 1.1 patch readme file:

These items lock the settings they affect to whatever they where [sic] set as when the scenario file is saved. In other words if you have the unit animation lockdown selected and your graphic options have animations turned on when you save your scenario they [sic] the animation for units will ALWAYS be on and cannot be modified. The opposite is true as well. For example if you have the terrain animations turned off and you set the lockout option then save your scenario then terrain animation will ALWAYS be off.

Unfortunately none of this is correct. Of the three sprite-related scenario parameters, only the .SPR file override works correctly.

3. Rules.txt

  • Advanced Units section: The animated and static sprites for each unit can be blocked using the 8th bit (reverse programmer notation) in column G of the @ADVANCED_UNITS section (see below, highlighted red). Setting this bit to 1 will override both the unitXX.spr and static.spr files for the specified unit. Setting these bits to 1 for all units in the table will completely eradicate unit sprites from your scenario irrespective of the user's Animated Units settings.

@UNITS_ADVANCED
11111111, 00000000, 0, 0000000000000000,0000000000000000,0000000000000000, 10000000

The .SPR file override in the Advanced Units section basically renders the one in the Cheat menu obsolete. The only circumstance in which the Cheat menu override would be considered as an option is when the scenario uses no unit sprites at all. Enabling it would blanket ban the static sprites for all units, but why wouldn't you just go a step further and do it in the rules file? That way you can kill two birds with one stone by disabling both the animated and static unit sprites. Instructions to disable animated unit sprites would simply not be required for such a scenario.

Note: When switching between game types (eg, Original, Midgard, etc) or scenarios, it is important that you quit to Test of Time's main menu first. If you simply use the Load Game (Ctrl+L) option in the Game menu, the game's sprites will not be refreshed and you will be presented with the set of sprites from the previous game.


Custom Sprites for Scenarios

It is possible to create custom sprites for Test of Time using Mercator's SpriteGen and CivSprite utilities. Both of these can be downloaded from his website. Custom sprite files are simply placed in the scenario folder; they will override the files from the Original game. Animated sprite files are rarely used (although there are custom resource.spr files in the Graphics Mod Pack for the Original Game and the War of the Ring scenario); static sprites are more frequently used to hide health bars and display tribe colours (see below).

Screenshot of Tribe Colour Masks and Hidden Health Bars in Test of Time

Update: In March 2008, Mercator released version 1.1 of SpriteGen with added support for tribe colour masks. You no longer need to mess with CivSprite when creating static sprites... well, unless you want different unit orientations represented by different icons.

There have been very few attempts to create animated units for Test of Time, so there's little point discussing them here. If you wish to try your hand, CivSprite is the tool for the job. For a discussion and examples, see this thread. To hide the health bars and/or implement tribe colour masks for static unit icons, you want SpriteGen. For more information about hidden health bars, see this post.

Update: In April 2014, the ability to hide health bars was introduced in version 0.4 of the Test of Time Patch Project. Health bars can now be hidden by way of unit flags in rules.txt. Sprite editing is not required. This new method eliminates the side effects produced by tall sprites, namely, disappearing units at high zoom levels and visible health bars at the tops of high resolution screens; a superior solution all round.

Tip: Before running SpriteGen, first make a copy of units.bmp. Replace any purple background colours with magenta (some shades of purple are not recognised by SpriteGen). Remove any superfluous unit graphics, ie, those units without masks or hidden health bars. Run SpriteGen on the file. In the @UNITS_ADVANCED section of the rules file, change the .SPR file override bit to 1 for all units except those with masks or hidden health bars. If you don't, you will end up with a lot of invisible units.


Scenario Examples

To clarify the sprite situation, here are a few examples:

Case 1: The scenario uses no sprites of any kind.

Graphic Options - Animated Units N/A Graphic Options - Animated Terrain N/A1
Scenario Parameters - Terrain animation lockout Off Scenario Parameters - Unit animation lockout Off
Scenario Parameters - .SPR file override N/A Rules File - Individual unit .SPR file overrides Set all to 1

Setting the .SPR file overrides to 1 for all units in rules.txt will eliminate animated and static unit sprites from the scenario. Including the dummy resource.spr file will completely eliminate animated terrain. This setup requires no instructions for the user.

Case 2: The scenario uses no animated sprites of any kind, but uses a static sprite file to hide the health bars of some units.

Graphic Options - Animated Units Unchecked Graphic Options - Animated Terrain N/A1
Scenario Parameters - Terrain animation lockout Off Scenario Parameters - Unit animation lockout Off
Scenario Parameters - .SPR file override Off Rules File - Individual unit .SPR file overrides Variable2

The user should be instructed to leave the Animated units box unchecked.

Case 3: The scenario uses no animated sprites of any kind, but uses a static sprite file to implement tribe colours for all units.

Graphic Options - Animated Units Unchecked Graphic Options - Animated Terrain N/A1
Scenario Parameters - Terrain animation lockout Off Scenario Parameters - Unit animation lockout Off
Scenario Parameters - .SPR file override Off Rules File - Individual unit .SPR file overrides Set all to 0

The user should be instructed to leave the Animated units box unchecked.

Case 4: The scenario uses no animated unit sprites, uses a custom animated terrain file and a static sprite file to hide the health bars of some units.

Graphic Options - Animated Units Unchecked Graphic Options - Animated Terrain Checked
Scenario Parameters - Terrain animation lockout Off Scenario Parameters - Unit animation lockout Off
Scenario Parameters - .SPR file override Off Rules File - Individual unit .SPR file overrides Variable2

The user should be instructed to check the Animated terrain box, but leave the Animated units box unchecked.

1. If you include the dummy resource.spr file with your scenario, it renders this option redundant and removes the oil resource bug.
2. You might consider setting the individual unit overrides for all units with visible health bars to 1. Doing so will allow you to remove these units from the static.spr file, thereby reducing its size.


ShieldKnight_Icon

Catfish

26/01/2005

(Last updated 26/06/2014. ToTPP v0.6 fix for the looping animation bug.)