Editing Civ2 ToT technology tree

civ2units

Emperor
Joined
Feb 1, 2009
Messages
1,088
Location
Somewhere in nowhere
Unfortunatelly I didn´t find anything here about easy editing the technology tree in Civ2 ToT.

How do you guys editing the technology tree? I´m currently creating two small technology trees for my AWI and ACW scenario and it´s very time consuming and has also many bugs.

Are there any usefull tools?
 
Joined
Feb 11, 2012
Messages
831
Hi civ2units,

I'm not aware of any specific tools for editing the tech tree in ToT. For my part, I typically start by creating a tree in excel.

You can find a sample tech tree for my "A House Divided" scenario in the 'CIV II REFERENCES.zip' found in the following thread (look for the 'Tech Tree_A House Divided.xlsx' file in the A House Divided Excel Files folder).

Once I have my excel tech tree in place, I find it becomes very easy to modify the @Civilize section of the rules.txt file just using NotePad. Just follow the paths in your tree to update the various perequisite for each advance. Thereafter the excel file becomes your reference point and it makes it very simple to update or modify your tree whenever you need to make adjustments.

Depending on the complexity of your tree it can require some work up front but it makes things much easier in the long run. At least that's been my personal experience.

I hope this helps.
 
Last edited:

gapetit

King
Joined
Mar 25, 2010
Messages
682
The best thing is that what CS indicates, if you can draw it, creating the different technological paths, the better. The restriction (no, no,) does not work in ToT so it is better to apply the technique that Catfish explains:
http://users.tpg.com.au/jpwbeest/jp_techs.htm
This allows a particular technology to be used only by the civilizations you choose.
And finally drag the rules to the civ2tech to check that everything is working properly. Luck
 

Attachments

  • civ2tech.zip
    603 KB · Views: 135

gapetit

King
Joined
Mar 25, 2010
Messages
682
I took so long to reply in the previous letter that I had not seen Tootall's reply. I think both Curt and Tootall are great specialists in generating complex technological structures. Thank you for the contribution Tootall.
 
Joined
Feb 11, 2012
Messages
831
Just a quick follow up. When it comes to debugging your @Civilize section of your rules.txt file there is no easy solution but here are a few pointers that have helped me debug a file that crashes. For starters:
  • The 3 letter codes of each advance are case sensitive, so make sure to follow the standards (example: ‘Code of Law = CoL)
  • Make certain there are no missing commas in any of your tech lines
    • Chemistry, 5,-1, Uni, Med, 1, 3 ; Che
  • Make certain there are no missing technologies, there should be 100 (numbered 0 to 99). I typically always number each tech at the end of each line for easy reference. Example:
@Civilize
Advanced Flight, 4,-2, Rad, Too, 3, 4 ; AFl 0
Alphabet, 5, 1, nil, nil, 0, 3 ; Alp 1
Amphibious Warfare, 3,-2, Nav, Tac, 3, 0 ; Amp 2
Astronomy, 4, 1, Mys, Mat, 1, 3 ; Ast 3
Atomic Theory, 4,-1, ToG, Phy, 2, 3 ; Ato 4
Automobile, 6,-1, Cmb, Stl, 3, 4 ; Aut 5
etc​
  • Make certain ALL civilizations can research the ‘Future Technology’ advance, otherwise if they reach a point where they have researched all their available technologies and have no others to choose from it can cause the game to crash
    • Future Technology, 1, 0, FP, Rec, 3, 3 ; ...
Usually when you’ve made a change to the rules files, which then causes the game to crash when you try to load the scenario it’s because there is an error in the @Civilize section. When you can’t easily find the problem I’ve often used the following technique to debug the file:
  • Make a separate copy of your modified rules.txt with a different name and keep it to the side as a backup
  • Then copy the entire @Civilize section from the base rules.txt file, found in the root directory of your game, and copy it over your own @Civilize rules.txt file section
  • Reload the game to confirm the game isn’t crashing. If it doesn’t it means the problem is indeed with the technology section
  • Then copy, say, the first ten or twenty tech lines from your backup rules file over the first ten or twenty lines of your current rules.txt file
  • Try to load the game again, if it doesn’t crash, then it means those first tech are correct (at least in terms of the coding)
  • Keep adding the subsequent tech lines until the loading causes the game to crash
  • In this way you can narrow down which tech line or lines are causing the crash and apply the necessary fix.
