Right, this is a rather complex issue so I want to hear modder's opinions before I go down any one path.
Just so we're clear: allegiance refers to the choice of Kingdom/Empire. Race refers to to the specific raceclassification (standard is Men or Fallen, but unique values are possible). Faction refers to a specific team, for example Tarth.
Basic problem: I want to replace the standard buildings for a (new) race. Let's say I want to replace the basic Kingdom workshop with a new tile. I want only my improvement to appear in the building list, and I want no other workshop to appear in the building list.
More problems: The only prerequisite for a kingdom workshop is for the player to play the allegiance Kingdom. Everyone who plays Kingdom automatically has access to the same tile. So, to remove it, I have to change the workshop for all players, even those not using my faction.
Solution A:
Add a prerequisite to the original building to require the race Men. A new faction can use a new race (raceclassification), and thus avoid getting any old buildings.
Problem: All custom racemods that have a non-standard raceclassification are hurt. Let's say one mod wants to use the standard workshop and the arcane laboratory, but wants to use their own merchant and watchtower. The mod would have to include the improvementtypes for all four types, instead of just two. Because ANOTHER modder has declared that the original workshop and the arcane laboratory should belong to only one race.
Doesn't sound too bad? Then consider, that each racemod must contain every improvement, whether changed or not, that is buildable without researching any technology. This includes the basic 5 buildings, and 20-21 resource improvements.
Still doesn't sound too bad? Think it's a copy and paste job? Then also remember, that each racemod would have to update each improvement type individually whenever a patch is released.
Solution B:
Keep the old buildings, just add your new buildings and make the player choose between vanilla version and new version when building.
Problem: Resource tiles only allow for one building to be used. This means we can't use our own designs on resourcetiles. Furthermore, the AI would build cities that break the theme and thus the point of the racemod.
Solution C:
Build a custom Techtree with reduntant techs (one for each improvementtype). The raceconfig then uses <KnownStartingTech> to teach the race only the buildings that the racemod doesn't want to change.
Problem: All redundant techs would have to be added to the vanilla factions, and this would break all custom factions designed by players in the faction editor [a solution would be to include a simple ability worth 0 points that all players would have to include). Since this involves editing a techtree, the standard techtrees are effectively "spoken for", and no other modder can modify the techtrees. This solution also breaks the campaign.
Solution D:
All the modders doing racemods agree that we do NOT use custom tiles for resource improvements. We stick with the vanilla resource improvements.
Then we use Solution A for the remaining 5 buildings. So each racemod would have to include 5 buildings only, whether altered or not.
Solution E:
Almost like solution A: We add a prerequisite for race to all vanilla improvements that don't require technology.
Then we build a library which contains a custom techtree, and a carbon copy of all the improvementtypes. This techtree contains one redundant tech for each improvement. The racemod then declares, in the raceconfig through KnownStartingTech which buildings are used from vanilla, and ignore those to be replaced by the mod. The library is updated, the modder only needs to update the buildings he himself changed.
Those are the solutions I can think of.
The first thing I thought was that Solution B would be the best. It's by far the least invasive. However... most of us building racemods do so with the intention that they should be usable by the AI as well. And the AI will build cities that contain 50% or more huts/houses. Half of these will be vanilla tile, half will be modded style with solution B.
Solution E is the cleanest. Factions from the faction editor are not harmed. But someone has to maintain the library, and it's going to be a lot of work (I'm not interested).
God damn, this modding system is fucking bollocks.
Anyway. Comments?