Tech Tree Editor

TheLopez

Deity
Joined
Jan 16, 2006
Messages
2,525
Location
Oregon
Tech Tree Editor
By: TheLopez

Last Update: 08/10/10

Version: v0.7.3BtS
Patch Compatibility: Beyond the Sword v3.19
MP Compatible: ?
Download Mod v0.7.3BtS

Version: v0.6.2w
Patch Compatibility: Warlords v2.13
MP Compatible: ?
Download Mod v0.6.2w

Version: v0.6.2
Patch Compatibility: v1.74
MP Compatible: ?
Download Mod v0.6.2

Description:
Civ4 is touted as one of the most modable games out there today. Though, at
minimum to mod Civ4 you need to know how to edit XML files at the worst you
need to know how to edit C++ and compile the SDK files. Unfortunately the game
was shipped without an editor, this mod is the first part of an in-game editor
that will change this.

Note, you should start with no modules loaded when using this editor.

-----Usage Instructions-----

See post 2-4 for usage information.


-----Version Information-----


-----v0.7.xBtS------

- Branched the Tech Tree Editor code from the Warlord version and ported all
XML, python and C++ files to BtS source.

- Added support for writing out the XML files for the new items containing tech
usage: Corporations, Espionage Missions, Events and Event Triggers

- Added support in Tech Tree Editor screen for the three new fields: Advanced
Start Cost, Advanced Start Cost Increase and River Trade

- Fixed several bugs in the SDK. I have left traceability in the SDK so the
issues can be reported back to Firaxis. These lines can be found by
searching for: "this is a bug in the SDK that should be reported."

- Fixed tech initialization issues that were causing the editor to crash when
trying to add more than one tech.

- Fixed a graphical issue in the tech editor that wouldn't display the add
button for adding prereq "Or" and "And" techs

Spoiler :

-----v0.6.x------

- Removed the apply button since it is no longer needed and since using it
would take a long time to respond.

- Added a close button in place of the apply button that hides the tech tree
editor window.

- Fixed the images for the prereq "OR" techs so they will show up like the
images for the prereq "AND" techs in the tech editor.

- Fixed the issue where a new tech with the name of a deleted tech could not
be added.

- Added the missing code to write out unit infos when a prereq tech for a
unit is deleted

-----v0.5------

- Fixed the code that displays the AND prereq tech images. They were being
"grayed out" when a new tech was added.

- Added the ability to remove techs from the game through the tech tree editor.
When a tech is removed through the tech tree editor all of the XML files
affected will now also be written out.

-----v0.4------

- Fixed the CvTechChooser screen so updates made to techs through the tech tree
editor are reflected immediately. Reported by Aussie_Lurker.

- Updated the arrow drawing code to use predictable names instead of the
getNextWidgetName method.

- Fixed the arrow drawing code to allow the redrawing of arrows when a tech is
moved.

- Added the SDK code necessary to dynamically add techs into the game. Updated
Tech Tree Editor screen to allow adding of techs dynamically.


-----v0.3------

- Added the tech image to the tech name bar in the tech editor as a button to
allow changing of the tech image. As long as the new path to the image is
within the assets directory or is a full path the tech editor will be able to
understand how to load the picture.

- Added the code to copy new tech images to the edited file directory.

- Fixed the issue where the "Technology Advisor" was not being updated after a
change to one or more techs was made in the "Tech Tree Editor". Reported by
Aussie_Lurker.

- Fixed the issue where "OR" tech prereq images were being greyed out when a
value in the "tech editor screen" was changed.

- Added a popup informing players when files are saved or not saved. Requested
by Jeckel.

-----v0.2------

- Integrated Dr Elmer Jiggle's event manager and INI parsing code.

- Added the configurable option allowing mod makers to change the location
where the resulting CIV4TechInfos.xml file will be saved. So if the default
value is left to "Test" then the CIV4TechInfos.xml file would be written in a
directory called "Test" inside of the Tech Tree Editor mod folder.

- Added the configurable option allowing mod makers to indicate if the assets
directory structure shouldn't be created at the directory specified by the
"Save Directory Location".

