Easiest way to add existing 3D models to new units?

Zobtzler

Chieftain
Joined
Oct 21, 2017
Messages
95
Location
Sweden
I'm currently making a civ with a few unique units. I've configured the names, description, upgrades, replacements etc
The only thing I want to include now are the correct 3D models for the units.

The units I'm implementing are:
  • A replacement to the pikeman (it's still a pikeman with the same name and new stats)
  • A new mounted unit (uses the cavalry model)
  • A replacement to the musketman (will use the red coat model)

I plan to make this in two steps:
  1. Use already existing models in the game
  2. Use already existing models in the game, but with some tweaks to colors and hats etc.
I'm currently only interested in step one (as I just want the units to show up with a proper model).

What is the easiest way to implement step one? (I have done no work on models in the project so there exist no Units.artdef or other files etc)

(I've tried to follow a few guides here, but I've mostly gotten lost halfway into the guide because some parts are a little too obscure)
 
It's a lot trickier than it probably should be to reuse base game assets for new units.

1. You need to have Units.artdef file in your mod. You can create an empty one using the Asset Editor.
2. You then need to copy the Element from the Units Collection that you want the art of. For example, copy the UNIT_PIKEMAN Units Element but change the Name to the name your are using in your game DB XML/SQL code e.g. UNIT_MY_MODDED_PIKEMAN.
3. You will then need to reference the Units.artdef file from your Mod.Art.xml so that it gets added to your .dep file.

To modify colors (Unit Tints) and models (Hats, etc) you will have to make your own UnitMemberType Element - as with the Units Element you can base this on an existing one.

I've tried to give some pointers in these guides but the .artdef setup is quite complex and takes a bit of figuring out. Often the best start point is to check out existing mods to see how they are doing things.
https://forums.civfanatics.com/threads/rough-guide-to-units-artdef.603687/
https://forums.civfanatics.com/threads/3d-art-assets-in-civilization-6-a-modding-guide.612050/
 
So basically, copy-paste the <Element></Element> for each unit, in each subgroup (i.e. Units, UnitMovementTypes, UnitFormationTypes etc) or only the first one (Units)?
For the Pikeman, I only need to edit <m_Name text="UNIT_PIKEMAN" /> to <m_Name text="UNIT_MY_MODDED_PIKEMAN" /> (if that was the name)
And for the other units, the same procedure, but also change <m_ElementName text="Redcoat" /> to <m_ElementName text="Bluecoat" /> (if that was the name) where applicable (I've seen a few instances where unique replacement units have the original unit's name in one of it's parameteres) or is that unnecessary and only backend stuff that the end user won't see?

Is that right?
 
Last edited:
3. You will then need to reference the Units.artdef file from your Mod.Art.xml so that it gets added to your .dep file.

As I understand it, I need an <Element text="SomeName"/> in
<Element>
<libraryName text="Unit"/>
<relativePackagePaths>
here
</relativePackagePaths>
</Element>

However, what part from Units.artdef am I supposed to have in the quotes?

EDIT: Looking through your MoarUnitsArtCookerpart2 project, it's seems I'm missing a Units.xlp... what do I have to put into <m_entryID> and <m_ObjectName> as you seem to link yours to the .mtl files, but I don't have those as I'm trying to use existing models?
 
Last edited:
From my guide:

XLPs (.xlp files)


You can think of the .xlp files as the XML Library Package definitions of which Assets (.ast) get cooked into which .blp (Binary Library Package) files.

The key elements of the .xlp files are explained below:
Code:
    <m_ClassName text="Unit"/> <!-- type of Asset to go in this library package -->
    <m_PackageName text="units/units"/> <!-- name of resulting .blp package file -->
    <m_Entries>
        <Element>
            <m_EntryID text="T34_Tank"/> <!-- The entry to be referenced from .artdefs -->
            <m_ObjectName text="T34_Tank"/> <!-- Refers to Asset .ast file -->
        </Element>
    </m_Entries>
 
Top Bottom