Still, as I said, compared to a "standard" approach, that does create a rather complex XML tree because you still need to include all unit types. It would be ideal if you could somehow adapt the way it works so that adding a new unit doesn't require the addition of so many lines of XML - but doing THAT, as I said, may require a new approach to the logic used in the code as well.
What I had thought of a long time ago was something similar to an approach used in web site design. Instead of defining all of the styles for each page individually, you can just link it to an external stylesheet, and thus have several pages using the same styles. When you add something to the CSS, it updates it for all of the pages that reference it. Since XHTML and XML are closely-related, I'd imagine this wouldn't be that hard to do (not a coder here, so don't shoot me
).
The significance here is that instead of referring to each individual unit, you could refer to that tag group. This way, if there's a Hill Giant unit and your peasant has an animation where he gets squished by it, then if I add another unit (say, a Frost Giant) and they both refer to the "giant" tag group, then it could automatically use that same animation for the new unit. I think something like this is vital if we want this feature to work when we start mixing and matching our factions. This is similar to the "attack sub-type" idea I referred to above, but with much broader implications and (I think) more useful. This would have implications not only on what's being discussed in this thread, but also in attack effects and damage types.
Let's suppose we have a giant zombie unit.
<unit-tags><!-- this is a hypothetical parameter for linking a unit to an external tag file -->
<tag path="../../../tags/giant.tag"/>
<tag path="../../../tags/undead.tag"/>
</unit-tags>
Then let's suppose we have another unit, say some kind of priest with a "holy word" attack.
<!-- attack skill stuff goes here -->
<efficacy><!-- this is a hypothetical parameter for determining what kinds of units will be affected more/less by an attack effect -->
<tag path="../../../tags/undead.tag" effect-multiplier="1.5"/>
<tag path="../../../tags/demonic.tag" effect-multiplier="2"/>
<tag path="../../../tags/angelic.tag" effect-multiplier="0"/>
</efficacy>
<!-- this means that whatever his special attack does, it will be more powerful against undead and demonic units, but useless against angelic ones -->
<!-- in the die skill -->
<default-animation path="models/fall_over_and_bleed.g3d"/>
<variations="true"/>
<variation>
<tag path="../../../tags/giant.tag"/>
<attack type="crushing"/>
<animation path="models/smooshed.g3d"/>
</variation>
<!-- if he is killed by a unit that is in the giant tag group using a crushing attack, he will use his smooshed animation -->
<!-- 2nd, 3rd, .. nth variations go here -->
So, in this case the unit tag affects the death animation of the victim, and also could have other properties. For example:
<!-- in undead.tag -->
<damage-multipliers>
<damage-multiplier attack="arcane" value="1.5"/>
<damage-multiplier attack="piercing" value=".5"/>
</damage-multipliers>
<!-- units with the undead tag will be hurt more by arcane and less by piercing -->
In this way, the tag would function as sort of a permanent GAE-style "effect" on the unit. In fact, effects could also apply temporary tags. How would this be useful? First of all, if you wanted two units to have a similar attack effect, you could have both of them refer to an external tag. Also, because of this, attacks could be more or less useful in combination. For example, let's use that Frost Giant I referred to earlier. Let's say he has two attacks, "freezing breath" and "icebreaker".
<!-- in frost_giant.xml, in the freezing breath skill -->
<effects>
<applied-tags><!-- this is a hypothetical parameter for applying a tag to the target -->
<tag path="../../../tags/frozen.tag"/>
</applied-tags>
</effects>
<!-- when the frost giant uses his freezing breath, the target gains the "frozen" tag -->
<!-- in frozen.tag -->
<effects>
<multipliers>
<move-speed value=".5"/>
</multipliers>
</effects>
<!-- units with the frozen tag, whether specified in their own xml or because of an attack, will move at half speed -->
<!-- frost_giant.xml, in the icebreaker skill -->
<!-- yadda yadda goes here -->
<efficacy>
<affects-only value="true" path="../../../tags/frozen.tag"/><!-- hypothetical tag that means the effect will only be applied to targets of a certain type -->
</efficacy>
<!-- this means he can only use his icebreaker attack on frozen units -->
Edit: Did some more commenting in the code to explain better.