Ruges Guide to Adding Units

From SupremeWiki, a collaborative guide to games by BattleGoat Studios.

Contents

Modding Units

Overview

The following is a lession on how to modify the military and "improvement" (facility) Units in an existing SR2020 Campaign. This process is known as "modding" and the resulting customized game and its source files are referred to as a "mod".

Generally Scenarios are based upon an underlying Campaigns, so in order to mod the Units of a Scenario one must mod its Campaign instead.

A "quick and dirty" way to add Units to your game is by directly editing the DEFAULT.UNIT file located in the /Maps/Data folder. But since this could jeopardize important game files, the best way to do this is by creating your own supplementry .UNIT file as explained below.

Data Format

The existing DEFAULT.UNIT and the new .UNIT file that you are about to create are both purely "text" files formatted as a data "spreadsheet". Spreadsheets consist of rows and columns of data, where each discreet element of data is referred to as a "cell". The common SR2020 data format is "MS-DOS CSV" or Microsoft Comma Separated (delimited) Values. This data format is a common one in the PC world and is well supported on nearly all spreadsheet programs for the PC.

It is important to keep in mind that all of the spreadsheet data cells that you will be working with are "Text" data - even numbers like "2.0453" are the text representations of the number. When transferring this data to and from spreadsheet programs be sure to always specify "text" as the data type.

In the previous Supreme Ruler 2010 game, all of the column-oriented data in the .CSV files were strictly separated by commas only such as:

column 1 data, column 2 data, column 3 data, ...

If you saved a SR2010 spreadsheet and allowed text cells to be delimited with double-quotes in addition to commas like this:

"column 1 data","column 2 data","column 3 data", ...

then the SR2010 program would refuse to read the file and terminate.

In SR2020 some of the .CSV formatted text data is both comma and double-quote delimited. .UNIT files are not and it is probably still important not to save your spreadsheet work as double-quote delimited text fields.

Tools

In order to create this mod you may want to use some sort of spreadsheet program such as MS-Excel. Since we will be working with text files, the Notepad text editing program will work too, but it will make the data columns of the spreadsheet more difficult to read since there is no mechanism to align the data columns so that they line up as straight columns of data, row-by-row. This will increase the time that it takes to do your editing. Using Notepad creates a higher chance of errors and makes these errors more difficult to spot.

I suggest using OpenOffice (which can be downloaded for free from www.openoffice.org ). MS- Office Excel works too, but I actually prefer using OpenOffice. The following modding instructions will reference unit data columns using the Excel/OpenOffice column lettering system.

The DEFAULT.UNIT File

Let's take a look at the DEFAULT.UNIT file.

Navigate to the "Supreme Ruler SR2020" folder in your "Program Files" folder.

Open the SR2020 MAPS/DATA folder where the DEFAULT.UNIT file is located.

Open DEFAULT.UNIT with your chosen editor program. I suggest not making Excel or OpenOffice the default programs for opening .UNIT files, so you should to un-check the "always use this to open" box on the initial Open prompt if you are using a formal spreadsheet program.

In row 1 you will see the line "&&UNITS". This is the command line that tells the SR2020 program that the data in this file describes Units. Nothing else should be added to this row.

The Units data begins on row 2. This is the list of SR2020 units where each row of data contains the info and stats that constitute a Unit. Each column is designated for a specific type of Unit data.

Windows Explorer File Extensions

For this task you must first adjust your Windows Explorer file display to show file extensions. If this is not already the case then go to Tools/Folder Options/View in Windows Explorer and then un-check the checkbox that says "Hide extensions for known file types". Press the "Apply" button to confirm the change. For Windows XP you may need to do this from the Control Panel.

Spreadsheet Column Headers

The file below contains all of the column header info that you will need:

DownArrow.png

Download EQUIPLIST.zip
Version compatibility: All
Author: Chris
Notes: .XLS format with Headers

Download this file, un-zip it and open it with your spreadsheet program. You will see that it is a .UNIT file (although an older version). However this version also includes an extra four rows of descriptive header text above the &&UNITS command line.

Row 1 of the new file contins the column headers that describe what the data in each column represents. Row 2 contains special column headers used only for upgrades (buildings, based and facilities). Row 3 contains special column headers used only for missles. Row 4 contains supplementry developer notes about each data column. Look here for possible valid values for that column.

