Difficulty Modding Existing Unit Formation Count

Barathor

Emperor
Joined
May 7, 2011
Messages
1,202
First, this is basically what I want to do.

I want to change MemberCount for Galleys (not Barbarian Galleys) from 2 to 1.

That's it. :D

But I'm having a lot of trouble with it, and my modification isn't being reflected in the game when I plop down the galley via Firetuner. I have everything else setup correctly besides the art defines. My unit is assigned ART_DEF_UNIT_GALLEY and I created a new entry for barbarian galleys which uses ART_DEF_UNIT_BARBARIAN_GALLEY. UNIT_GALLEY is set as the default unit for UNITCLASS_GALLEY and UNIT_BARBARIAN_GALLEY is added to the UnitClassOverrides for the Barb Civlization under UNITCLASS_GALLEY.

It all works out well... it's just that my normal galley graphics are still showing 2 boats! Why was this ever set to 2, all other naval units are 1... if this was just 1 like everything else I wouldn't have to worry about any of this ArtDefines stuff. :sad:

  • I copied the contents of the entire Civ5ArtDefines_Units.xml file and pasted it into a new XML file within my mod. I also copied the name over too so it's an exact replica. I did this because I read that it isn't fully integrated into the database since it isn't using the <GameData> field.
  • I made my modifications to the <MemberCount> element under certain units and saved it (simply changing the number). Also, for units with a MemberCount of 1, I deleted the line which specified a Formation.
  • I added Civ5ArtDefines.xml to my project's Actions using OnModActivated>UpdateDatabase. Also, if it even matters, I made it first on the list.
  • I checked "Reload Unit System" under the project's "Mod Info".

Am I missing anything?

I also set "Import into VFS" to True for the file. I also even added Civ5ArtDefines_UnitMembers.xml to the project (even though I'm not changing anything within it) and also set its VFS setting to True. Still no luck.
 
you can't use Civ5ArtDefines xml files directly since patch .674, you now must update the DB using XML or SQL

Here's the SQL version for your mod (code must be in a .sql file with OnModActivated/UpdataDatabase and VFS to false):
Code:
UPDATE ArtDefine_UnitInfoMemberInfos SET NumMembers = 1 WHERE UnitMemberInfoType = 'ART_DEF_UNIT_MEMBER_GALLEY';
 
Thank you!! I really appreciate your help. I actually like this new method a lot more; very nice. :)


If anybody else wants to add this galley to their mods, the graphics and everything are already within the default game. You just need a portrait. If anybody likes this one I created, feel free to use it. :)

galleybarb.png
galley.png
galley%2520model.png
 
I wasn't aware there is a Galley graphics without the pirate skull available, thanks for letting us know :)
I like the portrait you made, can you give it to me in .dds format? I'm completely inept when it comes to working with these files...
 
I checked it and the Galley graphics is used for embarked units in early eras, that's why it shows 2 ships instead of 1. So to use both the Galley (single ship) and embarked graphics (two ships), you need to create a separate Unit Art Define, with the same members, but a different number of them.
 
D'oh! Thanks for letting me know, PawelS. I knew it was too good to be true... I thought it was a leftover remnant. Just when I thought I could go full steam ahead with my project. :(

I certainly don't want to change the embarked unit numbers; I like to keep things consistent. So, I'll have to add an entirely unique Art Defines Unit and Unit Member.

I'm also a little bummed about the textures now. Perhaps I'll copy and rename Galley.fxsxml for the naval unit to use and I'll tweak the existing one for the embarked unit, while messing with a copy of galley_diff.dds.

Would anybody be kind enough to supply the code if it isn't too much? I suppose I'd name it ART_DEF_UNIT_BATTLE_GALLEY unless a better name can be thought of. Or at least, could I be pointed towards a good example that I can download and observe? I was told by a friend to check out Tiny Death Robots, so I suppose I'll start there.

I'm totally new to this SQL, and it seems like it has different tags; for example, MemberCount in the XML is NumMembers in SQL.

Also, PawelS, when I create the DDS atlas files I'll certainly upload them for you and others. It'll also include this icon which I'm using for a Fishing tech, which is also part of the mod if anybody wants to utilize it (fishermen/outdoorsmen may find that fish familiar, lol):

