I know that xml can be used, but will the artdefines files be modular? According to the modders guide, they can't be made modular. Well, the modders guide may be obsolete. Although it is helpful, it should be made clear if it contains information that are incorrect now...
Thanks, I've edited the first post here to reflect the change from patch .674 : the artdefine files are now "modular" (read: they are loaded in the database) and you can't override the 2 original files anymore.
Adding new entries is done using the SQL or XML syntax used to modify tables.
As of sql vs. xml, I don't see the big advantage. If you prefer to use sql, it is of course your decision. But practically, using the sql approach makes you rely on another unit. Even if the artdefines files should be modular now, it would likely be possible to delete entries from there as well. As said before, if there is a mod that removes your template unit, your mod won't work anymore as the select will fail or deliver an empty result (null). And as I said before, sql will be harder for absolute beginners to mod as the internal tables are harder to look up and understand (not to mention sql itself). With xml, however, you can simply copy defines from a different unit (there's your template) and likely even reuse the templates that Firaxis provided with the Defaults entry (even another template you could reuse). Also, you'll have to write less code as most of the xml will be copied, only a few values will be altered. In contrast to that, one will have to write a lot of sql to mod in a unit that should not reuse another unit to not rely on it. And the sql will be 'error-friendly', just consider one accidently swaps two columns. So, my opinion is, that xml would be the better and cleaner solution and I'd switch to it if the artdefines should be modular now. Also, if they should be now, I'd be happy if you could describe both ways as alternative approaches, mentioning their pros and cons.
Right for some points, I have also edited the first post to add a warning about the use of template in case the unit we copy data from is deleted by another mod.
I disagree on the "less code" and "cleaner" parts.
About "less code" the point of the template being to copy all the values, and, when fully optimized like in
R.E.D. Modpack it saves a lot of time when you deal with a lot of units. For that mod, I just need one line of code to add a new unit. Yes, a single line.
About cleaner, it's also about optimization and formatting,
see here.
About easier, that's true I suppose, especially when coming from Civ4 modding, once the concept of updating the database using the XML file instead of replacing (or adding code to) another one is grasped. Note that it's slightly different from modular loading (IIRC modular XML from civ4).
Having checked the austrian hussar and whether there are entries in its xmls that have been introduced with G&K, there does not some to be any new entry. The only two differences are that the flanking promotion wasn't there before G&K and the cavalry was upgraded to tank, not wwi_tank. So, if there are differences between the db tables (which I didn't check), they are handled by some code, which would be another advantage of xml. On the other side, the hussar might be a special case if it does not use any of the new entries.
EDIT: and thanks for explaining the brackets. I'll remove them then.
The new entries are in
CIV5Units_Expansion.xml (search in assets\DLC\Expansion folder)
edit:
And the art defines files are in \Assets\DLC\Expansion\Units folder.
Note that DLC' XML files (and G+K) are not loaded the same way as mod's XML files. They are loaded during the game initialization, before the main menu is visible, and using a truly modular method I suppose.