Create a new text document in the MAPS/DATA folder and name it MYMOD.UNIT. The OS may warn you that changing the file may make it unreadable. Click "Ok" for this warning.

Now open this new file with Excel or OpenOffice. It will be a blank sheet with all the boxes in it and such.

Go back to the second DEFAULT.UNIT you opened, the one that had all the headers in it.

Highlight and copy cells 1-A through 5-DF from this document. If you are using Notepad, simply "Copy" the first five entire lines from the file.

Go back to your MYMOD.UNIT, select cell A-1 and "Paste" the column header cells into your blank document. Now you have all the column headers including the &&UNITS line.

Designing Units

Now lets look at some basic fundamentals of adding new units to the game:

Look once again at the DEFAULT.UNIT file. Column 1 is always the unit's ID number. This number should always be unique from any other unit, including the ones from the DEFAULT.UNIT file. If you do re-use the same ID for another unit, then that new unit will replace the previous one in the list and the original unit will be deleted from the game. Notice that the original sequence of unit ID numbers has "holes" where numbers in the sequence have been skipped. You can use these missing ID numbers and assign them to your own new units.

Unit ID numbers are assigned according to unit class. Any unit that has an ID number from 1-999 belongs to the "Infantry" class and is a infantry unit. Units that have IDs from 1,000-1,999 are of the Recon class. Units that have an ID of 2,000-2,999 are of the Tank class, etc. This rule is not absolute, but will help you make a better mod, and will make it easier for others to read if you decide to share it.

Unit Classes

Unit class info can be found here:

Unit Class Info

You must use the Unit class numbers from this page in the "Unit Type" column 'C' in your .UNIT file. They are also easy to spot in the DEFAULT.UNIT file.

Region Farication Codes

Column 'M' is the region code. This code indicates which Regions are allowed to fabricate the Unit. A look-up table of region codes is located here:

Region Codes

Suppose you want to allow France and Germany to produce a unit. You would then use the letters "FG" in column 'M' of that Unit's row. Or if you wanted the U.S., Germany, South Korea, Israel, France and Brazil to make the unit you would put "BFGIKU" in column 'M'. When you designate multiple fabricating regions like this the Unit's origin will be displayed in the game as "Multiple". Other Regions not authorized to produce a Unit can still trade for it, even though they are not permitted to fabricate it. Also note that '*' can used so that all regions may produce it.

Spotting Types

Column 'V' and 'W' are the spotting type. If you open up your Spotting.csv file located in the INI folder of the game, the first column lists the ID numbers for the spotiing type. I have created an easy-to-read graph of Spotting Types here:

http://home.earthlink.net/~sr2020_ruges2/sitebuildercontent/sitebuilderpictures/spottype5.jpg

You can read more about Spotting Types here:

Spotting Types

You must include a valid spotting ID number in the .UNIT file or the unit's spotting value will be 0.

Prerequisites

Column 'X' and 'Y' are prerequisite technologies. In the same folder as your .UNIT is a file called DEFAULT.TTRX. Open it with Notepad or Excel. The first column is the techs ID number. You can add a prerequisite technology to Unit by placing this number in column 'X' or 'Y'. You will then have to research that tech before you can the Unit's design becomes available for research. Make sure that the new Unit's tech level is equal to or higher than the tech level of its prerequisite tech, otherwise it will be impossible to research the new Unit.

Create a New Unit - Example

The above discussion gave you the basic information that you need to create a new Unit. The column headers explain the significance of most of the Unit's other specifications. So now let's actually create a new Unit and create a new missle for the U.S.:

I like to cheat when I do this - it makes the process much easier:

Look at the original DEFAULT.UNIT file.

We will first select a missile Unit that is simular to the missile that we want to mod.

Scroll down to unit ID 8586 - the UGM-84A Harpoon Block 1A missile.

Select the entire row and copy it.

Go back to your MYMOD.UNIT file editing session.