If the error isn't in the Civilize section, it could be a problem with wrong codes in your unit section.

It's really a question of detective work.
 
Last edited:

Prof. Garfield

Deity
Supporter
Joined
Mar 6, 2004
Messages
3,974
Location
Ontario
Here's something I threw together that might be useful. It will let you modify the tech tree using the Lua console.

Usage instructions: Extract these two files into the lua folder of your test of time installation. Load an instance of the scenario you wish to modify, open the lua console, press the load script button, and select techTree.lua (the default folder should be the lua folder in your TOT directory, where we extracted this to). This will give you access to a couple functions

Code:
printTechRules()
This command will print the entire CIVILIZE rules for the current scenario to the console. If you've made any changes to technologies in the console, they will be reflected in the new ruleset. Most LUA changes to stuff found in the rules.txt don't 'stick' after a re-load, including all changes to the tech tree, so this command prints new rules that you can cut and paste over the current ones. However, while the game is still open, you can see the modifications, for example in the civlopedia.

Code:
selectTech()
This will open a menu to choose a technology. Use in place of civ.getTech(id), if you don't know the id off the top of your head.

Code:
setPrerequisites()
Let's you change the prerequisites of a technology by using three menus instead of writing the lines of code.

You can make other changes by typing code into the Lua console. For example, the line

Code:
civ.getTech(0).aiValue = 3

Changes the aiValue of technology 0. If you wanted to select the technology from a menu, you would write

Code:
selectTech().aiValue = 3

and a menu would appear to let you select the technology. Unfortunately, due to a limitation of TOTPP, you can't change the name of the technology in the console. See the Lua Function Reference for the changes that can be made.

Limitations:
1. You can't change tech names, unfortunately.
2. TOTPP Lua can't distinguish between nil and no prerequisites, so all no prereqs are changed to nil when printing out the new rules.
3. This has had almost no testing, so you might find bugs.

If this is useful, I might do some more work on it.
 

Attachments

  • techTree.zip
    10.9 KB · Views: 136

civ2units

Emperor
Joined
Feb 1, 2009
Messages
1,088
Location
Somewhere in nowhere
Thanks for the LUA script editing the techtree, Prof. Garfield :thumbsup:
Please apologize my late reply. I will test it, looking how good it will work with my very small scripting skills.:)
 

civ2units

Emperor
Joined
Feb 1, 2009
Messages
1,088
Location
Somewhere in nowhere
I´ve found a little programm called yEd on another civ forum, which some members use for editing their tech tree. It's easy to use and allows to create diagrams, changing colours and much more.
And best of all, it's free for use.
https://www.yworks.com/products/yed

I´ve created a little tech tree for the Native Tribes in my scenario with the programm. It´s just a first test, I will try to check out what´s possible too with this programm.
Tribal_Techtree_Example.PNG
 

Pablostuka

King
Joined
Mar 27, 2002
Messages
803
Location
Galway, IRL
Hi all, has anybody experienced the following ToT tech related issue?

1) I use the "Edit Technologies" Ctrl+Shift+F6 cheat menu to clear all technologies of a tribe, so I can pick one by one the starting technologies for each. On my case I want my tribe to have only 3 starting techs (which get marked with an *):

2022-02-12 04_09_02-.png


To double-check, I see the "Science Advisor" screen and the three techs I wanted are the ones they have. This looks good:

2022-02-12 04_11_27-Civilization II_ Test of Time.png


2) I save the game as scenario.

