DisplayName won't trigger overrides?
Note: Well, since it is a bug, it sorta would go in the bugs forum...but you know the chances of it getting fixed are nil, so I might as well put it here where the affected players, that is, the modders, can benefit.
So I've been modding GalCiv of late, continuing some old work I did on polishing the game. Graphics shader rewrite, fluff editing, interface string editing, and much flavor. I'll get to posting a new thread for it soon; haven't found the opportunity.
A major part of what I am going for is the flavor, removing the game-mechanical language and vocabulary from the interface and replacing it with a lexicon that feels more "in-universe" appropriate and, more importantly, consistent. Along the way, I changed the display names and interface names of the hull sizes to be something that an actual military might use, namely Monitor, Patrol (Craft), Escort, Cruiser, Battlestar, and Merchant for Tiny, Small, Medium, Large, Huge, and Cargo, respectively. (I used the names and order from Wikipedia, of course, but unlike most Sci-Fi these are in the correct order by size (except Battlestar which is from elsewhere entirely )).
Somewhere along the way, the AIs became completely incapable of building colony ships and, I assume, any other type of ship. Perplexed I threw in a fresh copy of the base mod I am using, Tolmekian's TechTree fix, and started to iteratively add back the things I changed until I found the point at which they stopped working: when the display names were changed. I then started testing hypotheses as to how that happened, because I was sure it wouldn't make sense for only hulls specifically to be affected by the modding.
And here is what I discovered: the AIs start working again when the display names of the hull components are also changed in the vanilla data files. Note that the modded components are still loaded from the mods folder, and in-game the player can access them and use them to build ships. But the AI can't until the vanilla data is altered as well.
How to explain this? I have a theory, but it is a thin one: when the game starts up, it loads the vanilla data files. Then, it loads all the data files it can from the designated mod folder, using that data to override any internal data from the vanilla game that changes something mechanically important. By that criteria, the hulls have not changed, because only the display name and description have changed. This is an optimization that would make sense if vanilla data is loaded first: you would not want to reload data that hasn't changed and the long strings of all the components and other XML elements would make load time at startup even longer by a large factor.*
But somewhere the game still loads all the modded data properly, and when the AI tries to build a ship, it can't find a match for the components because the internal component and the component it is actually looking for do not match.
Why hasn't this been encountered before? Well, almost all mods either add completely new components with new internal names, or they change the mechanically important data of vanilla components, so the likelihood of someone running into this is very small indeed. Further testing would be needed to see if this affects the entire data pipeline of the game.
*For future reference for anyone building a game from scratch, that means either you should compare mod overrides using all fields or the proper order of loading might well be modded data first and filling in the holes with dependency checking; the latter is much more complicated and error prone.