Apparently I am terrible with Tech Trees. I need help!

Gzalzi

Chieftain
Joined
Mar 20, 2011
Messages
10
Location
Tennessee
For the last two days I've been reorganizing the tech tree for my mod, and I simply cannot get it to work no matter what I do. The rest of the parts of my mod work fine, but the tech tree is just doing nothing. I've not been able to find a tutorial or anything specifically about doing a tech tree other than the two threads about making them exclusive to civs and making them unresearchable from the Modding Tutorial's forum.

I was able to get the Prereqs for the techs working (incomplete) but I am not able to move any of the tech locations around or add any new techs. I have been working on just this tech tree for several days and I've pretty much ruled out everything I can think of.

  • Tried to build it manually myself. I've had all the OnModActivate and UpdateDatabase right, I've got the XML right this whole time (as far as I know).
  • I tried building a TechTree in the WYSIWYG editor and that didn't work.

  • I didn't know what to do at this point, so I decided to do a test with another mod. I downloaded "Better Technology Tree (v7)" and tried to run that in the game. Worked fine.

  • I copied the first part of his mod and made an SQL file of it with the values I wanted. Nothing.

  • At first I thought my tech tree might have been too long, so I shortened it and made sure it is within the parameters of the vanilla tech tree. Didn't work.

  • Decided I'd try something a little different this time...so I completely copy/pasted the Better Tech Trees mod to another SQL file, put it in it's own mod, made sure I did OnModActivate/UpdateDatabase/location, built the mod and tried to run it. It looked exactly identical to what is packaged in the Better Tech Tree mod, even the .modinfo file did, except for the ModID and my name. It still did not work.

I don't know what I'm doing wrong, but the Tech Tree just will not change for me. It is probably something really basic and stupid but I have literally spent all day working on the code (and yesterday, and part of the day before) and it still has done nothing.

Oh, and the Defines.xml also seems to not work. Don't know what's up with that (I think I put the wrong tags for it, but I haven't done anything with it since I've been preoccupied with the tech).



I'm attaching the mod here so anyone can take a look at it (Play as Rome [SPQR] on 'Realistic' gamespeed if you want to see the other minor changes I've made). It is very much a work in progress and very new. I plan to release it once I get the Tech Tree done but that's more so people can suggest ideas about what kind of units would be good to add and what needs rebalancing, but I plan to add much more to it (some new units, some more new techs if I can).

The included file Tech.xml which isn't added to the .modinfo file is the attempt from the WYSIWYG editor that I based my newer files off of after my first try didn't work. I overwrote my first try and the SQL version I did so I could not include them, and because of that, the tech files were the ones based off the autogen and were too big for the tech tree (or so I thought).

Also, why would the SQL file not work if I copy/pasted it and it was the same? I'm sure it is me forgetting some stupid little detail, but I've not been able to figure out what. There are no other files in the Better Tech Tree mod other than the .modinfo.

TL;DR:Please someone tell me how the hell to format a Tech tree.

If somehow anyone gets it to work, feel free to give suggestions. The Tech Tree is kind of wild right now (things are a bit spread out) but anything helps.
 

Attachments

Just from a quick glance through:

1> In your Tech.xml file you commented out the <GameData> block reference at the start of the file. It won't work without that. At all. (This is the one that's probably breaking it.)

2> In your TechPrereq.xml table, you're doing it all wrong. Take the following block as an example:
Code:
<Update>
  <Where TechType="TECH_SCIENTIFIC_THEORY" /> 
  <Set PrereqTech="TECH_PRINTING_PRESS" /> 
  </Update>
<Update>
  <Where TechType="TECH_SCIENTIFIC_THEORY" /> 
  <Set PrereqTech="TECH_ASTRONOMY" /> 
  </Update>
So it does these in order. First, it takes all Prereq entries for Scientific Theory (which'd be Economics, Navigation, and Acoustics) and replaces all three of them with Printing Press. So now, Scientific Theory would require Printing Press, Printing Press, and Printing Press. (And yes, there'd be three icons in the civilopedia.)
Then, it takes all Prereq entries for Scientific Theory (the ones you just set to Printing Press) and sets them to Astronomy.
So you need to delete the existing prereq entries and add new ones, or else use more explicit Where commands on your Updates.

3> In your Builds.xml file:
Code:
<Update>
  <Set PrereqTech="" /> 
  <Where Type="BUILD_REMOVE_JUNGLE" /> 
</Update>

Setting something to "" doesn't always work. You should set it explicitly back to the default NULL value, or set it to something like Agriculture that everyone starts with.
 
Just from a quick glance through:

1> In your Tech.xml file you commented out the <GameData> block reference at the start of the file. It won't work without that. At all. (This is the one that's probably breaking it.)
I wasn't actually using that commented out, I was just including it for reference to show what the WYSIWYG Indistone editor generated (I commented it out, because I was going to add a new bit at the end, but I just decided to leave it that way and remove the OnModActivate, sorry if I wasn't clear).
See here:
The included file Tech.xml which isn't added to the .modinfo file is the attempt from the WYSIWYG editor that I based my newer files off of after my first try didn't work. I overwrote my first try and the SQL version I did so I could not include them, and because of that, the tech files were the ones based off the autogen and were too big for the tech tree (or so I thought).
I really just need an example of how to do the XML to change the arrangement of the techs on a tree, because the one in the Tech.xml didn't work (it was not commented out when I tried).

