I really should have gotten around to documenting the XML format, but it's tedious work.
So, you want to add a building/unit to an existing race? "h_r_human" is the race definition. The "available_unit" entries aren't used that much, only for determining what settlers the race can produce. "available_structure" is the more important one, as that populates the list of structures you can place. New units should be added through a structure. The "id" attribute on "available_structure" needs to correspond with the "id" on a "structure_data" element somewhere in the xml files. The actual names of the files are only important for over-writing files through mods, you can name a new XML file whatever you'd like.
Adding a new Structure
- Crate a manifest file for the mod (you can copy and modify manifest.xml in BaseMod.zip)
- Create a new XML file, it should contain "game_data" at the root, then the "structure_data" for your new structure.
- Copy "h_r_human" into your mod, and add a new "available_structure" element, with an "id" matching that of your new structure.
- Create a zip archive (it has to be a zip, not a rar) of the files in the mod.
- Put the zip file in the "mods" folder and load it.
Adding a New Unit
- Follow the same steps as "Adding a new Structure", but don't create the zip archive yet.
- Define the new unit in a new file, with "game_data" at root, and "unit_data" underneath it. "h_u_militia" is a good example to follow.
- In the new structure, add the ability to support the new unit. Look in "h_s_barracks_melee" for an example. You need a "unit_support" element in the "operation" element, with the "unit" attribute matching the "id" of the new unit added in step 2.
- Create and load the zip file, as steps 4 & 5 in "Adding a new structure"
When you build that new structure it will train and support he new unit.
Note: "h_s_barracks_melee", and many of the other structure definition files in BaseMod.zip contain multiple structure definitions. You can do this if you like, I find it handy to keep the entire upgrade chain of a structure type together.
Hopefully this clears things up a little.