3) When I start the scenario again, that tribe has random techs that I didn't select assigned already.

2022-02-12 04_13_02-Civilization II_ Test of Time.png


Is my game corrupted? Is there any fix other than by via events on startup to set the techs correctly? Please note I am not using any specific config in @CIVILIZE2 and @LEADERS2 (not for now).

Thanks,

Pablo
 

Dadais

King
Joined
Oct 20, 2010
Messages
761
Location
France
Could it be the situation of a civ' with strong science output and a very small Tech paradigm ?
 

Pablostuka

King
Joined
Mar 27, 2002
Messages
803
Location
Galway, IRL
You must save the file as a SCN file and then reload a new save from that to "lock" in the changes. Same goes for re-naming civ leaders, etc in the other menus.

Hi, what do you mean by that? I use the cheat menu to "save as a scenario", I overwrite my .scn file, and then exit, then "start a single player game" and "begin a scenario" selecting the same tribe. That's how it was done in MGE. Am I doing something wrong?

Could it be the situation of a civ' with strong science output and a very small Tech paradigm ?

The government is Monarchy, and the tech paradigm is 20, nothing too odd IMHO, science advances are set up to be reached every turn or every 2 turns, depends on adjustments:

20 ; Tech paradigm (higher # slows research)

What do you think?

Thanks both for your replies :)
 
Joined
Feb 11, 2012
Messages
831
HiPablo,

Unless I<m missing something, it's difficult to know what may have happened without having seen the step you took to create your scn file or having access to the files themselves, but on the other hand, once you reload your saved scn file can't you go back into the Cheat menu and simply remove the unwanted technologies through the Edit Technologies menu?

upload_2022-2-12_10-24-51.png


I frequently use this method during the design process to make adjustments to the technologies the different powers should have at the start of the scenario. Once you've made the change you merely do a "Save As Scenario" again to resave a new version of your scn file.

I hope this helps.
 

Pablostuka

King
Joined
Mar 27, 2002
Messages
803
Location
Galway, IRL
Hi @tootall_2012 that's exactly what I do. It's a loop. I edit technologies, save my scenario, begin it and the techs are messed up again for the active tribe (other tribes are fine), edit them, save again, and same problem all over again.

I'll need to learn hex-editing I'm afraid...

My .scn file is a ToT port from an original MGE file. Maybe that's why it's not really working as expected, as I redid major changes to the rules.txt file in terms of techs, units, etc. It's all different now from the original.

At some point if I continue having these issues I'll need to start from scratch, but I wanted to save me the pain of editing the map again (as I have new terrain types), tribes, city placement, roads, units, etc!!

Thanks for your help anyway
 

Dadais

King
Joined
Oct 20, 2010
Messages
761
Location
France
What capt my attention is the "Reinforcement in 1 turn", which would indicate the tech are simply searched in the "scenario" turn spent when we're saving one (following my maybe wrong comprehension).
Tech Paradigm 20 only divide per two the time spent to search techs, which is not that much when few techs are distributed.

Have you tried something like that with Lua (in the civ.scen.onKeyPress function) to check in your save game science costs and then compare with science output, as to adapt tech paradigm ?
Spoiler test code :
if keyCode == 49 then -- lowercase "1" (49) --test

for i=0, 7, 1 do
print (civ.getTribe(id).name .." tech cost : " civ.getTribe(id).researchCost )
end
end


The government is Monarchy, and the tech paradigm is 20, nothing too odd IMHO, science advances are set up to be reached every turn or every 2 turns, depends on adjustments:

20 ; Tech paradigm (higher # slows research)

What do you think?
To notice, when the game says "NewTech every 1 turn", it does only mean "the next tech will be reached in one turn", allowing to have multiple tech per turn if tech paradigm is low and science output high.

You may have a check at your tech paradigm validity by changing it in the rules section.
This will be overwritted by the .scen tech paradigm, yet will allow you to adjust it on your savegame before saving the scenario.
 
Last edited:
Top Bottom