fishing2.png
 
Awesome, thanks again, William! This is a perfect template for this.

So, I guess SQL isn't really required. I guess it makes sense since it just get converted to SQL in the end anyway.

I'm still confused about the NumMembers tag, where does it come from? Because the XML files use MemberCount and when searching for NumMembers, I find nothing. Just curious, that's all; it doesn't matter what it is, as long as it works! :)
 
Because the XML files use MemberCount and when searching for NumMembers, I find nothing. Just curious, that's all; it doesn't matter what it is, as long as it works! :)
One more of Firaxis little naming joke I suppose...

It's NumMembers in the database, so use that tag, either in SQL or XML for update.

MemberCount is used in the DLC and base XML files (that you can't use or overwrite anymore), those files are parsed internally when the game is loading, before the main menu, I suppose the engine translate MemberCount to NumMembers then.
 
You can take a look at the database (Civ5CoreDatabase.db) in SQLite Manager to see the data structure used for the art defines.

I have the Fishing tech in my mod too, so if you upload that atlas it will be another thing that I can use :)
 
I decided that I want to try and edit the barbarian galley model instead, since it looks much more "battle ready" than the embarked galley model which is a bit too round and clumsy looking, lol. Plus, even though I was able to separate it from the embarked graphics and limit its formation count to 1 (thanks to whoward69's example that I edited), I can still see it causing a little bit of confusion amongst embarked units.

So, I copied my working files in ModBuddy and edited some tags (like the fxsxml file target). I also added the fxsxml file I edited (the old barbarian galley one) and set VFS to true. Same thing for the 2 DDS files I created off of the original barbarian galley one, DIFF and SREF (have no idea what SREF is for, though).

No luck, the galley was displayed as the barbarian one with the dark colors and skull flag. (I also read about gr2 files, perhaps I needed to add that as well and change the file named in the fxsxml file?)

Next, I tried following the instructions in this thread:
http://forums.civfanatics.com/showthread.php?t=392773

Using that application, when I tried to export a new gr2 file using the edited DDS file, it was saying that I needed some kind of animation file(s) and I couldn't figure out how to add them or what I even needed to add. (I really inept at this 3D model/textures stuff.)

Is that mainly what I need to do? Create a new gr2 file that uses the same 3D model (and animations and everything) but the new "skin" that I edited in Photoshop?

Also, if this is a piece of cake to anybody else, I'd really appreciate it if you could try this out. Attached is the DDS file I edited from the original barbarian galley (I'm just referring to the player galley as "battle" galley, and keeping the regular galley as the embarking model.) and also a preview image of the file below.

barbarian_galley_diff.png
battle_galley_diff.png
 

Attachments

Is that mainly what I need to do? Create a new gr2 file that uses the same 3D model (and animations and everything) but the new "skin" that I edited in Photoshop?

Exactly. For a simple reskin, all you need to do is make a copy of the vanilla .gr2, rename it, open it in Nexus Buddy v1.0a, change the material's BaseTextureMap to your diff (and, if applicable, the SREFMap to your sref). Save, and you're done. You won't need any of the other features of that tool for what you're doing.
 
Wow, success! Thank you. :)

I even messed with the alpha channels for the civ colors.

battle%2520galleys%2520preview.png


Now THOSE look like combat units! :D

At first the dds file wasn't working because I was saving it using the "palette" ARGB (256 colors + alpha) 8 bits per pixel option.

I then used DXT3 and it worked. Is that the correct option to use? It seems to work well, so I guess so. I kept reading that one should use no compression, and when I read the PDF manual of the Nvidia plugin, it says DXT1, DXT3, and DXT5 are all compressed formats, with DXT3 having a compression ratio of 4:1. :confused:

Ah well... at the end of the day, it works. :lol:
 
Those look great!

I then used DXT3 and it worked. Is that the correct option to use?
My understanding is for best results, use DXT1 where there's no alpha channel, DXT3 for limited alpha, and DXT5 for alphas that require lots of antialiasing (e.g., circle icons)
 
Back
Top Bottom