1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

New improvement art! You don't need to replace civ5artdefines_landmarks.xml

Discussion in 'Civ5 - Creation & Customization' started by Pazyryk, Jan 15, 2012.

  1. TheChanger

    TheChanger Chieftain

    Joined:
    Jul 2, 2010
    Messages:
    281
    Gender:
    Male
    Location:
    Australia
    Awesome! you NEED to do a comprehensive tutorial on how to do this!
     
  2. Pouakai

    Pouakai It belongs in a museum. Moderator

    Joined:
    Jun 16, 2010
    Messages:
    7,151
    Location:
    Aotearoa
    You read my mind - Coffee was exactly what I was thinking! Please release a tutorial for this!
     
  3. Hypereon

    Hypereon He was a Consul of Rome!

    Joined:
    Jun 19, 2012
    Messages:
    414
    Location:
    Helsinki, Finland
    Great! I have already been thinking to make a mod that would add some extra luxuries like Amber (recolor of pearls), Cocoa and Tea.

    If I'm not wrong - the more complex luxuries, like Spices, are done with simple 2D pictures of bushes/trees, so in theory, it should be possible to make any shapes of trees to the game by simply changing the 2D art, without any 3D modeling. Maybe with further research we could even add new terrain types and features in the game somewhere in the future...
     
  4. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    It's actually quite simple once you figure it out. What I did was mostly based on Pazyryk's method for adding new landmark graphics:

    The first step is to create a .sql file to add your resource to the database, and then add both a ArtDefine_LandmarkType entry for your custom resource (ArtDefine_LandmarkType entries define which resources and improvements can be used for the ArtDefine_Landmarks entries properly speaking):

    Code:
    INSERT INTO ArtDefine_LandmarkTypes (Type, LandmarkType, FriendlyName)
    SELECT 'ART_DEF_RESOURCE_LUBORIC', 'Resource', 'Luboric' ;
    

    Now, you have to add the ArtDefine_Landmark entries. These entries define how your resource will look when unimproved, or in each era and state (under construction, constructed and pillaged) of improvement. So now add in your .sql file the ArtDefine_Landmark entry for your unimproved resource:

    Code:
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Any','Any',1.0,'ART_DEF_IMPROVEMENT_NONE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','luboric.fxsxml',1 ;
    Set the Scale, LayoutHandler and TerrainContour according to the resource you're basing your new resource on. We still need to add entries for your improved resource according to state and era:

    Code:
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Ancient','UnderConstruction',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','hb_med_luboric_mine.fxsxml',1 ;
    
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Ancient','Constructed',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','med_mine_luboric.fxsxml',1 ;
    
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Ancient','Pillaged',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','pl_med_mine_luboric.fxsxml',1 ;
    
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Industrial','UnderConstruction',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','hb_ind_luboric_mine.fxsxml',1 ;
    
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Industrial','Constructed',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','ind_mine_luboric.fxsxml',1 ;
    
    INSERT INTO ArtDefine_Landmarks (Era,State,Scale,ImprovementType,LayoutHandler,ResourceType,Model,TerrainContour)
    SELECT 'Industrial','Pillaged',1.0,'ART_DEF_IMPROVEMENT_MINE','SNAPSHOT','ART_DEF_RESOURCE_LUBORIC','pl_ind_mine_luboric.fxsxml',1 ;
    
    Firaxis' comments in the artdefines_landmarks.xml says that order is important - and every entry that I saw used that same order: first the unimproved entry, and then in order ancient under construction, ancient constructed, ancient pillaged, industrial under construction, industrial constructed and industrial pillaged. So, I used that same order for these entries.

    While the resource .fxsxml files are similar to those of units, there seems to be some important difference in their .gr2 files, since I couldn't get a unit model to show up as a resource. As you can see, I've added one .fxsxml reference for each of those entries.

    Code:
    <Asset>
      <Mesh file="luboric.gr2"/>
      <Texture file="Stone_ore_Decal_H.dds"/>
      <Texture file="Generic_Grey_8.dds"/>
      <Texture file="luboric_decal_diff.dds"/>
      <Texture file="luboric_ore_diff.dds"/>
      <Texture file="Copper_ore_SREF.dds"/>
      <Texture file="Unit_Environment_Dull.dds"/>
      <Texture file="Unit_Environment_Sharp.dds"/>
      <Texture file="Unit_Irradiance.dds"/>
    </Asset>
    
    These are the contents of my luboric.fxsxml file. What I did here was, after I unpacked the game's art assets with Nexus, I copied the fxsxml for copper, and then change the reference of the mesh from copper.gr2 to luboric.gr2, and from copper_decal_diff.dds and copper_ore_diff.dds to luboric_decal_diff.dds and luboric_ore_diff.dds. Then, you have to copy the copper.gr2, copper_decal_diff.dds and copper_ore_diff.dds from the game's art assets, and then rename them accordingly. Now what I had to do was first recoloring the .dds textures, and then changing the references in the luboric.gr2 to actually make use of them.

    To change the .gr2 texture references, I used the older version of IndieStone NexusBuddy which bernie14 linked to in this tutorial thread of his. Then, I opened the luboric.gr2 with it, and changed the references to copper_decal_diff.dds and copper_ore_diff.dds to their luboric counterparts. Now, this is important, the texture reference will look like this:

    Code:
    D:\projects\artdev\Civilzation5_DLC_Expansion\Buildings\Resources\Copper\maps\Copper_Decal_DIFF.dds
    You have to replace all of that with just your custom texture's file name, in this case luboric_decal_diff.dds.

    Naturally now, all you have to do to make your custom resource work is to make a .xml resource entry which makes use of the new art, and make your resource be spawned by AssignStartingPlots.lua.

    Don't forget, when packing all this in your mod, to check the "Reload Landmark System" option, or the new resource art will not show up.

    I hope this helps :)
     
  5. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    What you're saying sounds about right. This is the spices texture, for instance:



    I changed the color of the fruits of the spice texture to a coffee-like color, and made the plant be not as light as the spice plant, and these were the results:



    Since in this case only the fruits suffered a significant recolor, I'm not sure if the resource graphic would be distinctive enough from the spice one.
     
  6. Pouakai

    Pouakai It belongs in a museum. Moderator

    Joined:
    Jun 16, 2010
    Messages:
    7,151
    Location:
    Aotearoa
    You mentioned scale earlier - would it be possible to change the scale of the trees?
     
  7. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    I haven't actually experimented with it, but I assume that changing the "Scale" setting in the ArtDefine_Landmark entries would work. One issue with that, though, is that in the case of the improved resource graphics, the scale of both the improvement and the resource would be changed.
     
  8. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,156
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Sure; it's a simple change to Androrc's code. Each time he updates ArtDefine_Landmarks, you'll see the third entry is Scale (where he's placed 1.0).

    EDIT:
    Hi Androrc, you replied at the same time. I can confirm it works (you'll notice Smaller Landmarks in my sig, mentioned in post #48 of this thread--though I haven't tested it since G+K came out).

    EDIT #2: It works for most of the new landmarks, but I'll put up a new version so everything is included.

    EDIT #3: Updated. Now it's only three lines of SQL; I could have made it 1.
     
  9. 3335d

    3335d CCtP Player

    Joined:
    Jun 15, 2012
    Messages:
    642
    Would it be possible to create entirely new resources, with 3D models not based on existing ones? That would be exciting, although I have no idea how to make these excellent art assets which the community has made, and I'm limited in the amount of modding I can do on a Mac.
     
  10. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,045
    Location:
    San Diego, California
    Were you able to get your recolored copper to generate on the map? IIRC the map scripts cant handle adding new resources.
     
  11. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    I see no reason why it wouldn't be possible.

    Yes, that is done through AssignStartingPlots.lua.
     
  12. TheChanger

    TheChanger Chieftain

    Joined:
    Jul 2, 2010
    Messages:
    281
    Gender:
    Male
    Location:
    Australia
    i love you! :D
     
  13. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    Slight addendum: if you want new resources to be added to a randomly generated map, then yes, you have to change AssignStartingPlots in several areas (both in creation of deposits AND the setting of quantities). WorldBuilder maps don't need this, of course.

    However, your mod will be incompatible with any map that includes overrides to the resource quantity subroutines of AssignStartingPlots. In the core game, that's the Highlands, Great Plains, and Lakes maps. My own mod had this issue, since my future content includes three custom map-placed resources, so I'd made alternate versions of these three map scripts that removed the resource quantity overrides.
    It's just something to keep an eye out for; most maps will still work just fine. It's just those few that have problems.
     
  14. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    Thanks for the heads up :) What problems do those maps create? Just not placing the new resources?
     
  15. Putmalk

    Putmalk Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    2,623
    Location:
    New York
    Quick question: Are resource graphics even 3d? To me stuff like the forests look 2D to me (a very common method of developing graphics in games where you're not actively close to the objects).
     
  16. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    It depends; the mineral and animal resources seem to be all 3D, but the plants seem to be 2D.
     
  17. TheChanger

    TheChanger Chieftain

    Joined:
    Jul 2, 2010
    Messages:
    281
    Gender:
    Male
    Location:
    Australia
    Ok so ive pretty much got everything for my resource done, but i cant for the life of me find a reliable download for grannyviewer, and that indiestone nexusbuddy dosnt work. anyone have an idea what i can do :confused: ???
     
  18. TheChanger

    TheChanger Chieftain

    Joined:
    Jul 2, 2010
    Messages:
    281
    Gender:
    Male
    Location:
    Australia
    ok so i found a granny 3d viewer, but it cant load textures! i downloaded blender in the hopes that there would be a gr2 plugin for it, but to no avail.

    also a question about the fxsxml files, is it right that i should have 7 files for one resource? one for the unimproved resource and 6 for the various stages of improvement?

    do the fxsxml files need to be VSF true? and/or should i put them in the mod actions list onModActivate UpdateDatabase?

    :confused: this is far more difficult than civ 4 :/
     
  19. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    Unfortunately, the only tool that I know that can easily change the texture references in .gr2 files is IndieStoneNexusBuddy.

    Correct.

    Yes. You also need to activate "Reload Landmark System" in your mod's properties.

    If you upload your files, I could take a look at them.
     
  20. TheChanger

    TheChanger Chieftain

    Joined:
    Jul 2, 2010
    Messages:
    281
    Gender:
    Male
    Location:
    Australia
    do you have a working version of indiestonenexusbuddy that you could upload? because i downloaded it 3 times but it dosnt work :/

    otherwise im completely at a loss as to what to do. i could upload my files fo you to look at and fix, but id still need to be able to do it myself.... i have a *lot* of resources i need to mod lol.
     

Share This Page