Creating new units with mixed models

DarkScythe

Hunkalicious Holo
Joined
May 6, 2014
Messages
804
Hey there, everyone.

I am wondering if anyone would be able to help point out what exactly I am doing wrong, or if there are additional hoops I need to go through to make a new unit work with multiple models.

I'm adding these in upon request of someone who wished to see them in my upcoming mod, and to that end, I grabbed a copy of Civitar's reskinnable wolf unit pack. I also managed to figure out all of the XML I needed to write in order to get everything together and into the game.

For the moment, it loads, I see no errors in the logs, and everything works.. except for one thing.

I've tried following the format of the Warrior's <ArtDefine_UnitMemberInfos> and <ArtDefine_UnitInfoMemberInfos> in order to create a new unit that contains a mix of 3 different "skins" from Civitar's pack, as a test. However, no matter what I do, only one type of model is ever rendered (the NumMembers for that particular group works properly; it changes if I change the definition in XML) but none of the others ever appear. Everything is imported into VFS, so I'm not sure what else I need to do.

Does anyone have any pointers?

Thanks!

Edit:
As far as I can tell, it renders the very first model defined in each of those tables; if I swap one of the "non-rendered" ones to the top of the XML file, it renders, and the previously working one now fails to render.. hmm.

UPDATE: The problem (potentially) has been discovered by Nutty and Nomad or What.
Per post #15 in this thread:
It seems to apply only to [some] units with custom animations.
Per post #55 in this thread:
As I suspected from the results of Nutty's testing, many of the earlier animation conversions were done incorrectly

Small list created by Nutty on post #44 in this thread:
BAD: Wolf, Scorpion, Highlander
GOOD: MacTruck, Dreadnought Mechs, Slaver, Warg

Per post #57 in this thread, Nomad or What's Scorpions should be fixed, and available here.
Wolves should be fixed and available in post #55 of this thread.
 
The mod isn't quite ready yet for public consumption, which is why I haven't attached it yet; That said, I see no errors in any of the logs that would point to anything in my files, so I thought maybe there were extra conditions related to using multiple models in one unit that I haven't found yet.

I'll PM you the latest build I have currently.

To clarify:
I'm mostly looking for general pointers, areas to doublecheck, and gotchas to look out for with regard to adding new units, so I can check to see if I've made any mistakes that aren't turning up errors.
 
Okay.. I have no idea what's going on, but I am getting a strong, but unfounded, suspicion that maybe the game isn't able to properly share these files, or something.

In this test, I am replacing 2 units: The Warrior, and the Swordsman.

