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

Converting FW/MGE Scenarios to the ToT Format

One of Test of Time's drawbacks is its lack of backwards compatibility with the older versions of Civilization 2 such as Fantastic Worlds (FW) and the Multi-player Gold Edition (MGE). Fortunately, Angelo Scotto came to the fore in early 2000 when he produced CivConverter, a utility capable of converting FW and MGE scenarios to the ToT format. Unfortunately, it never advanced beyond a beta version and as you would expect, it has its share of anomalies and bugs. After reading many questions in the Civ2 forums regarding the use of this utility, I figured it was about time I wrote some kind of guide. This guide presents an outline of the conversion procedure (the readme file may be a little unclear to some people) and a checklist of items that may or may not need attention post-conversion.


1. Download CivConverter

CivConverter version 1.4 beta can be downloaded from the following locations:


2. Prepare the Graphics Files

Before you run CivConverter you must convert the scenario's graphics files to a compatible format. Graphics for FW and MGE use an 8-bit indexed colour palette (saved as either GIFs or BMPs). The format required by CivConverter is 24-bit BMP. Open the scenario's graphics files in your editor of choice and save them all as 24-bit bitmaps. Note: the file title.gif does not require conversion - in this instance ToT uses exactly the same format as FW and MGE.

Paint Shop Pro 8.10: From the Image menu, select Increase Color Depth and then 16 Million Colors (24 bit). Select Save As... from the File menu and then choose 'Windows or OS/2 Bitmap (*.bmp)' in the Save as type box. Click the Options... button and make sure you have RGB Encoding selected. Click OK and Save.

Photoshop 7.0: From the Image menu, select Mode and then RGB Color. Select Save As... from the File menu and then choose 'BMP (*.BMP,*.RLE,*.DIB)' in the Format box. Click the Save button and you will be presented with a BMP Options box. Make sure you have 24 bit depth selected. Click OK.

MS Paint: Select Save As... from the File menu and then choose '24-bit Bitmap (*.bmp,*.dib)' in the Save as type box. Click the Save button.


3. Running CivConverter

CivConverter is a DOS-based program, requiring the use of command lines. In Windows it can be run from either the Command Prompt window or the Run Command in the Start menu.

3.1. The Command Prompt

This method involves accessing the Command (or MS-DOS) Prompt window, changing to the CivConverter directory (folder) and then running the utility on a scenario using a command line. It's basically the same procedure for Windows XP and 98SE, with a few minor variations. The Command Prompt window can normally be accessed via the Start Menu:

Windows XP: Start Menu → Programs → Accessories → Command Prompt

Windows 98SE: Start Menu → Programs → MS-DOS Prompt

All: Start Menu → Run... → type "CMD" (minus the quotes) in the Open box

It is important to run the CivConverter program from the CivConverter directory. Failure to do so will almost certainly result in errors. This may require changing the directory at the Command Prompt before running the utility. Getting this part right has proved problematic for some, so I'll demonstrate the procedure using a few examples (the commands are highlighted in light blue):

Example 1: Assume our scenario is located in the c:\civ2\scenario\ directory and we've extracted CivConverter into c:\unzipped\civconverter\. The scenario can be converted by opening the Command Prompt window and typing the following lines:

CivConverter and the Command Prompt

The first line moves the prompt to the CivConverter directory. The second line executes the program, converting the scenario.

Example 2: Assume our scenario is located in the c:\civ2\scenario\ directory and we've extracted CivConverter into d:\unzipped\civconverter\. Note that in this example the CivConverter utility is located on a different drive to the game installation.

Switching Drives with Command Lines

The first line is required to switch from drive C to drive D, the second line changes to the CivConverter directory and the third line executes the program.

Alternatively, if you're running Windows XP, you can use the /d switch with the cd command to change drives. This option is unavailable in Windows 9x systems.

Switching Drives in Windows XP

