Wow. So basically your "OR" prereqs set contains all of the original "AND" set, minus the inter-era prereqs? And the "AND" set is added with new prereqs to enforce the "one era after the other" rule. Smart.![]()

Now the first problem is that you did all of that through copy-pasting and you need a SQL. The second problem is your loading time but there is no reason we cannot fix that. When does the thing hang exactly? Could you try to insert print statements in the tech tree lua file and watch FireTuner to see which part is slow to load?
I'm not sure it's the actual LUA file that causes the long load time. I think it's the game trying to compile the tech tree itself, figuring out which techs are required to research other tech, etc. I had to raise the number of PrereqTechs in the GlobalDefines.xml file in order to do this. At any rate, my FireTuner doesn't want to load. It comes up with a "FireTuner2 has stopped working" message.
Now, to expand on this pure Lua approach, I need you to redo the tests I previously asked but without modifying the XML (I want the inter-eras prereqs to still be in the XML files). However, provided my guesses are correct, then the only thing you need to do is to prevent the UI to display those inter-era links, which is as simple as modifying line 107 and 150 as follow:
* Old: if tech and prereq then
* New: if tech and prereq and tech.Era == prereq.Era then
Well, I guess you should better start with that. Restore your XML prereqs to their original state (use the standard techs, not your custom tree for now if needed), keep the event code we used so far and make the changes I just described to techtree.lua. I guess the result will be almost good, minus a little problem that will appear if you click optics (not every tech in the ancient era will be lit up). Well, one step after the other.
EDIT: Nevermind the stroke part. Initally I assumed that civ5 was using the event for testing techs dependencies. I now understand it doesn't care at all and only deals with prereqs. And that we also have to modify them in order for API like Player.CanResearch to work. As a result I am now pretty certain that the "good way" to do it is to not change the OR prereqs set, add new prereqs to the AND set and use the display trick I detailed in this post.
Well, I tried this with the vanilla TechTree and it works. The eras are divided up into seperate trees, with the pipes missing between eras. Everything else works just as vanilla would, and load times takes 1-2 seconds.
The problem is, when I go to add all the PrereqTechs from the previous era (the techs at the "end" of a particular era tree) the game still takes 5+ minutes to load.
Some SQL code to add the missing prereqs. This is far to be optimized but since those queries are only ran once on startup, I guess this is not needed. Should I be wrong, though, there is room for improvements.
Spoiler :
Code:/* Add new prereqs so that each tech from era N have all the techs from era <N. */ INSERT OR IGNORE INTO Technology_PrereqTechs SELECT TechType, PrereqType FROM (SELECT Technologies.Type AS TechType, Eras.ID AS TechEra FROM Technologies INNER JOIN Eras WHERE Technologies.Era = Eras.Type) CROSS JOIN (SELECT Technologies.Type AS PrereqType, Eras.ID AS PrereqEra FROM Technologies INNER JOIN Eras WHERE Technologies.Era = Eras.Type) WHERE PrereqEra < TechEra /* A table that contains T0 and T2 for all T0 -> T1 -> T2 dependencies (T0 -> T1 is defined in S1, T1 -> T2 in S2). Also stores higher order cases such as T0 -> T3 since we do have T0 -> T1 (S1) and T1 -> T3 (S2). Use your own unique, mod-specific, prefix rather than XYZ. */ CREATE TABLE XYZ_IndirectPrereqs AS SELECT S1.PrereqType AS PrereqType, S2.Type AS Type FROM Technology_PrereqTechs S1 INNER JOIN Technology_PrereqTechs S2 ON S1.Type = S2.PrereqType /* Trims unneeded prereqs: T0 -> T2 when exists T0 -> T1 -> T2. Also covers higher order cases (see XYZ_IndirectPrereqs comments). */ DELETE S FROM Technology_PrereqTechs S WHERE EXISTS (SELECT * FROM XYZ_IndirectPrereqs Indirect WHERE S.Type = Indirect.Type AND S.PrereqType = Indirect.PrereqType)
Sorry... I'm not sure what I'm to do with this? Do I add this to a new SQL file?