Edit: Just tried again. Still didn't work.
2> In your TechPrereq.xml table, you're doing it all wrong. Take the following block as an example:
Code:
<Update>
  <Where TechType="TECH_SCIENTIFIC_THEORY" /> 
  <Set PrereqTech="TECH_PRINTING_PRESS" /> 
  </Update>
<Update>
  <Where TechType="TECH_SCIENTIFIC_THEORY" /> 
  <Set PrereqTech="TECH_ASTRONOMY" /> 
  </Update>
So it does these in order. First, it takes all Prereq entries for Scientific Theory (which'd be Economics, Navigation, and Acoustics) and replaces all three of them with Printing Press. So now, Scientific Theory would require Printing Press, Printing Press, and Printing Press. (And yes, there'd be three icons in the civilopedia.)
Then, it takes all Prereq entries for Scientific Theory (the ones you just set to Printing Press) and sets them to Astronomy.
So you need to delete the existing prereq entries and add new ones, or else use more explicit Where commands on your Updates.
Alright, I think I see what you're saying here, but would that affect the layout of the actual tree other than just the prereq lines?

3> In your Builds.xml file:
Code:
<Update>
  <Set PrereqTech="" /> 
  <Where Type="BUILD_REMOVE_JUNGLE" /> 
</Update>

Setting something to "" doesn't always work. You should set it explicitly back to the default NULL value, or set it to something like Agriculture that everyone starts with.

Alright, I'll do this.
 
I wasn't actually using that commented out

Regardless of what YOU are using, the version you attached can't even be opened in a lot of XML editors because of this. I had to use Notepad to read it.

Alright, I think I see what you're saying here, but would that affect the layout of the actual tree other than just the prereq lines?

Yes. I wasn't talking about some minor graphical glitch, the techs will ACTUALLY require only the last one listed if you code it that way; they'll require it two or three times, which won't affect anything.
 
Regardless of what YOU are using, the version you attached can't even be opened in a lot of XML editors because of this. I had to use Notepad to read it.
Didn't know that would happen.:confused: I use Notepad++ to to edit the XML when I am not using ModBuddy and I've never had any trouble opening anything(XML, Lua, SQL, and other stuff) with it..



Yes. I wasn't talking about some minor graphical glitch, the techs will ACTUALLY require only the last one listed if you code it that way; they'll require it two or three times, which won't affect anything.
I know. I got what you were talking about. I was saying that I didn't think the Prereqs wouldn't affect how the tree is organized (GridX GridY).

I spent all morning looking at my code and messing with it, and then just decided I'd go in Indistone's WYSIWYG editor and build a whole new one. Worked when I used the raw files, but I have to make some changes to get the requirements I want. At least I know I can just revert to using the pre-generated indiestone one if I mess it up.

I feel bad using the indiestone thing though, because it is like I'm not actually making anything.
 
I know. I got what you were talking about. I was saying that I didn't think the Prereqs wouldn't affect how the tree is organized (GridX GridY).

They don't, normally. But if an XML file hits something it can't handle, then the whole file often fails, not just the one bad line. So if, say, you'd misspelled one of the tech names... for instance, in the Modern Era, "Plastics" is internally TECH_PLASTIC (no plural) and "Penicillin" is TECH_PENICILIN (one L), so it's easy to break something this way.

Also, there are some fairly rigid rules on prerequisites in general, and I'm not just talking about the 4-tech limit. If a tech requires two techs that have differing GridX values, then one of the two MUST have the same GridY as the final tech, or else it'll draw the pipes wrong. There are a lot of little things like this; some just make the tree look ugly, some break it outright.

I feel bad using the indiestone thing though, because it is like I'm not actually making anything.

I've never used his editor. My own mod added 48 techs (three Eras plus a little extra), and I did it all by hand (after planning the whole thing out on paper, of course). Worked just fine, although it took a few rounds of tweaking to make it look pretty.
 
They don't, normally. But if an XML file hits something it can't handle, then the whole file often fails, not just the one bad line. So if, say, you'd misspelled one of the tech names... for instance, in the Modern Era, "Plastics" is internally TECH_PLASTIC (no plural) and "Penicillin" is TECH_PENICILIN (one L), so it's easy to break something this way.
I bet that is exactly what happened. I remember when I loaded my own written stuff into Indiestone, the Plastics tech was missing.



I've never used his editor. My own mod added 48 techs (three Eras plus a little extra), and I did it all by hand (after planning the whole thing out on paper, of course). Worked just fine, although it took a few rounds of tweaking to make it look pretty.

Well, I'll get better at it. This is actually surprisingly easy compared to some of the modding I've done in other games (haven't done much and I am in no way a coder), so I'm interested in learning more.

I think I'm going to go ahead and release an initial version of my mod so I can get some suggestions (since everything actually works now!). I want to extend the Classical era out more and add some new units among other things. I've just got to play it a little one my own for a bit and figure what other minor changes I need to make before I do anything really major like adding a bunch of new techs/units.


Thanks a lot for your help!

Edit: Which forum would be appropriate to publish my (now very small) mod on? Modpacks or Components (since it says it is for small mods as well)?

Edit again: At first I was using the Indiestone thing just to visualize and see where I needed to put things x/y. I didn't really want to use it to make the mod for me. Hopefully now I can make any other changes on my own without 'cheating'.
 
Back
Top Bottom