I'm trying to come up with a nice and flexible way to manage upgrades in my RTS. There are multiple races with different units and buildings, as well as different upgrades. Each upgrade can modify one or more attribute (cost, range, attack speed, damage, ..) on one or more unit/building type. There can also be unit type groups (cavalery, ranged, ..). The game shall be moddable, so modders should be able to add new units and buildings which should work with these upgrades.
Players can form teams which may share upgrades.
- Horse Armors: Cavalery +10% armor
- Military training: All Units +20% damage, Recruit Time +10%
- Sharp Arrows: Archer +15% damage
Each player would then store his tree of upgrades and whenever a stat was needed, the tree would be traversed and any upgrades encountered would be applied. I see a few problems with this. First, there'll be ALOT of upgrade tree traversal. Second, what about Cavalery Archers?
How would you structure it?