Tip: There's an even simpler method that you can use to open the Command Prompt in the desired directory. Install Microsoft's PowerToys for Windows. One of its components adds the Command Prompt to the menu when you right-click on a folder. The prompt will automatically start in that directory. Simply right-click on the CivConverter folder, select Open Command Window Here and enter the command line for CivConverter. Using the same file locations as Example 2, above, the scenario could be converted with just this line:

Using 'Open Command Prompt Here'

Microsoft's PowerToys for Windows XP can be downloaded here:

There is no version of PowerToys available for Windows 98, 98SE or ME. A registry hack is required to implement the 'Command Prompt Here' menu option for these operating systems; something that is beyond the scope of this document. Anyway, if you're still using Windows 9x it's about time you crawled out onto land.

3.2. The Run Command in the Start Menu

The Run Command requires only a single line: the full path to the program and the program's parameters. To convert the scenario from Example 1, above, using the Run Command (all Windows versions):

1. Start Menu → Run... (or Windows key + R)

2. In the Open box, type: c:\unzipped\civconverter\civconverter c:\civ2\scenario\scenario.scn

3.3. Common Issues

Multiple Game Files: If a scenario uses a batch file to implement multiple game files, you will be required to run CivConverter multiple times, each time temporarily changing the file names, eg, units2.bmp would need to be renamed units.bmp so that it can be recognised by CivConverter.

CivConverter Crashes: This is usually the result of an incompatible labels file. It occurs when a labels.txt file derived from classic Civ2, Conflicts in Civilization (CiC) or FW is used with a scenario file made with MGE. CivConverter reads the 11th byte in the scenario (.scn) file. If the value returned is 0x2C, the scenario will be identified as an MGE creation. The program will then attempt to convert the labels file as though it were also an MGE file, causing it to crash. A partially written labels.txt file will result. This file will, in turn, crash ToT if you use it with the converted scenario (see section 5, below). Removing labels.txt from the scenario directory prior to running CivConverter will avoid the problem. If CivConverter has crashed, run the program again - it will not have finished converting all the files.

Note: CivConverter will accept long file names, but it's not keen on spaces in the pathname. Including them will produce the following error message:

Error in opening Scenario File!
Please check for existence of file and
remember to use full path & extension

If the name of the scenario (SCN) file contains spaces, run CivConverter with the entire pathname enclosed in quotation marks, eg, civconverter "c:\unzipped\redfront\red front.scn".

If spaces exist within directory names, then you'll be required to rename them using the standard 8-character DOS format, eg, a scenario located at c:\unzipped\red front\redfront.scn would require the command line: civconverter c:\unzipped\redfro~1\redfront.scn. In this case, enclosing the entire pathname in quotation marks would cause CivConverter to crash, producing the following error message:

The syntax of the command is incorrect.

If the scenario.txt file contains spaces, manually copy this file to the Converted directory.

3.4. CivConverter Done

You should now have a new folder in your scenario directory called Converted. This contains the new converted scenario. Move the folder to your main Test of Time directory. Give it a meaningful name, eg, ToT_OriginalScenarioName.


4. Post-Conversion Checklist

The following is a checklist of items that may require attention post-conversion. I'm not going to fall into the trap here of writing a how-to guide on graphics and hex editing - much of this will be assumed knowledge. This is a list that I use and is not exhaustive.

Note: Changes to the SCN file can generally be implemented by either of two methods:

1. Loading the SCN file, making the modifications and resaving as a scenario. Before employing this method, I'd firstly recommend that any events.txt files be temporarily relocated. This is a precautionary move against ScenarioLoaded events - obviously loading the scenario will trigger them. You should never open a scenario for editing using the Begin A Scenario option in the main Test of Time menu. Doing so advances the scenario by 1 turn, thereby affecting research, production, gold, etc. You can load a scenario (.scn) file using Load Game (Ctrl+L) in the Game menu - just like a normal saved game. The scenario file will not appear in the file list; you will need to enter the name of the scenario (with the .scn extension) in the File name box. After making your changes to the scenario, select Save As Scenario from the Cheat menu.