- Rewrote the entire tech editor since the tech editor pane caused the whole
editor to load up very slowly. As part of the rewrite most of the individual
components have been moved into a table.

- Add code to create the correct directory structure in the configured
directory. Also added the code to write out the technology info XML file.

-----v0.1------

- Setup the Tech Tree Editor infrastructure

- Updated the CvTechInfo class with "set" methods for all of the appropriate
variables that can be set in the CIV4TechInfos.xml. Exposed all of the new
"set" and several other "get" methods to the Python layer.

- Added an "edited" property to the CvInfoBase class to denote the different
info objects that have been edited.

- Added the isValidTechPrereq method to the CvTechInfo class that returns true
if a tech can be a prereq tech for a tech, false otherwise.


-----===Credits & Thanks===-----

- Exavier
--Composite Mod - readme.txt format

- Dr Elmer Jiggle
--For providing the INI file parser code allowing for players to
--customize this mod without having to touch the python code!!!

- Testers

--Jeckel, Aussie_Lurker, GraveEatr and Shqype
 
Chapters:
1 - Limitations and known issues
2 - The Basics
3 - Adding New Techs
4 - Editing Existing Techs
5 - Saving Techs
6 - Deleting Techs
7 - Editing Techs from existing mods



Chapter 1: Limitations and known issues

The released downloadable Tech Tree Editor only allows updating of the standard
values for Warlords or vanilla Civ4. If you want it to edit a custom tag
developed by a modder you will need to merge that mod with the Tech Tree Editor.
To do this you will need to merge the SDK and python files from the other mod
with the Tech Tree Editor SDK and python files.

Only technologies can be edited through the Tech Tree Editor mod. Techs can not
be added as prereq techs for buildings, units, etc. with this mod. This
functionality will be available in the Civilizeditor (Yes, the Tech Tree Editor
will be included in the Civilizeditor, no I don't know when it will be ready
:D).

There is only one known issue at this time. The issue is when you move a tech
around some times a horizontal line segment will not be removed. It doesn't
prevent the editor from working correctly but it is still a graphical issue
needing to be fixed.


Chapter 2: The Basics

Use the Tech Tree Editor you need to start a new game. Once the
game is started press the key combination ALT-F6 to bring up the Tech Tree
Editor screen as shown in figure 1.

Spoiler Figure 1 :




A: The pos: (1,1) indicates the position of the technology in the tech tree.
B: The "Save" button, use this to write out all of the affected files to disk.
C: The "Add New Tech" button, use this to add new techs to the game.
D: Click on a technology to bring up the tech editor window.
E: Technology image button. Click on the image used to represent the technology
in the tech editor to change it.
F: Technology name. Click on the name of the technology in the tech editor to
change it.
G: Minimize/Maximize buttons. Click on the minimize button to shrink the tech
editor to minimize the tech editor so it displays only the tech image, name,
maximize and delete buttons. The minimize (-) button is replaced with the
maximize (+) button when pressed.
H: Delete technology button. Click on the delete button to delete the
technology from the game. The technology is completely removed from the game
this includes instances where the technology is a prereq for game objects
like buildings, units, etc.
I: Close tech editor window. Click on the close button to close the tech
editor.
J: The exit button. Click it to exit out of the Tech Editor screen.

Figure 2 shows all of the values that can be set through the tech editor.

Spoiler Figure 2 :


 
Chapter 3: Adding new Techs

There are several steps to adding new techs via the tech editor.

1) Click on the "Add New Tech" button in the lower left-hand side of the tech
editor screen (the button is circled in red in figure 3) to bring up the "Add
New Tech" popup dialog as show in figure 4. In this case "Ceremonial Buriel"
as been entered into the dialog. (Yes, buriel is mis-spelled intentionally).

Spoiler Figures 3 and 4 :


(figure 3)


(figure 4)


2) After entering the name of the new tech press the "OK" button in the "Add
New Tech" popup dialog the new tech with the name entered will be added to the
tech tree in the (1,1) position. Additionally the new technology is
automatically selected. See figure 5.

Spoiler Figure 5 :


(figure 5)


