How to Create Sprites

By SubRosa

Sprites are simple, 2-dimensional images used by the game to replace full 3-dimensional models and skins when viewing units from a great distance. The reason for doing so is simply because it saves the computer processing power, making the game run faster. RTW already comes with Sprites for all the original units. However, modders often want to add sprites for the units they create themselves. This article will show you how.

Before you change any of your data files, be sure to make a backup copy of it first. That way if worse comes to worse you can always restore your original in case you really mess something up.

Getting Started

First, make sure your game is set to run in only 16 bit graphics rather than 32 bit. Also turn off Anti-Aliasing, otherwise you will just get black pictures. When doing this be sure to check your video card's settings as well as those in the game, because sometimes your video drivers will override a game's. Finally, be sure you are not using the -ne command switch, as the sprites may not generate properly with it.

Now you must add the -sprite_script switch to your game's command line (look here to learn more about command line switches). Next you must create a text file named sprite_script.txt in your game's root folder (the one the .exe files are in). In this file you must list units you want sprites generated for. Use one line per unit, and enter in the Soldier name used for the unit (also the same name used in Descr_Model_Battle.txt), followed by a space, and then the faction you want the sprites for. Use "no_faction" if you do not want the sprites for any particular faction. For example:

amazon_cavalry   pontus
merc_amazon_archers   no_faction
slave_amazon_archers   slave

You will also need a RTW\Data\Sprites folder. It probably will not exist to begin with as the sprites that come with the game are kept in the pack files, so if it is not, go ahead a create the folder.

Generate Your Sprites

Then start up the game. It will give you no indication of the progress of the sprite generation. It will simply go the main screen and close automatically when it is finished. Afterward you will find your sprites in your RTW\Data\Sprites folder. There will be a *.spr file for each unit you listed, and a number of *.tga files. For exmaple:

amazon_amazon_hoplite_elite_sprite.spr
amazon_amazon_hoplite_elite_sprite_000.tga
amazon_amazon_hoplite_elite_sprite_001.tga
amazon_amazon_hoplite_elite_sprite_002.tga
amazon_amazon_hoplite_elite_sprite_003.tga

You can use the .tga files as they are, but it is much more efficient on space to convert them to .dds files in a graphics editor such as Photoshop first. If using Photoshop you will need to install the Nvidia .dds plugin first. Save your .dds files with DXT5 compression, generate mip maps on, and swap red and alpha off. Like this:

Also note that if you do convert them to .dds files, you will have to go back afterward and change the files names from *.dds to *.tga.dds. Like so:

amazon_amazon_hoplite_elite_sprite.spr
amazon_amazon_hoplite_elite_sprite_000.tga.dds
amazon_amazon_hoplite_elite_sprite_001.tga.dds
amazon_amazon_hoplite_elite_sprite_002.tga.dds
amazon_amazon_hoplite_elite_sprite_003.tga.dds

Enable The Sprites

Now that you have your sprite files, you have to tell the game to use them. You do this by editing the RTW\Data\Descr_Model_Battle.txt file. Go to each unit you generated spites for and add a sprite line referencing the *.spr file. Example:

type amazon_hoplite_elite
skeleton fs_slow_spearman, fs_slow_swordsman
indiv_range 40
texture amazon, amazon/data/models_unit/textures/amazon_hoplite_elite.tga
model_flexi amazon/data/models_unit/amazon_hoplite_elite_high.cas, 15
model_flexi amazon/data/models_unit/amazon_hoplite_elite_med.cas, 30
model_flexi amazon/data/models_unit/amazon_hoplite_elite_low.cas, 40
model_flexi
amazon/data/models_unit/amazon_hoplite_elite_lowest.cas, max
model_sprite 60.0, data/sprites/amazon_amazon_hoplite_elite_sprite.spr
model_tri 400, 0.5f, 0.5f, 0.5f

That is it, happy spriting!

"));