@Vincent
Pedia Upgrade Trees Problem
After reading through that 500+ lines of codes, I came to a conclusion.
KeyError: XX means dict[X] does not exist.
which refers to this line
nodeB = mGraph.graph[unitB]
The reason why it does not exist is because in an earlier loop
for iterlimit in range(10):
It only tries for 10 times to "beautify" the graph so that everything looks nice.
In other words, after 10 times, if the graph still looks complicated due to interlocking arrows blah blah blah, it gives up and goes to next item.
Thus, 1 solution is increase it to 100 times, which will slow down the processing, but gives it more chance to rearrange everything.
If it is still messy after 100 tries, the last resort is add to exception list.
I tried with Tech Tree to test the bug and I ended up adding so many techs to exception list so that it can draw out the upgrade tree.
Code:
self.exceptionList = ["TECH_LITERATURE", "TECH_CALENDAR", "TECH_CONSTRUCTION", "TECH_LIBERALISM", "TECH_SCIENTIFIC_METHOD", "TECH_MEDICINE", "TECH_REFRIGERATION", "TECH_ENGINEERING"]
Conclusion:
Your upgrade paths are too complicated for the graph to draw nice arrows.
Who are the culprits?
KeyError: X means Unit with Unit Type ID X is the culprit.
gc.getUnitInfo(X).getType() will tell you who the heck is ID X.
Adding to exception list does not really solve the problem.
It ignores the unit completely, which means literature, calendar etc do not show up in the upgrade tree, misleading others to think they are not upgrades/pre-requisties of others.