3) Hovering over the name shows the associated tooltip, shown in figure 6. To
change the name of the technology (and to fix the mispelling from earlier)
click on the name of the technology in the tech editor window. See figure 7.

Spoiler Figures 6 and 7 :


(figure 6)


(figure 7)


4) Hovering over the tech image shows the associated tooltip, shown in figure
8. To change the image for the technology click on the image for the technology
in the tech editor window. By default technologies added through the tech tree
editor will have the "replace me" image. See figure 9.

Spoiler Figures 8 and 9 :


(figure 8)


(figure 9)


For the purpose of example the wrong name for the new technology is entered.
See figure 10. A ugly pink box is displayed when an invalid path is set for a
technology image. See figure 11. An invalid path can be a result of mistyping
in the name of the file or providing a path that the editor cannot reach. To
make things easier all artwork should be put inside of the tech tree editor's
assets/art folder. Any new artwork will automatically be copied into the
correct location when the save button is used.

Spoiler Figures 10 and 11 :


(figure 10)


(figure 11)


When the correct path to an image for a tech is used, see figure 12, the tech
image is automatically displayed, see figure 13.

Spoiler Figures 12 and 13 :


(figure 12)


(figure 13)


Next, the new technology should be moved to where it should be in the tech
tree. As previously stated, new technologies are placed in the (1,1) position
by default. See figure 14 (the position has been circled in red in both the
tech tree and editor).

Spoiler Figure 14 :


(figure 14)


To change the location of a technology you will need to select a tech and
press the up, down, left or right arrows in the tech editor. In this example
the newly added technology is moved to the (1,9) position. See figure 15.

Spoiler Figure 15 :


(figure 15)


The last part in adding a new technology is changing its values. We won't go
into the details of all the different values that can be changed. The following
chapter will go through the process of editing an existing tech including
adding new "OR" and "AND" tech prereqs.
 
Chapter 4: Edit Existing Tech

This chapter assumes that the tech added in chapter 3 is in the (1,9) position
in the tech tree.

In this chapter, the tech added in chapter 3 will be added as a "OR" and "AND"
prereq tech to existing techs. In the tech tree "OR" tech prereqs are shown as
lines from one tech to another tech and "AND" tech prereqs are shown as icons
in the upper-right hand corner of techs in the tech tree. (I know that this
last bit might be obvious to some but to others I might not be.)

1) Select the tech to add a tech as an "OR" prereq and scroll down in the tech
editor to the "Or Prereq Tech" section. Next click on the "Add Or Prereq Tech"
drop down list to select the tech that should be added as a "OR" prereq. See
figure 16.

Spoiler Figure 16 :


(figure 16)


NOTE: The contents for both the "OR" and "AND" prereq tech drop down lists is
constrained by several factors. These are used to prevent recursive prereq tech
associations that cause the game to crash.


2) To add the selected tech as a "OR" prereq click on the "Add" button next to
the "Add Or Prereq Tech" drop down list. When this is done the tech editor is
updated to include the new tech as a "OR" tech prereq for the selected tech and
a line is drawn from the "OR" prereq tech to the selected tech in the tech
tree. See figure 17.

Spoiler Figure 17 :


(figure 17)


NOTE: By default only 4 "OR" and "AND" prereq techs can be added to any one
tech. To change this the NUM_OR_TECH_PREREQS and NUM_AND_TECH_PREREQS entries
in the GlobalDefines.xml must be changed by editing the GlobalDefinesAlt.xml
file and changing their values there to the desired value.


3) Select the tech to add a tech as an "AND" prereq and scroll down in the tech
editor to the "And Prereq Tech" section. Next click on the "Add And Prereq
Tech" drop down list to select the tech that should be added as a "AND" prereq.
See figure 18.

Spoiler Figure 18 :


(figure 18)


4) To add the selected tech as an "AND" prereq click on the "Add" button next
to the "Add And Prereq Tech" drop down list. When this is done the tech editor
is updated to include the new tech as a "AND" tech prereq for the selected tech
and the icon for the new "AND" tech is displayed in the upper-right hand corner
of the selected tech. See figure 19.

Spoiler Figure 19 :


