Technologies XML File Question

masterookoo

Chieftain
Joined
Jan 28, 2012
Messages
15
Hey forum.
So as of late I've been screwing around with the idea of setting a different end era than the Future Era. My era of choice was the Renaissance, with a smattering of technologies from the Industrial era.

I decided that the best way to try and set the Renaissance era was to use the XML files. So, I went in, found the post-Renaissance technologies, and set the Science cost to about 9999999999999999.

Therein lay the problem.

When I launched the game I found, to my surprise, that the post-Renaissance techs cost was set at 1. After screwing around with different numbers for awhile I found that 5 digits was the highest the tech tree seemed to be able to list (the number was 32005). When I plugged in 99999, however, I found that post-Renaissance techs were well within my grasp.

So, what am I doing wrong, or is this the wrong way to go about it?
 
Sorry for the long wait- was busy beating up France last night :S

No, setting the value to -1 just makes it 1. I'd try 0 but I'm pretty sure that'd just make things instant.
 
What you could do (It's a bit of a messy way to do so) is delete all the technologies you don't want, with the exception of Future tech (Need a repeating tech otherwise you won't be able to advance the turn)
 
What you could do (It's a bit of a messy way to do so) is delete all the technologies you don't want, with the exception of Future tech (Need a repeating tech otherwise you won't be able to advance the turn)

There be demons! Think of all those units/promotions/buildings/routes/builds/AI stuff/etc (about 15 tables IIRC from when I looked earlier) that would break as they were missing references to the Tech table.
 
There be demons! Think of all those units/promotions/buildings/routes/builds/AI stuff/etc (about 15 tables IIRC from when I looked earlier) that would break as they were missing references to the Tech table.

Not a problem. There's a Lua command for this that someone pointed out a while back, for deleting all entries in any table that have references to a deleted Type variable. Don't remember what it is offhand, since I prefer to do all of my Deletes by hand, but for this sort of total reworking it'd be a good option. I'm sure someone here knows the command.

The second issue is that some tables still require sequential IDs. The Units and Buildings tables can handle missing entries, but UnitPromotions can't; if you delete the promotions related to Armor, air units, helicopters, etc. then the game will break since it now has a gap in its IDs. There have been some utilities posted on this board for re-sequencing the IDs, though, so this isn't a big problem either.

The third issue is that the Tech Tree UI lua code assumes exactly seven eras. If you delete every tech in a single Era, it'll break. You can easily re-code that particular UI to not display certain Eras, if you want.

But honestly, if all you care about is a working mod and not the aesthetics involved, then the solution is much, much simpler. Each technology has a Disabled flag set to False; just use an SQL command to set it to True for any tech whose <Era> value is ERA_INDUSTRIAL, ERA_MODERN, or ERA_FUTURE, and *poof*, you've got a tech tree that stops at the end of the Renaissance. It's literally a three-line SQL file. A Disabled tech can't be researched, can't be gained from a Great Scientist, and so on; it CAN be gained by a city-state or the Barbarians, but only if one of the major civilizations has already gained it somehow, which won't happen in your case.

The only thing you'd have to worry about, then, is adding a new repeatable tech to the end of the tech tree (and as was pointed out, even that's optional now). And like I said, it'll be ugly; the tech tree will still show all those disabled techs in red (although you can mod the UI to hide those if you want), and the Civilopedia would also show all the units and buildings... except that the Civilopedia code already loops over the existing Eras when assembling those lists, so if you delete the Eras from that table then the Civilopedia won't list them.
 
Not a problem. There's a Lua command for this that someone pointed out a while back, for deleting all entries in any table that have references to a deleted Type variable.

(Its an XML tag) Except you'll then have deleted entries in tables which are themselves referenced from other tables, so you'll need to add <DeleteMissingReferences> tags for those, which will in turn ...

You'll also end up with widowed entries in tables that refer to entries that no longer exist, for example, Units.class references UnitClasses.Type so will be picked up by the tag, but UnitClass.DefaultUnit only (indirectly) refers to Unit.Type (ie there is no database foreign key for it) so won't be picked up by the tag, and while this may not be an issue for UnitClasses/Units there are other pairings where it may be critical.

The <DeleteMissingReferences> tag only really works from the top down, ie, delete a UnitClass, get the tag to delete Units, get another tag to delete Civ UU entries, and not from the bottom up, which is what you are trying to do by starting from Techs
 
(Its an XML tag) Except you'll then have deleted entries in tables which are themselves referenced from other tables, so you'll need to add <DeleteMissingReferences> tags for those, which will in turn ...

The catch being some of those second-level tables reference but do not REQUIRE entities in another table. I'm not sure if the orphaned UnitClass.DefaultUnit you mention is one of those, but there are some. And even if they are linked, you can use DeleteMissingReferences on the unit types as well; you know which ones they are, after all. It's more than just the one-line fix of using DMR on a deleted era/tech, but it CAN be done, and is still a lot easier than trying to go through all those secondary tables (like Unit_Flavors or Unit_FreePromotions) to see which ones need to be deleted.

Regardless, I'd still suggest taking my other idea and not deleting them at all. Just disable the techs in question through SQL, and play the game normally. As I said, it may not be pretty (unless you also mod the UI) but it'll work. There are even a few ways to hide the disabled techs without modding the UI, like changing their X and Y values to fall outside the tech tree's grid.
 
That's part of the problem - not the 15 tables with explicit references to the Tech.Type field, but the unknown number of tables that may have an indirect reference to the Tech table. And then all of the tables that have direct and indirect references to those 15 tables - you're pretty much going to be scanning the entire database for dependencies.

And three of those tables relate to AI Strategies, and some of those seem to be directly referenced from the C++ core, so who knows what weird effects deleting entries in there will have.

Hence why I put "here be demons", it's not a small job and certainly not as straightforward as "delete all the technologies you don't want", but then you and I both know that.
 
Hence why I put "here be demons", it's not a small job and certainly not as straightforward as "delete all the technologies you don't want", but then you and I both know that.

Sure. I'd bet that you could still get it to avoid any explicit XML conflicts just by sticking with DMR commands in the dozen or so "primary" tables (the ones with ID and Type fields), but who knows how the AI would react; I hadn't even thought about the hard-coding in the grand strategies. Given the AI's second colonization push after Astronomy, there's definitely some internal tech-based hard-coding going on. And you'd get UI conflicts in all sorts of weird places, like the Victory Progress screen, where it shows how close you are to a science win and which spaceship parts you've finished; deleting all of those from the database would definitely screw up that UI, and quite a few of those bits are hard-coded internally.

The problem is that many of these issues apply to ANY attempt to cap the tech tree, even if you use my <Disabled> method. The whole Science Victory in general would cause you all sorts of issues, because if the AI can still pick a grand strategy towards that victory but can't ever get there, it's at a huge disadvantage; you can make a new Wonder that fills the same role, of course, but now people would be winning earlier. And no Diplomatic win without the U.N., of course, so you'd need to add something for that, too. And it'd be really hard to get a cultural win in an earlier era unless you change the culture cost relationship, which'd mean more policies early on, which'd make the era unlocks on policy branches more restrictive. And what about UUs/UBs for civs who'd now lack one of the two since it fell in those later eras? Or things like the French UA (+2 Culture per city per turn until Steam Power), in a game where no one ever reaches Steam Power?

The fact is, no matter what method you use, you'll run into all sorts of issues you weren't expecting. If you want the players to spend more times in certain eras, there are better ways to do so than explicitly capping the tech tree. Add more techs, change tech costs, change research output of buildings, that sort of thing. My Mythology mod basically doubled the amount of time spent in the first three eras by adding a dozen or so techs and tweaking costs, and it required changing all sorts of things to get right.
 
Wow, big debate going on here xD

Could you guys try and simplify these instructions a bit? I'm fairly computer savvy, but not enough for all of these things xD

All I need is for the post-Renaissance techs to stop appearing. I don't care how ugly the UI is, or that the techs are still in the Civopedia. I JUST WANT TO BE IN THE RENAISSANCE :D

Edit: Scratch that, just spent more than 5 seconds reading Spatz's post and know what to do now xD

Edit Edit: Spatz, the flag's not in the XML file. Is it somewhere else?
 
Edit Edit: Spatz, the flag's not in the XML file. Is it somewhere else?

It IS in the XML file. Right at the top, in the Technologies table declaration, it says "Disable". It's a boolean that defaults to False. That means that even if you don't see it explicitly given in any of the <Row> declarations, it's still there, set to false, because none of the techs in the core game are supposed to be disabled.

That's how XML works. Every field in that Table declaration will be filled for every entry you add; it's just that a lot of them will have default values and so won't need to be explicitly set each time. But since they're still there, you can use <Update> commands on them just like you can for the ones you can see in each Row.
 
Alright- so I just copy and paste the the disable function into all of the post-Renaissance techs, rewrite it to be "True", and go along my merry way? I'm sorry if I'm being a bother, but I'd like to not permanently screw up my game settings xD
 
No. You do not "copy and paste" anything. That's not how XML/SQL modding works; if you've been altering the game's core files, then you're doing it wrong and can cause all sorts of problems. Go read Kael's beginner's modding guide over in the references forum on how to create a mod the right way.

If you use XML, for instance, then you just need a single file that says something like this:
Code:
<GameData>
  <Technologies>
    <Update>
      <Set Disable="true"/>
      <Where Era="ERA_INDUSTRIAL"/>
    </Update>
    <Update>
      <Set Disable="true"/>
      <Where Era="ERA_MODERN"/>
    </Update>
    <Update>
      <Set Disable="true"/>
      <Where Era="ERA_FUTURE"/>
    </Update>
  </Technologies>
</GameData>

That's all you need to put in the mod's XML file. Then just do all of the usual steps for loading a mod, and you're done.
 
I just pasted <Disable>true</Disable> into all of the post Renaissance techs but kept Steam Power and set it to be repeatable. Would that be a problem? It looks about right.
 
Would that be a problem? It looks about right.

Yes. It'll be a problem. You should NEVER be editing the game's core XML files. If you do so, here are some of the issues you'll face:

1> As soon as the game downloads a patch, it'll delete all of your changes, especially if the patch changed that table's definition. Since the expansion is coming out in two months, it's practically guaranteed that we'll get a "compatibility patch" in the next month or so that adds a lot of the new fields the expansion will use. We've had this with many of the previous DLCs.
2> If your changes break anything, it'll be much harder to debug it, since you won't be able to play a game that doesn't use your changes. And even if it doesn't break anything, you still won't be able to play a game that doesn't use your changes.
3> Multiplayer won't work.

So never, ever do that. Learn how to make a mod properly (from that link I posted), and use the Update commands I posted above.
 
Well, first attempt it's not working- but, nonetheless, I'll screw around with it for awhile to get it working. Can't find the section of the guide that detail exactly how to go about installing the mod...but, anyways, thanks for all of the help everyone :D
 
Back
Top Bottom