Select box 6-A (should be your first row availible under the &&UNITS line.

"Paste" the copied missile unit line there.

Look in the original DEFAULT.UNIT again and find the first available missile ID that is not used.

In our case missile unit ID 8588 is not used.

Return to your MYMOD.UNIT file again and change the old ID of "8586" to "8588".

Now give your new missile Unit a name. Since it is going to be an advanced version of the "UGM-84A Harpoon Block 1A" we can change column 'B' and call it the "UGM-98B Harpoon Block 2B".

Now we will also change the new missile's tech level to 98 in column 'E'.

Since this is going to be a U.S. Unit we will change column 'M' from "JU" to just "U".

We will increase the Unit's cost by modifying the "cost to build" column AA.

We can increase the range of the new missile by changing column AG.

We can also increase some of the missile's attack and defense stats in columns AL-AV.

If you are finished adding new Units and are not interested on modifying the specifictions of existing Units then proceed to the section below titled "Saving Your Work".

Modifying Existing Units

If you are dissatisfied with the way that a Unit in the game performs then you can modify its behavior by over-riding its default specifications in the DEFAULT.UNIT file.

First locate the original Unit's ID and specification row in the current DEFAULT.UNIT file.

Copy the Unit's row and paste it into your MYMOD.UNIT supplement file.

Modify the data column(s) that correspond to the Unit virtue that you dislike.

Repeat the above until you have all the units you want added or changed.

Saving Your Work

Once you have finished modding your Units you must save your supplementry MYMOD.UNIT file.

You may first want to delete the four column header discription rows. To do so highlight rows 1-4 and delete them. If the header rows are prefixed with "//", then this indicates to the SR2020 program that they are non-functional "comment" rows and the program will ignore these header rows and it is unnecessary to delete them.

If you have deleted the column header rows then the "&&UNITS" row should be at the top position 1-A in your spreadsheet.

Save the file and close it.

Reopen MYMOD.UNIT using Notepad and inspect the "&&UNITS" row. If the text is surrounded with literal double-quotes like this:

"&&UNITS"

then remove the double-quote characters so it looks like this:

&&UNITS

If other text data between the comma characters in the file are surrounded with double-quotes, then you have not saved the file in the correct format when you closed it in your spreadsheet application. If so, you must do your work over and this time save it in a non-quotation-mark delimited format. Save and exit.

Scenario File Modification

Now that we have stored all of the new Unit data into our supplemental MYMODS.UNIT file, we need to incorporate this new Unit data into the source data files that the SR2020 program uses to create a new game Campaign file.

The single text file that ties together all of the information files used to build a Campaign cache file is called a Scenario file and its file extension is .Scenario. There is a certain confusing ambiguity here because both SR2020 Campaigns and SR2020 Scenarios use .Scenario files.

For the SR2020-Global Crisis expandion pack we must open the SR2020 "CampaignGC" folder. Or for the standard SR2020 game we open the regular "Campaign" folder.

From the selected campaign folder select the .Scenario file for the Campaign that you want to Mod.

"Copy" this target .Scenario file and "Paste" it back into the same folder using a new distinctive name of your choice like "My Modified Campaign".

Open the renamed .Scenario file with Notepad. Locate the line that reads:

  1. include "DEFAULT.UNIT", "MAPS\DATA\"

"Copy" this line and "Paste" it on the next line, so that you have two identical lines.

Modify the second line to read "MYMOD.UNIT" instead of "DEFAULT.UNIT". This will allow the SR2020 program to process your Unit over-ride file data after it processes the original default data in "DEFAULT.UNIT".

Your modified .Scenario file should look like this:

  1. include "DEFAULT.UNIT", "MAPS\DATA\"
  2. include "MYMOD.UNIT", "MAPS\DATA\"

Any extra blank spaces do not matter.

Now scroll down to where it says:

savfile "Global Crisis"

Note: it may not read "Global Crisis" - it will be the name of the original SR2020 Campaign that you choose modify.

Change the old file name, such as "Global Crisis", to the name of your new Campaign like "My Modified Campaign".

Save and close the file.

Cache File Generation

We will now build or "compile" a new game file or "cache" using the original files from the Scenerio that you decided to modify, but also incorporating the new Unit data from your "MYMOD.UNIT' file. All of the information from the text files previously listed in the modified Scenario file will be recombined with the original binary game map file, along with your modified Unit specifications.

The result will be a new .SAV game file that can be loaded and played just like the Campaign files originally supplied with your game. Since it is a .SAV (save game) file, the new new cache file will be created in your SR2020 Savegame folder. This new compilation is performed by the SR2020 game program itself. To start the process do the following:

Restart the SR2020 program.

WARNING: The next steps will begin a lengthy task on your computer, during which your PC will become unavailable to you.

Navigate to the "Single Player/Campaign" screen and select your modified Scenario by selecting its name from the list (like "My Modified Campaign").

Begin the cache file compilation by simply launching your modified Campaign just as though you were launching any new game.

This will begin the creation of a new "cache" file. This takes a long time. Your computer will "freeze up" and you will not receive any progress indication. You will not be able to window out or do anything with your computer. This game-building process may take anywhere from 30 mins to 2 hours so you may want to go and enjoy real-life for a while.

Once the cache build/compiltion process is completed the SR2020 program will return to its start-up screen.

Quit the SR2020 program.

Navigate to your SR2020 Savegame folder and locate the new cache .SAV file who's filename begins with the word "CACHE" and who's date/time stamp indictes that the file was newly-created.

Copy this new cache file from your Savegame folder.

Save the new file to your SR2020 Cache or CacheGC folder.

Assign a new game name to your new modified cache file.

You can now start the SR2020 program normally and navigate to "Single Player/Campaigns", select your newly modded game and play it. Your new units should exist in the new game for you to research, fabricate and deploy.

For SR2020 Update 6 (Gold Edition)

Update 6 supports "Windowing" which will allow you to switch to other computer tasks while your cache is compiling, just like with any other regular Windows application.

Using your Unit Mod in a Scenario

As we said above, SR2020 Scenarios are build upon an underlying SR2020 Camapign. In order to use your newly modded Campaign cache file in a SR2020 Scenario you must modify the .Scenario file of the target Scenerio.

Navigate to the SR2020 Scenario filder or the ScenarioGC folder for the GC expansion pack.

Here you will see dozens of SR2020 files named after their Scenarios.

Select and open the .Scenario file for the SR2020 Scenario that you wish to modify, using Notepad.

It will look like this:

// SCENARIO DEFINITON // ifset key: 0x01: Load CVP; 0x02: Load Rest of Source; 0x03: Load all; 0x04: Load Cache

  1. ifset 0x01
  2. include "GlobalCrisis.CVP", "MAPS\"
  3. include "GlobalCrisis.REGIONINCL", "MAPS\"
  4. endifset
  1. ifset 0x02
  2. include "DEFAULT.UNIT", "MAPS\DATA\"
  3. include "DEFAULT.PPLX", "MAPS\DATA\"
  4. include "DEFAULT.TTRX", "MAPS\DATA\"
  5. include "DEFAULT.TERX", "MAPS\DATA\"
  6. include "DEFAULT.WMDATA", "MAPS\DATA\"
  7. include "DEFAULT.NEWSITEMS", "MAPS\DATA\"
  8. include "AllSourceLoad.INI", "INI\"
  9. endifset
  1. ifset 0x02

&&MAP mapfile "GlobalCrisis" &&END

  1. include "GlobalCrisis.OOF", "MAPS\"
  2. include "GlobalCrisis.OOB", "MAPS\ORBATS\"
  3. include "AllLoad.INI", "INI\"
  4. endifset
  1. ifset 0x04

&&SAV savfile "Global Crisis" &&END

  1. endifset
  1. include "A Land War in Asia.csv"
  2. include "LocalText-RegionsGC.csv", "SCENARIO\", Y
  3. include "A Land War in Asia-Text.csv", "SCENARIO\", Y

...

We can see from the last few lines that this is the "A Land War in Asia" scenario. It is based upon the "Global Crisis" Campaign. The "Global Crisis" cache file is specified in the line that reads:

savfile "Global Crisis"

Change this line to contain the name of your modded Campaign.

Save the .Scenario file under a new game name.

You can now play the Scenario by selecting your new game name from the SR2020 Single Player/Scenario screen. The new game should contain all of your modded units.

If you attempt to build a new cache file using this modified .Scenario file, then all of your modded Units will be deleted.


Any question or issues can be discussed at:

http://www.bgforums.com/forums/viewtopic.php?f=48&t=15465

More info on creating a new cache file can be found at:

Creating Cache Files

Retrieved from "http://www.supremewiki.com/index.php/Ruges_Guide_to_Adding_Units"
Personal tools