(figure 19)



Chapter 5: Saving Changes

This chapter assumes that the changes to the tech tree in chapters 3 and 4 have
been made.

Click on the "Save" button to save all changes made to the tech tree. The saved
XML file(s) will be placed in the directory with the name specified in the
"Save Directory Location" option found in the "Tech Tree Editor Config.ini"
file. If the "Create Asset Hierarchy" option in the
"Tech Tree Editor Config.ini" file is set to true then the complete asset
directory structure will be created as well.

XML files will be written out if their underlying objects (units, buildings,
etc.) have been affected by the changes made in the tech tree editor.


Chapter 6: Deleting Technologies

This chapter assumes that the changes to the tech tree in chapters 3 and 4 have
been made.

1) Select the tech to be deleted by clicking on it in the tech tree. Hovering
over the delete button (found in the upper-right hand corner of the tech
editor) for the tech shows the associated tooltip, see figure 20.

Spoiler Figure 20 :


(figure 20)


2) Press the delete button in the tech editor to delete the tech from the tech
tree. The tech is then removed from the tech tree and in the case shown in
figure 21. The areas circled in red show the parts of the tech tree affected by
the deletion of the tech.

Spoiler Figure 21 :


(figure 21)



Chapter 7: Editing Techs from existing mods

To edit the techs from an existing mod merge that mod's XML director and art
directories with the XML and art directories for the tech tree editor. The only
XML file changed by the tech tree editor mod is the CIV4ControlInfos.xml file.
The only files included in the art directory are: checked.dds, unchecked.dds
and ReplaceMe.dds.

The best way to edit the tech tree in an existing mod using the Tech Tree Editor is:

0) Make a backup of your mod.
1) Copy, not move, all of your XML files into the XML directory of the tech tree editor
2) Make the changes to the tech tree through the Tech Tree Editor
3) Save the tech tree
4) Copy all of the files from the save directory (by default it is set to Test) back into your mods asset directory. This step is very important since:
- Image files that you might have used in the tech tree will have been copied into the save directory
- A CIV4GameTextInfos_*.xml file (* is replaced by the save directory name) is generated that includes all of the names of the techs you used
- Modified versions of files like the CIV4UnitInfos.xml, CIV4BuildingInfos.xml, etc. are written out in the case that you remove techs that were prereq techs for buildings, units, etc.
 
Given that I was looking only yesterday at starting (simple) modding, and couldn't for the life of me get my head around how to amend the tech tree, this has arrived right on time!

Nice one - I guess I'll be downloading this now then...:D
 
Phew, this looks awesome! I didn't think that it was possible to create an ingame editor through modding - simply amazing :D
 
Just saw the announcement of this editor on the main civfanatics page. It looks like great work and will make editing civ4 a lot more accessible to the starting modder.
 
This is fantastic work, TheLopez. Your efforts will ensure that civ fans who have been somewhat timid to approach modding for Civ4 due to the lack of a good editor interface, will now take up the charge.

Furthermore, I hope CivFanatics promotes this package as a staple component for all new modders.
 
strategyonly said:
OK i started my MOD, i pressed ALTF6, i get nothing?

Check if you have "chipotle" in your Civ ini file as the cheat code. I'm pretty sure it has to be there to enable ALT-*** commands.
 
TL:

This is fantastic work! But I have a question. Is there any way to lock the editor out so people can't cheat with it? Similar to a host locking a save file stops the worldbuilder from functioning. If not, then that throws the validity of all GOTM/WOTM or any MP game out the window (though an MP game would just OOS). Just a concern. :)

Otherwise, keep up the great work! :) Hope the little one's doing well.

Dale
 
FYI, expect an update in about 6 hours, I just noticed that there is some code missing for Unit Infos.
 
strategyonly - Are you actually starting a game and then pressing ALT-F6?

Dale - The editor should be used more as a stand-along app than a mod...
 
TheLopez said:
strategyonly - Are you actually starting a game and then pressing ALT-F6?

Dale - The editor should be used more as a stand-along app than a mod...


Yeppers, i have the game completely started, the f6 works, but not the ALTF6?
 
Top Bottom