Code:
<GameData>
	<ArtDefine_UnitInfos>
		<Row>
			<Type>ART_DEF_UNIT_WOLF_PUPS</Type>
			<DamageStates>1</DamageStates>
			<Formation>UnFormed</Formation>
		</Row>
	</ArtDefine_UnitInfos>
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP</Type>
			<Scale>2.0</Scale>
			<Model>direwolf_dark.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>
	<ArtDefine_UnitInfoMemberInfos>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_WOLF_PUPS</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WOLF_PUP</UnitMemberInfoType>
			<NumMembers>14</NumMembers>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>
	<ArtDefine_UnitMemberCombats>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WOLF_PUP</UnitMemberType>
			<EnableActions>Idle Attack RunCharge AttackCity Bombard Death BombardDefend Run Fortify CombatReady Walk AttackCharge</EnableActions>
			<ShortMoveRadius>24.0</ShortMoveRadius>
			<ShortMoveRate>0.35</ShortMoveRate>
			<TurnRateMin>0.5</TurnRateMin>
			<TurnRateMax>0.75</TurnRateMax>
			<TurnFacingRateMin>15.0</TurnFacingRateMin>
			<TurnFacingRateMax>20.0</TurnFacingRateMax>
			<TargetHeight>8.0</TargetHeight>
			<HasRefaceAfterCombat>1</HasRefaceAfterCombat>
			<ReformBeforeCombat>2</ReformBeforeCombat>
			<OnlyTurnInMovementActions>1</OnlyTurnInMovementActions>
			<RushAttackFormation>DefaultCavalry</RushAttackFormation>
		</Row>
	</ArtDefine_UnitMemberCombats>
	<ArtDefine_UnitMemberCombatWeapons>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WOLF_PUP</UnitMemberType>
			<Index>0</Index>
			<SubIndex>0</SubIndex>
			<WeaponTypeTag>BLUNT</WeaponTypeTag>
			<WeaponTypeSoundOverrideTag>BLUNT</WeaponTypeSoundOverrideTag>
		</Row>
		<Row>
			<UnitMemberType>ART_DEF_UNIT_MEMBER_WOLF_PUP</UnitMemberType>
			<Index>1</Index>
			<SubIndex>0</SubIndex>
			<VisKillStrengthMin>10.0</VisKillStrengthMin>
			<VisKillStrengthMax>20.0</VisKillStrengthMax>
			<WeaponTypeTag>BLUNT</WeaponTypeTag>
			<MissTargetSlopRadius>10.0</MissTargetSlopRadius>
		</Row>
	</ArtDefine_UnitMemberCombatWeapons>
	<ArtDefine_StrategicView>
		<Row>
			<StrategicViewType>ART_DEF_UNIT_WOLF_PUPS</StrategicViewType>
			<TileType>Unit</TileType>
			<Asset>SV_Warrior.dds</Asset>
		</Row>
	</ArtDefine_StrategicView>
</GameData>

That is the relevant code. My initial attempt was to use 2 more skins/models from Civitar's pack, in order to induce some sort of variety in these groups of units: "direwolf_dark" as used in the above code, alongside "direwolf" and "brown_wolf"
I should mention that it appears all three of these seem to reference/share the same set of animation files, and a black_4x4.dds file.
Since they share it, and I was under the impression that importing into VFS only cared about unique filenames, I moved the animation files into a separate "Common" folder, for organization.

The above code, as it stands (along with the proper Unit code and Civ override code) works fine, and displays a unit. However, if I were to add the following:

Code:
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP</Type>
			<Scale>2.0</Scale>
			<Model>direwolf_dark.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP_2</Type>
			<Scale>1.2</Scale>
			<Model>direwolf.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>
	<ArtDefine_UnitInfoMemberInfos>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_WOLF_PUPS</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WOLF_PUP</UnitMemberInfoType>
			<NumMembers>4</NumMembers>
		</Row>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_WOLF_PUPS</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WOLF_PUP_2</UnitMemberInfoType>
			<NumMembers>6</NumMembers>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>

...it does not display the "second group" of 6 units. It continues to display the first group fine, without any problems. (Code section edited down to only display relevant changes.)

Now, it seems to get weirder. I created a second Unit, one to replace the Swordsman, and I accomplished this by more or less copying the previous code, and editing the appropriate sections to make it unique.

Code:
	<ArtDefine_UnitInfos>
		<Row>
			<Type>ART_DEF_UNIT_WOLF_PACK</Type>
			<DamageStates>1</DamageStates>
			<Formation>DefaultCavalry</Formation>
		</Row>
	</ArtDefine_UnitInfos>
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PACK</Type>
			<Scale>3.0</Scale>
			<Model>direwolf_dark.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>
	<ArtDefine_UnitInfoMemberInfos>
		<Row>
			<UnitInfoType>ART_DEF_UNIT_WOLF_PACK</UnitInfoType>
			<UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WOLF_PACK</UnitMemberInfoType>
			<NumMembers>6</NumMembers>
		</Row>
	</ArtDefine_UnitInfoMemberInfos>

This is now referencing the same model that the Warrior -- which is working -- uses. However, when spawning one into the world.. It appears as a Swordsman!

I thought, perhaps I shouldn't use the same model. So I changed it to use one of the other (now unused) models: just the plain "direwolf" model.

