1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Rough Guide to Units.artdef

Discussion in 'Civ6 - Modding Tutorials & Reference' started by Deliverator, Nov 2, 2016.

  1. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    7,738
    Location:
    France
    @PlotinusRedux : then it's only database files that work this way.

    I suppose the Aztec "DLC" was a late decision and they just moved the definitions of something that was already done out of the base game.

    Else "disappointing" would not really be the word I'd like to use.
     
  2. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
    Yeah, it seems like the modding system is only partially implemented right now. I'm wanting to make some tools to help with conflicting mods, but in its current state what I'd come up with is a huge kludge that would work around the need to copy files into the main paths before starting the game in a way they're hopefully going to make unnecessary soon.

    What I could do now write an application where you'd basically select the mods you wanted to use before starting the game, and have it merge and copy all the files necessary for those mods then launch the game, but without knowing how the final modding system is going to work, it would have to be completely redone once they actually get modding fully implemented.

    I suppose really I just need to have some patience and wait on Firaxis, I just don't do patience well.

    It looks to me like they originally intended to implement the Aztec DLC as a mod, but the modding system just wasn't ready so they merged everything except the DB changes to the base files. Some dev created all those empty sub-folders under DLC\Aztec_Montezuma\Platforms for some reason.
     
  3. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    So from what i can gather, the "bodies" (armor) is what determines the animations. Are all heads/helmets/hats interchangeable?

    Am I correct in assuming that I would NOT be able to use the body of a Scythian Saka horseman along with a Hoplite's head using a swordsman's weapons and animation?
     
  4. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,007
    Location:
    London, UK
    I agree that's what it looks like.
    Yes, this is true from what I can tell so far. I can understand this to an extent because things like robes need to be rigged and animated if they're going to move realistically. Unfortunately it makes the armor models a lot less re-usable. I think the majority of units will still need some custom model rigging similar to Civ V.

    No, unfortunately quite a few of the hats used by Great People (e.g. Great Artist) and Unique Units (e.g. Conquistador) aren't interchangeable which again significantly limits options. :(

    For the reasons described above that wouldn't be possible - the closest you could get would be to put a Hoplite helmet on the Swordsman - you could choose with or without the yellow robe (which can't be dynamically recolored unfortunately).

    It feels like the attachment system is really set up for cultural variations in things like skin tone and hair color - which it handles quite well - rather than making new units out of existing parts. To really get a diversity of new units is going to require a similar process to Civ V to be available i.e. we can export the vanilla meshes and skeletons to a 3D art tool and then rig or re-rig then to different skeletons/animations. That's what it feels like at the moment anyway but we'll see what art tools Firaxis come out with.
     
  5. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    That sucks, although (my experience being Civ IV graphics modding) that isnt too terrible a proposition. Did you take a look at the files at all? Im sorry to ask you so much but i havent yet and im being lazy. Does it look like itll be as easy as Civ IV was?

    I never got into Civ V as much as i did IV, but im really digging VI right now and cant wait to start REALLY getting these graphics upgraded.

    Edit: once i get my feet wet you wont be alone in making units bro.
     
  6. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
    I wish there was some communication from Firaxis on when the modding code will be finished.

    I've been thinking, I could use a dll injection to trap calls to CreateFile() and force it to search active mod directories for .dep, .artdef, etc., and load those versions if present rather than the ones under Base\Assets, which would keep users from having to copy the files to Base\Assets. The problem is, all that seems to be loaded when the game starts, before you select what mods to use, so I'd have to have to have a screen to select what mods to use before the main game launches, which I could do by shelling to the game or also in the injected dll--though of course since saved games save what mods were used with them, you'd have to select the ones used by a saved game before loading that saved game, and exit Civ and select different ones before loading a saved game with different mods loaded....

    They're going to have to implement a function to reload all that stuff after the mods have been selected. It may already exist in the code, which means I could call it from my injected dll, but finding anything in the disassembly is a pain because of all the C++ virtual function tables, and they seem to have made nearly every function virtual--it would take me a week to interpret them enough to find it, and of course it would move with the next patch.

    Still, I'd actually do a dll injection kludge if I knew it was going to be 2+ months before they get modding to a state where it isn't needed--but I don't want to put in the work and get people to use it if a fix from Firaxis is imminent.
     
  7. raen

    raen Coat of Arms

    Joined:
    May 12, 2003
    Messages:
    1,856
    Location:
    Portugal
    I made this very Rough Tool (windows only for now) to copy your custom stuff and maintaining originals.

    You simply use install to add has many times you want, and uninstall when you dont want your mod stuff.

    Add lines to install and uninstall with your custom files.
     
  8. Mynex

    Mynex Chieftain

    Joined:
    Sep 30, 2010
    Messages:
    287
    Couldn't you write your program to read the previous logs to determine which mods where active last session and use that? Or perhaps use the modinfo files themselves that are present in the mod folder?

    I realize that presumes the user has the mod enabled (or rather wants it enabled), but it might be a starting point...?
     
  9. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
    I can read the Enabled column in the Mods table in Mods.sqlite to see what they had enabled the last time they ran the game, but they'd have to exit the game when they changed what mods were enabled--which really they'd have to do anyway since the artdef stuff is only loaded when the game starts.

    That doesn't help with loading saved games that used different mods then the ones currently enabled, though. But it looks like I could have users select a save game before Civ 6 launches (via a shelling app or dll injection), parse the saved game file to determine what mods where loaded, then trap the read of AppOptions.txt to force the "PlayNowSave" line to point to the saved game file they selected. I've verified putting the name of a saved game after "PlayNowSave" really does cause it to go straight to loading that file, though I can't imagine what their intention for that setting was (who would want to force loading a specific saved game in their config file?), and I haven't tested it with multiplayer.

    It's all very kludgy, though.
     
  10. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
    Yeah, I verified, "PlayNowSave" doesn't work with multiplayer saves.

    Otherwise, something less kludgy then people having to manually copy artdefs in and out (even using a .bat) would be a mod launcher, an app you'd run where you'd select the mods you wanted to use or the saved game you wanted to load, which would then auto-merge any conflicts and copy any necessary files over the base ones, set the Enabled column in mods.sqlite for the mods you selected, then launch the game, using PlayNowSave if you had selected a saved game to load. Basically it would replace the in-game mods selection with a pre-game mods selection that automated everything needed for the mods to actually work.

    I've got most of the elements needed for that already written in the tool I'm working on--I'm searching the mods folder for .modinfo files and completely parsing them, comparing any ImportFiles conflicts between the mods, reading mods.sqlite to see if they're enabled, validating them against the .xsd I made, and for now just displaying all that info in a master-detail view with all the installed mods in a grid and all the properties, components, files, validation errors, etc., displayed in treeviews for the selected mod, with a difference view for imported files compared to the base versions and the 3-way merge code already written but not yet used in the tool. And I've looked at the saved game files enough to see how to parse out what mods they use.
     
  11. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
  12. PlotinusRedux

    PlotinusRedux Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    196
  13. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    I intend on making my foray into modding units by creating more culturally specific looking units. Hopefully I can sort this out. I am going to start with Poland. I remember reading somewhere that, in order to utilize art from a DLC I have to "call for" the art from that DLC (or something to that effect).

    Deliverator, since you have successfully done this with your mods I was wondering if you could maybe fill me in on what I would have to do to accomplish this? I would really appreciate it. In exchange I was thinking I could post my steps as I went along here so the community can see what exactly goes into it, this in turn could educate people and potentially expand the roster of active modders for Civ VI. If necessary I could start a new thread for this. Thoughts?
     
  14. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,007
    Location:
    London, UK
    @The Capo - Take a look at what I did with the recent update to the Hooves and Holy War extension mod. In the Cultures.artdef I added a new UnitCulture entry for the Norway Civilization to be "Viking" Culture. I could have used "Norse" or any other string. Then in the Units.artdef I have set up a variant of the Trader graphic with "Viking" Culture with the Reindeer towing the cart. For all other Units Norway will get the "Any" default cultural variant. If I wan't to add a "Viking" variant for the Swordsman the I could set things up in a similar way.

    Bear in mind that there are only eight "UnitCultures" in the vanilla ArtDefs (as opposed to "Cultures" which are used for Cities, Districts, Improvements etc by the look of it):

    EastAsian (Japan, China)
    Mediterranean (Greece, Rome)
    Mughal (Arabia, India, Sumeria)
    NorthAfrican (Egypt)
    NorthernEuropean (America, England, France, Germany, Spain(!?), Russia, Poland)
    SouthAfrican (Kongo)
    SouthAmerican (Aztec, Brazil)
    Barbarian (Barbarian)

    This means Norway and Scythia get the "Any" default Culture with regards to Units.artdef.

    All the cultural variations you see come from one of these 8 buckets. The means the value of creating new UnitCultures seems quite limited until we can import new Armors, Weapons, Helmets and Vehicles etc. But you may be able to eke something out of the vanilla elements as I have with Moar Units, by recombining and recoloring existing elements.

    A lot of the pain in working with Units.artdef is that it is so verbose for what it does. I've found XML Marker (linked in the OP) pretty much essential for working with it as I copy elements the .artdef files around and duplicate parts. If the SDK/Mod Tools don't come with something that makes working with the .artdef files then that would definitely be a good job for someone from the community to take on.

    If you want to use art from a DLC in your mod you need to have at RequiredGameArtIDs element in your .dep file that contains the name and id from the DLC .dep file like this:
    <RequiredGameArtIDs>
    <Element>
    <name text="VikingScenario"/>
    <id text="AAC38552-7662-47C6-9C3B-9A18977300A9"/>
    </Element>
    </RequiredGameArtIDs>

    The VikingScenerio is a special case too because it is restricted by RULESET which is why the extra step of editing the DLC .dep file is necessary.
     
  15. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    So I would have to include one for the Poland DLC too? So include the code you posted as well as the code for the Poland DLC as well?

    Is it also necessary to do the same for the Aztec DLC too? I read somewhere that the Aztec stuff is actually in the base game files, is this true?
     
  16. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,007
    Location:
    London, UK
    If you want to be explicit and control the load order of art defines then I would say yes. The Poland .dep is referenced like this:

    <RequiredGameArtIDs>
    <Element>
    <name text="DLC2"/>
    <id text="3809975F-263F-40A2-A747-8BFB171D821A"/>
    </Element>
    </RequiredGameArtIDs>

    which you can tell from the top of the DLC2.dep file.

    (I'm not actually doing this in my Poland extension pack because I've made the whole mod depend on the Poland DLC. This mod level dependency is specified in the .modinfo file
    <Dependencies> tag rather than the art dependency in the .dep file <RequiredGameArtIDs> tag.)

    All the Aztec .artdefs and art files are included in the base game so you can use them without requiring anything, whereas the Poland DLC does contain additional .artdefs and art files (blp files).
     
  17. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    Okay, thanks for your help. Last question: all I have to do is include those two bits of code and then i can reference all the artfiles from both DLC as usual?
     
  18. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,299
    Location:
    Washington, DC
    I just noticed this part. So I lied about the last question bit. Say I wanted to add a few new units, for instance an Axeman, Light/Heavy cavalry, Rifleman etc. And potentially a new civ or two would you recommend I did it this way instead, or would that be a requirement?
     
  19. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    4,007
    Location:
    London, UK
    If you include the RequiredGameArtIDs then your mod will be able to reference elements of the DLC .artdef files in your mods .artdef file. To use the VikingScenario art outside of the Viking Scenario itself. Hacking the coregame file is still required:

    A small edit is required to the VikingScenario.modinfo within the DLC folder changing the ModArt element as follows:

    <ModArt id="ART_COMPOMENT">
    <Properties>
    <RuleSet>RULESET_SCENARIO_VIKINGS</RuleSet>
    </Properties>
    <Items>
    <File>VikingScenario.dep</File>
    </Items>
    </ModArt>

    to...

    <ModArt id="ART_COMPOMENT">
    <Items>
    <File>VikingScenario.dep</File>
    </Items>
    </ModArt>

    In other words remove lines 106-108 from VikingScenario.modinfo. This is to allow the Viking Scenario unit graphics to be used by other mods such as this one.

    I would just require the RequiredGameArtIDs way unless you are planning to make gameplay updates to the entities added by the DLC. I made Even Moar Units: Poland require the Poland DLC because I was adding more units to Poland and it would not make any sense or actually work otherwise. If I was just using the Poland art for some new Civ I would have gone the RequiredGameArtIDs route.
     
  20. ReichAdler

    ReichAdler Chieftain

    Joined:
    Nov 4, 2016
    Messages:
    83
    Gender:
    Male
    Please do update with how you got the panzers in... A mountain of us are wanting custom units for our civs.
     

Share This Page

Ebates: Get Paid to Shop