2. Hex-editing. Sometimes it's easier to make changes to a scenario file by hex-editing - sometimes it's the only way. Where hex-editing is an option I'll provide offset locations. For more information about the layout of the SCN file, check out the Saved Game File Format page.

  • Units.bmp: Unit icons are placed 6 pixels too high, as shown in the example below (taken from the FW Dinosaurs scenario). These should be lowered. I believe this was a deliberate decision on the part of CivConverter's author. It can, however, cause visual 'aberrations' in some scenarios, particularly with respect to immobile/terrain units.

Converted Dinosaur Units

  • Units.bmp: ToT mirrors unit icons according to their direction of movement. The icons of left-facing units should be mirrored so that they face to the right, otherwise they will appear to be moving backwards in the game. In the dinosaur example, you should end up with this:

Corrected Dinosaur Units

  • Units.bmp: In FW and MGE, the 63rd icon slot is reserved for the Barbarian leader (diplomat). In ToT this is the 81st slot. Move the 63rd icon to the 81st slot.

  • Terrain1.bmp: The tiles for the desert, grassland, forest base, hills base, mountains base and jungle slots are incorrectly mapped to the converted bitmap. ToT uses 3 graphic slots per terrain type; FW and MGE use just one. Rather than simply replicating the original tiles in triplicate, CivConverter uses the spare graphic slots in column two of the original file to create the 2nd and 3rd tiles. Clearly it's a deliberate decision on the part of the author, based on the layout of the official terrain1.gif files - but really the spare slots could contain anything. More often than not you'll end up with something inappropriate. To fix this, simply copy terrain column one and paste it into columns two and three.

  • Terrain2.bmp: The cyan numbers frequently found in the river mouth icon boxes (see below) are sometimes visible in ToT's city information screen. Blank them out.

River Mouths

  • Cities.bmp: In ToT, any tribe that possesses the Invention tech (Inv) will use the city style in the 7th row. This applies only if the tribe doesn't also possess Industrialisation (Ind) or Automobile (Aut) + Electronics (E2), in which case it will use the 5th and 6th rows respectively. The 7th row, used for the Renaissance city style in ToT's Original game, is not used by older versions of Civilization 2. You may be required to copy and paste one of the other city styles to row seven.

  • Cities.bmp: The blue vertical flag position markers in the city icon boxes (see below) are not read by ToT - flags are always positioned high. On occasions, you may find that you have to manipulate the position of the blue horizontal marker and/or the city icon itself to avoid the appearance of a 'floating' flag.

City Flag Position Markers

  • Icons.bmp: CivConverter only copies the city improvement, wonder and advances icons from the original scenario file. All other icons, including shield, food, trade, pollution, revolt, research and global warming icons are not transferred. This must be done manually. Remember, that if pollution has been eliminated from the scenario (Cheat menu → Scenario Parameters), you should remove the pollution icon.

  • People.bmp: The cells for the people icons in the official file from the Original game are misaligned. CivConverter repeats this error. The pixel in the top-left corner of each cell defines a secondary transparent colour (after magenta) for the corresponding icon. If the frame for the cells is incorrectly aligned, it can cause transparency problems, especially if the frame is black. To avoid this, realign the blocks of cells so that the top-left corner of the large frame lies at position (1,5), as shown below.