Code:
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PACK</Type>
			<Scale>3.0</Scale>
			<Model>direwolf.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>

Unfortunately... this also fails! The Swordsman is spawning with the Swordsman model, without a wolf to be seen.
Maybe this model doesn't quite work? I tried changing the Warrior then, to use "direwolf" instead of "direwolf_dark"

Code:
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP</Type>
			<Scale>2.0</Scale>
			<Model>direwolf.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>

But of course..this one works. Although, if I added in the previously-working direwolf_dark to it..

Code:
	<ArtDefine_UnitMemberInfos>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP</Type>
			<Scale>2.0</Scale>
			<Model>direwolf.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
		<Row>
			<Type>ART_DEF_UNIT_MEMBER_WOLF_PUP_2</Type>
			<Scale>2.0</Scale>
			<Model>direwolf_dark.fxsxml</Model>
			<MaterialTypeTag>CLOTH</MaterialTypeTag>
			<MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
		</Row>
	</ArtDefine_UnitMemberInfos>

...results in the "direwolf_dark" failing to render this time, while "direwolf" renders properly!

Argh! I don't know what else to do.

In summary, not only will a second model not render, it won't even render any models on a second unit, even if it references the same model used by a working unit!

Any ideas? Am I right in thinking that all the models sharing the same animation files is to blame?
 
Bumping this up a bit, if anyone has any ideas..

I just tried changing all of the model's animation files to use a unique name (and copied in appropriately renamed files into its folder for import) in the fxsxml, but it still isn't working.

I am well and truly out of ideas now.
I don't even understand why I can't use the same model, which works for one unit, for another unit.

Edit:
Browsing of the Civ5DebugDatabase shows me that all my Unit ArtDefine data has been successfully inserted into the database (and no errors in the database.log) ... the game is just refusing to use it, for some reason.
I don't have knowledge of where else to get logging data related to this to continue searching..
 
Jesus, if this has gotten you stumped, I am quite frightened!

Please let me know if there's anything I can help with; This is quite aggravating, but I'll keep trying whatever else I can think of in the meantime.
 
Your code looks fine to me; the only thing I can think of without seeing all of your files and testing it myself is a noob mistake that I still often make: Did you check the Reload Unit System checkbox in ModBuddy?

 

Attachments

  • Reload Unit.jpg
    Reload Unit.jpg
    21.8 KB · Views: 320
Thanks for dropping in, Nomad or What!

Yes, Reload Unit System is indeed checked for my mod.
In fact, all of them are checked, since I have stuff affecting each of those systems.
I know it does work, because at least the Warrior replacement appears properly, even if the game only displays the first "group" and ignores the others. What I can't seem to do is to get the game to use more than one model, or even to use the same model for more than one unit replacement.

If you would like, I can PM you a copy of my mod for testing as well. I think I've just about tried every conceivable combination I can think of.
 
Thanks for dropping in, Nomad or What!

Yes, Reload Unit System is indeed checked for my mod.
In fact, all of them are checked, since I have stuff affecting each of those systems.
I know it does work, because at least the Warrior replacement appears properly, even if the game only displays the first "group" and ignores the others. What I can't seem to do is to get the game to use more than one model, or even to use the same model for more than one unit replacement.

If you would like, I can PM you a copy of my mod for testing as well. I think I've just about tried every conceivable combination I can think of.

Please do; it seems to me as though it should work. I looked at Civitar's .gr2 and .fxsxml files and they appear fine, so I would like to test it myself. I do this type of thing often enough that if/when I run into a problem like this I will know how to correct it if it can be solved.
 
Thank you for your offer of assistance!

I have sent you a PM with my mod package.

I'll have to admit that this is the first time I'm messing with units, so I wasn't quite sure how everything worked to begin with, but I assumed Civitar's stuff was fine, and that I would be okay with editing the fxsxml file. Unfortunately, nothing has worked thus far.
 
