Mix & match?

With the introduction of Sid Meier’s Civilization VI they also introduced a new way of configuring and representing art in the game.
The artists from Firaxis Games have created a whole bunch of seperate parts. Think weapons, shields, bodies, hats, armor, etc. And then provided a way to attach these different parts together at predefined attachment points.
Those parts are aptly named attachments.

Now I hear you think: “But they have these specialized tools to make that work!” Well yeah, but since the release of the modding tools (Patch modding tools announcement) us mere mortals get access to these tools as well!! There is an Asset Editor included with Modbuddy. With that asset editor we can create our own artdef-files.
These artdef-files are basically XML files, but mostly unreadable when you open them with a text editor. When we use the Asset Editor they become way more obvious.

I will take you through the basics of this powerful tool with my Axemen unit mod as an example. That mod can be found on the Steam Workshop: Axemen Unit & Copper Strategic Resource.

Axemen unit

To create the model for the Axemen unit, I didn’t have to work with a 3D imaging program. I am not very good with those programs and very much prefer to work with XML, SQL and other coding stuff.
And then came in the Asset Editor. You can launch it by opening Modbuddy and then (while having a solution open) click on the TOOLS menu. There you pick Launch Asset Editor.... That's when you get this screen.
Opening screen Asset Editor
Click the image for a bigger version.

To speed us along, I already have the Units.artdef from the mod, the Units.artdef from the basegame and the Unit_Bins.artdef from the basegame open. The latter two are marked as Read Only. I used those files to see what was available to me and how the units in the game actually used the system.

This requires searching, clicking and trying, but is definitely something I would urge you to do yourself. Go explore that artdef-file and find what you can and want to use for your next mod!

The actual interesting part is in the left panel, here in detail.
Left panel Asset Editor Units.artdef

What you see here, is that I opened a few branches to show that there is nothing there. There are two interesting places: Units and UnitMemberTypes.

Units branch

First the easiest. Right click the branch to get a context menu, which usually has one or two options. Add Element and Remove Element. In this case, add an element and select the newly created element. This is what that looks like for the Axemen Unit.
Unit branch, right panel
The Name property is important, because that's what you have been using in the XML files to reference your unit.

Sidestep: Civilization 6 uses assumptions on naming all throughout its engine and files. Icons for example are often deduced by the engine based on the name. It also assumes that models for units are defined in Units.artdef. So the filename is actually mandatory here. Because of this, you also have to use the proper name here, it references the same name you use for the unit in the gameplay data XML.

Here you can also see that I based the Axemen Unit mostly on the Swordsman when it comes to basic definitions. The branch is now called UNIT_AXEMEN in my example. This has another two sub-branches. Of those Members is the one important in this case. Here you define of which members your unit is composed.
In my example the unit is composed of only one member type. Of those there are 4 visible in a fully healthy unit, as indicated with the Count property. The Type is one I defined myself and aptly named Axemen. And this is where the magic happens.

UnitMemberTypes branch

Now here it gets interesting! First create an element and give it a name that’s useful to you, Axemen in my case. The Name of this element is what I used in the above explained Type property. Make sure that you fill in the specific properties of each element that requires it. The UnitMemberTypes has a few for example. I again copied these over from the Swordsman.

I’m now diving in a bit faster, because the parts Culture, Any and Variations aren’t very exciting and pretty straightforward to create and fill in. Just use an example unit or the Axemen Unit mod. You can even copy over entire branches!

Under Variations the fun stuff begins! I created two variations, A and B. Naming isn’t very important here. Each variation basically stands for a differently build model within your unit. I have two variations, because I have one variation of models that has a weapon and a shield and one that has two weapons. The second also uses a different body model.

Here you can go nuts with attachments! What you do not define, will not show up in the game. For each part (Body, Hats, Shield, etc.) you reference an art bin. The available artbins are in the Unit_Bins.artdef and the way you can reference them can be found in the Units.artdef file.
Generally it’s in the form of <type of attachment>/<name of unit>. For example when I use the Spearman armor (which is variation A in the Axemen Unit!), it has Armor/Spearman has the name of the Bin used for Armor.

By creating variations, you leave it up to the engine as to which variations show up in which amount in your unit. This will differ for each and every unit. If you want more control, you can of course create two (or more) different UnitMemberTypes with each only one variation. Then use the top Unit branch to define multiple Members for your unit and set the amount of that type. For example if I wanted to have each variation show up twice in each unit in the game. I’d create a second UnitMemberTypes, put that in with the Member branch of the Unit branch, and set the Count property of both to two.

How it gets included in your mod

This is actually a nice bit of Modbuddy magic. I mentioned earlier that you can only open the Asset Editor if you have a solution open. That is because it’s automatically included in your mod! Based on the assumption of the engine that art for units will be defined in the Units.artdef it automatically finds your newly defined model and use that in the game.

Keep in mind that you have to add the icons for your unit (portrait and icon used in the build queue are the minimum) yourself, using a dds file. But that’s something for a different post.

Sidestep: Civilization 6 will automatically resize your icons for you. It finds the one defined closest in size (bigger if possible) and resizes that to the needed size. So you actually only need to include each icon in one size. But do make sure it’s big enough. Because scaling it up in the game is really ugly!