How to add Civilization icons to the Loyalty lens
If you are making a custom civilization, you may have noticed that the icon for it does not show up on the loyalty lens by default, even though the icon you have made for it shows up everywhere else it should. This tutorial will show you how to fix that.
What you need:
⦁ Civilization VI SDKOf course, you also need to have already created your civilization and an icon for it before you begin worrying about having that icon show up on the loyalty lens.
⦁ Civilization VI SDK Assets
⦁ An image editing program (such as GIMP or Photoshop)
Step 1: Gather your files
First you will need to copy appropriate files from the SDK Assets to use as your template. You will need the following files:
⦁ From the folder "Sid Meier's Civilization VI SDK Assets\Civ6\DLC\Shared\pantry\Assets" you will need the files "Loyalty_Overlay_America_Box.ast" and "Loyalty_Pressure_America_Box.ast" (you can use any civ, it doesn't have to be America, but that comes first alphabetically so that is what I used). Copy these files into the Assets folder of your mod.
⦁ From the folder "Sid Meier's Civilization VI SDK Assets\Civ6\DLC\Shared\pantry\Materials" you will need the files "Loyalty_Overlay_America_material.mtl" and "Loyalty_Pressure_America_material.mtl". Copy these files into the Materials folder of your mod.
⦁ From the folder "Sid Meier's Civilization VI SDK Assets\Civ6\DLC\Shared\pantry\Textures" you will need the files "Loyalty_Overlay_America.dds" and "Loyalty_Pressure_America.dds". You won't copy these to your mod, but instead to whatever folder you keep the art assets you are making from your mod. These files will not be modified, but just used as a go-by to guide you on how to create appropriate icons for use on the loyalty lens.
Step 2: Create your icons
Since you have already created the icon for your civ, creating the loyalty overlay and loyalty pressure icons for it should be relatively easy. Use the two files you copied from the SDK Assets as a go-by to guide you on the size and look of the two icons you need. When you are done, you should have a 512x512 dds image for the loyalty overlay icon called "Loyalty_Overlay_YOURCIV.dds" and a 128x128 dds image for the loyalty pressure icon called "Loyalty_Pressure_YOURCIV.dds".
Step 3: Create your material files
Now that you have the images for your icons, the next step is to create the material files. Fire up the Asset Editor and open the two material files you copied from the SDK Assets into your mod folder. All you need to do to make these files work for your new civ is to rename them appropriately, add the appropriate image (overlay for overlay, pressure for pressure) as a new texture (first button - see screenshot below), and then save. Once you are done you should have two material files: "Loyalty_Overlay_YOURCIV_Material.mtl" and "Loyalty_Pressure_YOURCIV_Material.mtl". You will also still have the original "Loyalty_Overlay_America_material.mtl" and "Loyalty_Pressure_America_material.mtl" files in your mod folder, and you can delete them now (there will be no errors if you don't delete them, but it might clutter your workspace).
Step 4: Create your asset files
Once the material files have been created, it is time to create the asset files. In the Asset Editor open the two asset files you copied from the SDK Assets into your mod folder. Making these files is similar to making the material files: all you need to do is rename the files appropriately, add the appropriate material file you just created (second button - see screenshot below), and then save. Once you are done you should have two asset files: "Loyalty_Overlay_YOURCIV_Box.ast" and "Loyalty_Pressure_YOURCIV_Box.ast". You will also still have the original America files in your mod, and you can delete them now.
Step 5: Create your XLP file
Now that you have your asset files, you need to bring them into your mod with an XLP file. Create an XLP file (File > New > XLP), and once the blank file is created select "UILensAssets" from the "XLP Class" dropdown. Then fill in a package name (such as "UILensAssets") and save the file to your mod folder (in my example I called it "UILensModels.xlp"). Once this is done all you have left to do on this step is to add the asset files you created in Step 4 via the "Add Existing" option in the "Entries" tab. If this is done correctly, you should see your two asset files show up in the "Entries" list. The XLP is now done, so save it and we will discuss how to get it working in a later step.
Step 6: Create your ArtDef file
Now that your assets have been added to your mod via the XLP file, it is time to define what these assets are used for using an ArtDef file. Create a new ArtDef file (File > New > ArtDef) and set the Template to "Overlay" from the dropdown. Once the overlay template is set, save the file to your mod (in the example I called it "Overlay.artdef").
You will see that the template has created a folder tree for you. Right-click on the "Overlays" folder and select "Add Element". Rename this new element "LoyaltyLensArrows". This is where the loyalty pressure icons will be defined. You will notice that a folder tree has been generated for this new element. Right-click on the folder "LensModel" and select "Add Element". Clicking on this element you should see two fields - Name and Value. In the name field rename this element after your civilization so that it has the same name as your civilization's type tag (eg CIVILIZATION_YOURCIV). Then under the Value field where it has an entry for "Base Model" click "Browse" and add the pressure asset for your civ (Loyalty_Pressure_YOURCIV_Box.ast). If you are adding more than one civ in your mod you will continue adding elements in the "LensModel" folder here like this for each new civ. Otherwise, collapse the "LoyaltyLensArrows" tree, as we are done with it.
Next create a new element in the "Overlays" folder and call it "LoyaltyWarning_CIVILIZATION_YOURCIV". This is where the loyalty overlay icon for the specific civ will be defined. You will notice that a folder tree has been generated for this new element. Right-click on the folder "LensModel" and select "Add Element". In the Name field rename this element "LensModel" and in the Value field add your base model (Loyalty_Overlay_YOURCIV_Box.ast) like before. Any additional civs will be added in the same manner, with new entries in the "Overlays" folder. When you are done adding civilizations, save your ArtDef file.
Step 7: Editing your mod Art.xml file
If you created your mod in ModBuddy it should have auto-generated an art.xml file for you, which you will probbly have already edited when adding other ArtDefs to your mod to create your civilization. To add the files you have created in this tutorial to get everything to work, you will need to make the following additions to your mod art file.
Add the "Overlay.artdef" file to the "relativeArtDefPaths" of the elements "UILensAsset" and "Overlay" (see screenshot).
Add the "UILensAssets.blp" file to the "relativePackagePaths" of the element "UILensAsset" (see screenshot).
And that's the last step. Now when you build your solution and run your mod you should see the icons for your new civilization show up on the loyalty pressure lens.
If you have any questions, feel free to ask. And if you know more about this topic than I do and have something to add, please let me know. I couldn't find sufficient info on how to do this beforehand, so I had to figure it out myself and may have made errors in the process (it works, but may not be the most efficient way to do this). Thanks for reading!