Correct Cell Alignment in People.bmp

  • All graphics files: Some 8-bit Civilization 2 palettes contain a shade of grey (#878787) which is shared by two indices, 16 and 255. Index 255 is given the transparent colour property, whilst index 16 is a standard visible colour. When the original 8-bit (indexed palette) graphics are converted to 24-bit colour, there is nothing to differentiate the two types of pixels. CivConverter automatically replaces this shade of grey with magenta (#FF00FF), ToT's universal transparent colour. Clearly this means that any former index 16 pixels will also be converted to magenta. This can produce 'holes' in your icons, as shown below. Manual correction is required - use a colour replacer tool (if your editor has one) to restore the grey colour.

Example of Magenta 'Holes'

  • Game.txt: ToT requires a wider Build menu box (city information screen) than FW and MGE. The default width for FW and MGE is 440; for ToT it's 500. Depending on the length of the unit/improvement/wonder names, it may need to be wider still. Under the @PRODUCTION entry, increase the width to a minimum of 500.

  • Game.txt: Under the entry @HOCKTHIS, insert the line, 'Sell %STRING0 from all cities for %NUMBER1 gold.' between the lines 'Sell it.' and 'Never mind.'; otherwise you won't be provided with a cancel option in the game. Selecting 'Never mind.' will sell the lot. Substitute the word 'gold' with an appropriate denomination if the scenario uses something other than gold as the unit for cash.

  • Game.txt: In some scenarios there is an additional line under @EDITSCEN. Below 'Maximum Turns (%NUMBER3)' you may find an entry for 'Toggle Scenario Flag (%STRING0)'. This is so rare that I suspect it's found only in files derived from CiC. It's not a major issue, but it will throw out your Scenario Parameters menu (Ctrl+Shift+P). If present, simply delete the entry from the list.

  • Game.txt: Check that the Foreign Minister's screen (F3) is wide enough to display all text. The width can be adjusted under the @REPORTFOREIGN entry. The default is 580.

  • SCN File: FW uses major (x3) objective cities; MGE and ToT don't. This poses a problem when converting FW scenarios which use Objective Victory Conditions. Any major objectives will be completely ignored by ToT, resulting in inaccurate victory thresholds. The solution is to assign minor (x1) status to all of the former major objective cities and adjust the victory conditions accordingly. Load the scenario and make the changes.

Hex-editing: When dealing with large numbers of cities, you may find that hex-editing is a much more efficient method of amending the file. A city's objective status is stored in the 10th city byte (of 92 bytes). Values of 0x10 should be changed to 0x04. The 10th byte also contains auto-build settings (0x01 military advisor, 0x02 domestic advisor), but these values are so rare it's not worth worrying about.

  • SCN File: Check that no units in the scenario have been issued with the 'Build Transporter' order, as shown below for the conversion of the FW Dinosaurs scenario. Load the scenario and clear these orders. If the unit is not reassigned orders, a transporter will be constructed - albeit a useless one.

Example of 'Build Transporter' Orders

Hex-editing: The incorrect order is caused by an error in the value of the 18th unit byte (copied from the 16th unit byte in FW and MGE). In FW and MGE, a byte value of 0x0B indicates a 'Go to' order. In ToT, the same value produces a 'Build Transporter' order, with the 'Go to' value increased to 0x0C. Scan these bytes in the units block and change any values of 0x0B to 0x0C.

  • SCN File: For many converted scenarios the Defence Minister's screen will contain bizarre casualty counts in the unused unit slots. The screenshot below, taken from a conversion of Captain Nemo's Red Front scenario, shows an example. This problem can only be solved by hex-editing.

Example of Incorrect Casualty Lists

Hex-editing: The offsets for the casualty lists are constants. This makes matters easy. There are 8 blocks of 80 bytes, one block for each tribe. The offsets are 3248 to 3327 + 3348N, where N is the tribe number (0 to 7, starting with Barbarians). Zero everything in these blocks.

  • SCN File: In ToT airbases are no longer assigned city attributes. Consequently they no longer possess the railway improvement property. In some converted scenarios, I've found that the change has created interrupted roads and railway lines. You may have some patching up to do.

  • SCN File: CivConverter automatically enables the Terrain and Unit animation lockout options (Cheat menu → Scenario Parameters). These don't work as described in the 1.1 patch release notes and really should be disabled. They simply serve to prevent users from changing their current animation settings in the Graphic Options menu. They are nuisance value. Load the scenario and disable them.

Hex-editing: The offsets for the two lockout options are variable, but their location can be determined by finding the scenario name string near the end of the SCN file. The two bytes that precede this string contain the scenario parameters settings. To disable the Terrain animation lockout option, subtract 0x80 from the first of these bytes. To disable the Unit animation lockout option, subtract 0x01 from the second of these bytes.

  • Hiding Unit Health Bars: Some scenarios use units as immobile structures or impassable terrain. In the FW/MGE version their health bars and shields will often be hidden from view. If you wish to do the same in ToT, you'll need Mercator's SpriteGen utility. It creates a static sprite file which raises the health bar beyond the viewable area of the screen (at standard zoom levels) for selected units. However, the static.spr file will not work with the scenario until the .SPR file override option (Cheat menu → Scenario Parameters) is disabled. CivConverter automatically enables this option. Load the scenario and disable it.

Hex-editing: The offset of the .SPR file override is variable. It's stored in the same byte as the previously mentioned Unit animation lockout option, ie, the byte preceding the scenario name string near the end of the SCN file. To disable the .SPR file override option, subtract 0x02 from the value of the byte.

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 all superfluous units from the file, ie, the ones for which you want the health bars to remain visible (this dramatically reduces the size of the output file). Run SpriteGen on the file, checking the boxes for the remaining units. Open the rules.txt file for the Original game, copy the @UNITS_ADVANCED section and append it to the rules.txt file for the converted scenario. In column G, change the .SPR file override bit to 1 for all units except those with hidden health bars - if you don't, you will end up with a lot of invisible units.

  • Resource.spr: To completely remove any possibility of interference from the Original game's animated terrain sprites, simply drop a dummy resource.spr file in the scenario directory. This file can be downloaded here. Don't worry, it's only 369 bytes unzipped.

  • Rules.txt: Goodie huts will not appear in a scenario unless you add the goodie hut bitmask to the Cosmic Principles section of the rules.txt file. To remedy this, open the rules.txt file in the Original game folder. Copy all of the @COSMIC entries after 'Max effective science rate in fundamentalism'. Append these to the @COSMIC section in the converted rules file.

  • Rules.txt: If you want the correct sounds to be assigned to the correct units, then you will need to include a @SOUNDS section in your rules.txt file. If you don't, ToT will use its own scheme to map unit sounds - and it differs from the FW/MGE one. Open rules.txt in the Original directory, copy the @SOUNDS section and append it to the rules.txt file for the converted scenario. Replace the entries with appropriate ones.

  • Labels.txt: CivConverter only partially converts labels files for MGE scenarios and doesn't even touch those for FW. If an MGE scenario uses a labels file derived from an older version of Civ2 then it will even crash CivConverter (see section 3.3). The upshot is that the file really needs to be converted manually (thanks to Mercator for bringing this up). To convert labels.txt to the ToT format, make the following changes:

  1. Increase the value under @STRINGHEAP to 50000. This is the amount of memory allocated to the game's string variables.

  2. Increase the first entry under @LABELS to 922. This is the number of lines in the table.

  3. Add the missing ToT entries to the @LABELS list. The number of missing entries depends on the version of labels.txt used by the original scenario:

Classic Civ2 (normally 458 lines): Append all lines following the 'SCORING COMPLETE' entry in ToT's labels.txt file to the end of the scenario's labels file.

FW (normally 606 lines): The FW list contains additional entries for the scenario editor. Append all lines following the 'Rename Default Values' entry in ToT's labels.txt file to the end of the scenario's labels file.

MGE (normally 888 lines): The MGE list contains additional entries for multi-player support. Open ToT's labels.txt file and copy all of the lines from the 'Available Now' entry, up to and including 'Teleporter type 2'. In the scenario's labels file, insert these lines between 'Modem/Direct Connect' and 'Intercept Chat Messages', then delete all of the lines following the 'Map Size:' entry. Go back to the ToT labels file and copy everything after 'Map Size:'. Paste these lines at the end of the list in the scenario's labels file.

  • Pedia.txt and Describe.txt: In ToT the presence of the improvement/wonder graphics in the Civilopedia's Information screens reduces the area available for text from the pedia.txt file. If the author of the scenario used large descriptions, they may not be fully displayed. The best option here is to cut the text from the entry in pedia.txt and relocate it to the corresponding one under @@IMPROVEMENT_INDEX or @@WONDER_INDEX in describe.txt. The text can then be viewed by clicking the Description button in the Information screen. If the original scenario did not include a describe.txt file, then neither will the converted scenario - so create one. I use this file as a template.

  • Pedia.txt and Describe.txt: ToT's Civilopedia uses the government descriptions from describe.txt, not pedia.txt. If no describe.txt file is present in the scenario directory, the game will read the one from the Original directory. Again, if no describe.txt file was included with the original scenario, you will need to create one (see previous). Copy the @PEDIAGOVT entries from the pedia.txt file and paste them in the corresponding sections under @GOVERNMENT_DESCRIPTIONS in describe.txt.

  • City Improvement and Wonder Graphics: Obviously older versions of Civilization 2 don't use custom city improvement and wonder graphics. Unless you create your own, the game will use the default ones (01imp.bmp to 67imp.bmp) from the Original game directory.

  • Batch Files: If the scenario uses a batch file to change graphics during the course of the game, make sure this file now uses the correct file extensions. Remember, any GIF files will now be BMPs.


5. The Converted Scenario Crashes the Game

With CivConverter 1.4 beta, the conversion process is far from perfect and on occasions you may find yourself with a converted scenario that crashes the game. I am aware of two causes that are directly attributable to CivConverter:

1. Corrupt Labels File: As stated in section 3.3, partially written labels.txt files (created when CivConverter crashes) will crash ToT if used with the converted scenario. Remove the offending file from the original scenario's directory and run CivConverter again.

2. Corrupt Data in the SCN File: There are a number of scenarios around that, when converted to ToT, will crash the game during the first turn of play. Examples of these include Bonaparte II by John Ellis, and 2194 Days of War by Captain Nemo and Alex the Magnificent. This is not caused by the presence of x3 city objectives, as has been stated many times elsewhere (including CivConverter's readme file), but by a corrupt table found at the end of each block of tribe variables in the SCN file. All converted scenarios suffer from the problem; it's just that most can cope with the garbage data without crashing. As players take turns, these tables are updated and old values are overwritten, so if a scenario survives the first turn it will probably work out fine. However, this does not mean that the scenario is unaffected: after all, the game still reads this junk on the first turn and often the lower part of each table is not rewritten until the more advanced stages of a game. Therefore, it's recommended that the following fix be applied to all converted scenarios, not just those that crash on the first turn.

Technical Info: The table in question contains entries for up to 64 map locations. Its function is a bit of a mystery, but I believe it is associated with AI goals. In FW and MGE, these tables are located at offsets 3322-3705 + 1428N, where N is the tribe number (0 to 7, starting with Barbarians). Each table is 64 x 6 (384) bytes. The first 4 bytes of each 6-byte entry contain the map coordinates; the function of the last 2 bytes is currently unknown. In ToT, these tables are located at offsets 5778-6289 + 3348N. That's 64 x 8 (512) bytes; ToT has an additional coordinate (2 bytes) for map number.

Instead of expanding the original table to include the 2 extra map bytes, CivConverter, inserts 98 zero bytes at 5753-5850 + 3348N, then takes the 25 bytes that preceded the table in the original file and dumps these at 5851-5875 + 3348N. The first 49 x 6 (294) bytes of the original table are copied unaltered to 5876-6179 + 3348N, but the last 15 entries are expanded from 6 bytes to 8, with 2 zero bytes inserted at the beginning of each entry. Net result: corrupt tables.

Solution: That's right, it's a hex-editing job. You need to edit the 8 tables located at offsets 5778-6289 + 3348N, where N is the tribe number (0 to 7, starting with Barbarians). If you're nuts, you could carefully recreate the tables using the data from the original scenario. A more practical solution is to simply zero all values in each table until you reach entries of 0x000000000000FF00. This essentially restores the tables to the same state you'd find for a completely new game.

Top

Catfish

5/02/2005

(Last updated 26/12/2007. Added another entry to the checklist.)