I've tried a few other models with imported Civ4 animations, and they all seem to suffer from the same behavior. This wasn't previously the case, so it must have been a side effect of a patch at some point. Once one of these models occurs in a given formation, no other units that follow it are visible... I've also tried the Scorpions and the Highlanders.
 
Hmm, that is interesting.. Though, the game's stock Warrior unit is still defined with three groups, so I'm not sure why that one works if this is the case.

Code:
  <ArtDefine_UnitInfoMemberInfos>
    <Row>
      <UnitInfoType>ART_DEF_UNIT__WARRIOR</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WARRIOR_V2</UnitMemberInfoType>
      <NumMembers>3</NumMembers>
    </Row>
    <Row>
      <UnitInfoType>ART_DEF_UNIT__WARRIOR</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WARRIOR</UnitMemberInfoType>
      <NumMembers>6</NumMembers>
    </Row>
    <Row>
      <UnitInfoType>ART_DEF_UNIT__WARRIOR</UnitInfoType>
      <UnitMemberInfoType>ART_DEF_UNIT_MEMBER_WARRIOR_V4</UnitMemberInfoType>
      <NumMembers>3</NumMembers>
    </Row>
  </ArtDefine_UnitInfoMemberInfos>
  <ArtDefine_UnitMemberInfos>
    <Row>
      <Type>ART_DEF_UNIT_MEMBER_WARRIOR_V2</Type>
      <Scale>0.140000000596046</Scale>
      <Model>Assets/Units/Warrior/Warrior_V2.fxsxml</Model>
      <MaterialTypeTag>CLOTH</MaterialTypeTag>
      <MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
    </Row>
    <Row>
      <Type>ART_DEF_UNIT_MEMBER_WARRIOR</Type>
      <Scale>0.140000000596046</Scale>
      <Model>Assets/Units/Warrior/Warrior.fxsxml</Model>
      <MaterialTypeTag>CLOTH</MaterialTypeTag>
      <MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
    </Row>
    <Row>
      <Type>ART_DEF_UNIT_MEMBER_WARRIOR_V4</Type>
      <Scale>0.140000000596046</Scale>
      <Model>Assets/Units/Warrior/Warrior_V4.fxsxml</Model>
      <MaterialTypeTag>CLOTH</MaterialTypeTag>
      <MaterialTypeSoundOverrideTag>FLESH</MaterialTypeSoundOverrideTag>
    </Row>
  </ArtDefine_UnitMemberInfos>

As well, I believe we can put my secondary issue of the Swordsman not rendering as Wolves to the solved pile. Apparently, in my desperation to get the grouping thing working last night, I went a bit overzealous in my copy/pasting from the stock files, and overwrote my Unit's UnitArtInfo definitions back to the stock art defines. I was trying to copy the Icon Atlases, and I kind of blanked out when I read "UnitArt-- okay this should be part of it."

Fixing this (thanks for the catch, Nomad or What!) allows the other units to render properly.

Nutty: Is your conclusion with your discovery, then, that having multiple "sub models" within one unit formation is no longer possible?

I will have to check this as well, since I believe there is another mod I have whose unique unit is comprised of two different models. I'll see if that one still renders properly or not.
 
Nutty: Is your conclusion with your discovery, then, that having multiple "sub models" within one unit formation is no longer possible?
It seems to apply only to [some] units with custom animations.
 
Ahh.. that must be it then.

The other mod's multi-model unit loads fine, and I can visually see that it is comprised of two different units, but checking the fxsxml files shows that they are using animation files from the Archer and Composite Bowman.

Well, damn. That kind of sucks.

I'll have to rethink how to create some diversity within these unit groups then.
 
Yeah, I'll agree with that.. fixing stuff unnecessarily that doesn't really need to be fixed.

I do wonder though, and this is probably too much work just to test (and also outside my area of ability) what happens if you stripped out the wolves' custom animations and stuck some sort of stock animation into it instead, if that would allow you to render the subgroups again. judging by what Nutty has concluded, as well as my observation of the other mod's UU, I imagine it would work in that scenario, though.
 
Top Bottom