Creating Tech Trees
From OPU Wiki
Here I'll post a little information on how to create or modify tech trees for OP2.
I will assume that you know how to unpack vol files with the map editor or other VOL extraction tools.
| Table of contents |
Where Techtrees are Stored
In sheets.vol in your game folder there are some tech tree files, which have the following names and purposes. MULTITEK.TXT - Multiplayer / colony game tech tree EDENTEK.TXT - Eden campaign tech tree PLY_TEK.TXT - Plymouth campaign tech tree TUTORTEK.TXT - Tutorial tech tree
In v1.3.3, a BASICTEK.TXT was added, this is basically MULTITEK.TXT with the basic lab added, like in single player games, where you must research everything at the basic lab in order to allow building of a standard lab.
These files contain all the research data and definitions for the tech trees in those types of games. The other files in the sheets, you probably won't need them for now. (Though they are valuable references for writing techtrees from scratch).
To start off, extract the contents of the sheets.vol. Look at the directory that was created by the reVOLver. Start up your text editor and load MULTITEK.TXT. You'll see a lot of text for the researches. (If all you see is scrambled binary data, you need to update your game! The text files have been uncompressed plaintext since v1.3.1)
Basics
Now I'll explain the basic syntax of the tech file. A comment (line that isn't processed by the game) starts with a semicolon like so (just like in .INI files):
; This is a comment. Nothing on this line will be processed by the game
Other parts of the file work on a keyword, data syntax. For example:
KEYWORD_NAME "data" ; you can have comments like this too - anything after the ; is ignored
You can use as much whitespace as you want (spaces and tabs) between a keyword and the data that follows. However a keyword and its associated data item must be on the same line. (You can have extra newlines between different lines, however).
After a keyword, all text string data must go inside quotes. Numeric values should not be inside quotes, if you forget to do this the game will fail with an "Outpost 2 Parsing Error" dialog (or possibly worse, the game might not even load / crash).
Now to explain the actual keywords themselves. The first line with a keyword you should see after a few lines of comments is this:
BEGIN_TECH "Cybernetic Teleoperation" 03401
This is the BEGIN_TECH keyword. All the information regarding a particular technology (one topic in the research window) is between a BEGIN_TECH and an END_TECH keyword. The syntax is like this:
BEGIN_TECH "TechName" TechNumber
The text name, as it appears in the research list, is the TechName. The TechNumber is the 5 digit technology ID. A note on tech IDs: The first 2 digits correspond to the tech level of the research. In a normal colony/multiplayer game the starting tech level is 3, so all techs that begin with 03 or lower are already researched. The starting tech level is set thru the DLLs. In campaigns the starting techlevel is 01 and increases as you move through missions. (There may be exceptions, as the tech level is set by the DLL at startup using Player.SetTechLevel and doesn't have to follow these rules). Each tech must have its own unique tech ID.
While we discuss tech ID's, have a look at BUILDING.TXT (also in sheets.vol). It's a tab delimited list which describes default values for the structures in the game. The first line of the file describes each field, then followed by each entry for each structure, one per line. You may wish to open the file in a spreadsheet program as a Tab Delimited Values file, to make the structure easier to read. Look at the "Topic" field. This is the tech ID that activates this particular structure. (In other words, when this tech ID is researched to completion, the structure linked to it becomes available to the player). Use VEHICLES.TXT, WEAPONS.TXT, and SPACE.TXT to find out the ID's for vehicles, weapons, and spaceport items. (You shouldn't change the contents of these files, because it will make your game incompatible with other players. There is a way to set most of these settings thru tech tree files, which I'll explain later.)
Now I'll explain each of the lines inside the BEGIN_TECH and END_TECH block. (Notice how they are all indented a few spaces - this is a good practice to make the file more readable.)
CATEGORY 4
This tells the game what category the research falls into. Basically, it specifies the icon to use during research (for example, the bucket icon is used for research that affects mining, the people icon for things that affect colonists and morale, etc) Category #0 is an exception, this will be explained later.
These are the category ID's and their corresponding pictures/meanings:
0 = Free/disabled technologies *No picture*
1 = Basic laboratory sciences
2 = Defenses (GP upgrade, walls, and efficiency engineering)
3 = Power
4 = Vehicles (which ones can be built, speed upgrades, armour upgrades)
5 = Food
6 = Metals gathering
7 = Weapons
8 = Space (spaceport, observatory, launch vehicle, skydock)
9 = Population (happiness)
10 = Disaster warning (and defense)
11 = Population (health, growth)
12 = Starship module
(Thanks to Hooman for this list)
DESCRIPTION "..." ; It's a long line of text. TEASER "..."
These are the text descriptions that appear when you do the research. The DESCRIPTION is the text that appears after the research is done (when you look in the labs report panel, under Completed research), the TEASER is the one most people will see in the display when you actually go to research at the lab. (On the screen where you assign # of scientists to research) This must go inside quotes, as does all other text, on one line.
EDEN_COST 800 PLYMOUTH_COST 1000
These are the number of points that the research is worth for each race (Eden and Plymouth). For example, when this research is in progress for Eden, the lab will display a number x/800 with the research, and as the research progresses, x increases. You can set them separately like they are, but if you want it to cost the same for both races, you can replace the EDEN_COST and PLYMOUTH_COST lines with a single COST line like so:
COST 800 ; It now costs 800 for either Eden or Plymouth
There are some special cases you can enter to cause certain things to happen in the game. If you enter 0 for a cost, that research is immediately available at the beginning of the game. (This can be useful in creating 'filler' topics just to enable a certain unit or structure.) The research does not appear in the completed list, but it still takes effect. If you enter -1 for a cost, that research is disabled and cannot be researched at all (however a mission DLL can still activate it with Player.MarkResearchComplete).
MAX_SCIENTISTS 10
This one is pretty self explanatory; it sets the maximum number of scientists that can be used to research a topic.
LAB 2
This specifies the type of lab that the research is available at. 1 = basic lab, 2 = standard, 3 = advanced. These are the basic keywords for a research that does nothing extra (either activates/disables a type of game object, or is a simple predecessor research (ex. you need to complete this one to get a different research), in other words, it doesn't change any unit properties.
Improvement Descriptions, Unit Properties and Predecessors
Now, I will explain how to make your research actually "improve" units, and how to make research that requires other research to be available (predecessors).
Scroll down a few screens in MULTITEK.TXT to:
BEGIN_TECH "Advanced Vehicle Power Plant" 03901
This is an example of a research that changes how a unit, structure, or weapon works. Here's how it works:
IMPROVE_DESC "Increased speed"
The IMPROVE_DESC line simply adds a line to the text that will be shown in the panel with the unit control icons below the picture of the unit when it is selected. There is room for four lines of this text. In the case of a weapon, any chassis with the weapon on it will also get this text.
REQUIRES 03402
This line simply tells the game what research ID is required for this research topic to be available. You may have as many REQUIRES lines as you want.
The next line is what actually causes the research to change properties about a unit, structure, or weapon.
UNIT_PROP BIG_TRUCK Move_Speed 3
First, I'll dissect the line piece by piece. The first part, the keyword UNIT_PROP, tells the game that we are changing a property of a unit.
The second part, BIG_TRUCK, is the internal unit code name. BIG_TRUCK is the code name for a cargo truck. You can see all the code names of units in building.txt, vehicles.txt, weapons.txt, and space.txt files. Some of the code names don't quite match up with the unit names (for example, the code name "ASE" refers to the MHD Generator, because it was known as an "ASE Converter" in early versions of the game).
The third part, Move_Speed, tells the game what unit property to modify.
The valid unit properties are:
Property | Description
|
| Hit_Points | Sets the hit points of the unit. |
| Armor | Sets the armor value of the unit. 0 = none, 1 = light ... 3 = heavy, 4 = very-heavy, 5 = adamantium (yes, very-heavy and adamantium do exist, they were never used in game though) |
| Production_Capacity | This deals with the amount of service/product that a building/vehicle can offer. It will increase the capacity of residences and medical centers, it will increase a DIRT's protection grade, in a Agridome it increases the base amount of food it produces, while in vehicles it will increase the capacity of whatever it is it holds (Cargo Trucks and Ore, for example). |
| Move_Speed | Sets the speed of motion for a vehicle. A higher number means a slower speed. |
| Sight_Range | Range of sight, in tiles, that the unit can see. |
| Rate_of_Fire | Reload time, in ticks, for a weapon to cycle before it can fire. (100 ticks = 1 mark) |
| Build_Time | Amount of time to produce this unit. This value is recalculated for different game modes and factory production rates (for example, the value is much less in a multiplayer game than it is in single player) and as such is approximate. |
| Power_Required | Amount of power required to operate this structure. |
| Storage_Capacity | Amount of ore storage that this unit can hold (for example, a storage tank or smelter) |
| Storage_Bays | Number of storage bays in a factory. It's unknown how the game will react if this property is changed. Try at your own risk! |
| Production_Rate | Speed of production for a factory. (Efficiency Engineering decreases this value) |
| Concussion_Damage | Amount of a weapon's concussion damage. |
| Penetration_Damage | Amount of a weapon's penetration damage. |
| Improved | Can only be in a 1 or 0 value; used with mines, smelters, the GORF, and the observatory to denote "Improved" status. (Improved ore yield in the case of the mining structures, and improved meteor tracking in the case of the observatory). |
| Workers_Required | Number of workers required to run this structure. |
| Common_Required | Amount of common ore needed to produce this unit. |
| Rare_Required | Amount of rare ore needed to produce this unit. |
| Turn_Rate | Speed at which the unit turns. (Lower value = slower) |
| Ore | Unknown |
| Test_Function | Unknown |
| Build_Points | Unknown |
Finally, the last part, 3, tells the game the new value of the property after completing the research. (This is not added to the original value, this is the NEW value of the property. In other words, if the initial value is 3, and you enter 3 for the new value, the value remains 3).
You can have multiple UNIT_PROP lines to modify different settings or units.
You can view all the initial settings for these values in the text files.
Free and Disabled Technologies
To create a free technology (one that is available without further research to "enable" it), use a definition with a CATEGORY of 0 and a COST of 0. For example, the game uses this in MULTITEK.TXT to enable the command center (a vital structure) at the start of the game:
BEGIN_TECH "Command Center" 02103
CATEGORY 0
COST 0
END_TECH
To disable a technology, do the same as above, but use a COST of -1. The research will not be available. (However, it can still be set as researched through the use of Player.MarkResearchComplete in the DLL). Note that the textual name in the BEGIN_TECH line is disregarded for a disabled research (the game uses "NOT AVAILABLE", however it may be nice to enter the proper name of what is being disabled in case you wish to find it and change it later).
You can also use free technologies in conjunction with REQUIRES lines. This is how structures like the robot command center and the vehicle factory are activated by researching Cybernetic Teleoperation, they specify that Cybernetic Teleoperation (ID 03401) is required. You can also use EDEN_COST and PLYMOUTH_COST lines to disable or make free different technologies (for example, Legged Robots specifies an EDEN_COST of -1 to prevent Eden from building Arachnid Factories)
Some Other Considerations
- Although there are EDEN_COST and PLYMOUTH_COST keywords to change the research cost for different races, there are no similar EDEN_ and PLYMOUTH_ variants for other keywords like REQUIRES, LAB, or MAX_SCIENTISTS.
However, this behavior can be simulated by creating two different techs, with the same name, but different tech IDs. Assign different values to each technology for the different races. (This is how the game handles Heat Dissipation Systems - Plymouth can do it relatively early, after researching Mobile Weapons Platform, but Eden must wait until much later to research it). Caveat: this will not work if the research is used to enable a unit (that is, the research ID is the same as the expected research ID, defined in the text file for the unit). In this scenario only the race that can do the research with the 'correct' tech ID will be able to get the unit. You may be able to get around this limitation by using a free technology for the unit, with REQUIRES lines for the 'unlocking' research. I have not tested this idea however.
- It is possible to use UNIT_PROP lines to decrease values of units unrelated to the research (for example, Rare Ore Processing causes Robo-Miners to cost more). In other words you could cause one research to have a 'negative' effect on a different structure (take for example a research that increases weapon damage but at the cost of reducing colonist capacity in the Residences, or something similar).
Note: If you specify IMPROVE_DESC lines, the units which you 'negatively' affect will also get this line (in the preceding example, the Residence might say "Increased damage" which would look obviously goofy to the user when clicking on a Residence). You might be able to work around this by creating a free research with a REQUIRES line for the 'main' research which does nothing more than assign the property and a different IMPROVE_DESC to the residence.
- Some unit properties only apply to certain types of units. For example, Move_Speed is irrelevant to a structure. It is undefined what will happen if you change these 'irrelevant' values. (It may cause odd behavior or a game crash).
- There are two other keywords that OP2 supports in the techtree. These are PLAYER_PROP and FUNCTION_RESULT. If you have any information on how to use these, let us know! (The game does not use these anywhere)
- Wreckage can be assigned a research, as it is in some Land Rush games with the Tiger Speed Modification. By default, when you assign a tech ID, the game marks it as complete when wreckage is returned to base, regardless of the COST or other values for the tech.
However, it is possible to create a tech that can be researched after returning the wreckage, by first creating a 'dummy' disabled tech and giving its tech ID to the TethysGame::CreateWreck call in the DLL. Then, create your 'real' tech which is to be researched with a REQUIRES line for the dummy tech. As the dummy tech will be marked complete automatically, the 'real' tech will show up in the list (as the REQUIRES line has been satisfied) and can be researched. See BASICTEK.TXT, near the end where the Tiger Speed Modification is, to see a working example of how this is done.
- When you specify tech ID's in the DLL to Player.MarkResearchComplete, always omit the leading zeros in the tech ID. Although these zeros are required in the techtree, if entered in the code, C++ will interpret the ID as an octal number (which is not what you want).
Have fun creating your custom techtrees!
