Adding (Not replacing) Custom Icons

Hey there all!

I am currently working on a mod and I am trying to find a way to add in custom icons for units, techs, and buildings. I’m starting to wonder if it is even possible without completely rehauling the way that the .JSON files “talk” to one another. I know that replacing icons in the game is possible, as I have done that already, but the whole idea is to be able to add in your own. Working with the file “icons.json” seems to be in the right direction, but modifying the file does nothing because the game’s original “icons.json” file gets loaded instead, no matter the case.

I know that I can’t be the only person having an issue with figuring this out… I created this thread in hopes that I, and other people wondering the same thing, can discuss, collaborate, and perhaps find a workable solution.

Maybe one of you reading this has figured it out already and knows how to do it? (I hope!)


Maybe depends on priority, put your mod first.

The mod I’m working on locally is always prioritized to the top of the list, unless I decide to play multiplayer and need to prioritize others… so unfortunately that can’t be the case. Thank you for the input/suggestion though!

Try publishing it then and then prioritizing.

I gave it a shot and loading the mod as subscribed instead of locally didn’t seem to make a difference. The game simply will not read “icons.json” from the directory of a mod. My file path is identical to the game’s FYI, so there couldn’t be an issue with that… I even tried to only include my changes in the “icons.json” file (similar to how you mod strings) , but that was a no-go as well… there must be a way to do this!

If you want to add your own icons in the campaigns,ask me and you can have the solutions.

EDIT: The file “icons.json” does in fact get loaded by the game through a mod directory. I emptied all the content from the file, and the game showed no icons for anything when I tested it. Therefore it is reading the file, but not reading any additional modifications to it. (i.e. in that file, for buildings, there are 83 references to icons, and when I attempt to add an 84th and point it to the .DDS file of my custom icon, the game can’t/won’t read that.)

there are limitations, but you can add your own icons in the game. it is too much to explain but basically you change icons.json and materials.json

you can see how it’s done through my mod, but like i said there are limitation of how many you can add.

Thank you for the reply, I am going to take a look at your work and see what I can figure out. In the mean time, I am wondering what you mean by limitations… I suppose I’ll find out lol.

the limitation for building seems to be 5 to 6 more icons, while technologies maybe 15-20 can’t remember. units so far has no limitation yet. the limitation I am talking about is rather specific and may not have issue for units in game, but in techtree they give me headache and its an annoying problem to deal with.

@thieftdp8498 So I took a look at your mod and started to work on my own following what you did, because you have obviously figured it out, which is awesome! Thank you!

I am having issues getting my mod to load the icon still however. In “materials.json”, you need this (example):

                      "MaterialDef":  {                                              
                                          "Name":  "BuildingIcons101TradeW",                                              
                                          "Type":  "Atlas",                                              
                                          "Blend":  "AlphaPlayerColor",                                              
                                          "AtlasRef":  "ingamebuildings",                                              
                                          "TextureRef":  "BuildingIcons101TradeW"                                          

And then you need this code snippet to reference the .DDS file of the icon:

						"RefName": "BuildingIcons101TradeW",    
						"FileName":  "textures/ingame/buildings/",    
						"imageTLX":  "0.400195",    
						"imageTLY":  "0.875244",    
					        "imageBRX":  "0.499805",    
						"imageBRY":  "0.999756"

This is the file (materials.json) that the other file (icons.json) points to in order to find and load the .DDS files.

Either there is something I am still doing wrong, or the game is ignoring my changes for this specific file… I am trying to put an icon in the game for the Trade Workshop, similar to what you did, but it keeps loading the icon for the Market, even though I set the icon number in Genie Editor to the number I assigned the information in the json files, as well as the .DDS file itself.

Perhaps there was an edit in “materials.json” that I might have missed?

my only mistake is not realizing there might be a limitation, otherwise i’d start at buildingicons entry 084. theres also problem starting with 084 is that if dev makes a new building and takes away that slot, you would have to change it down the road.

in your case you are using 101, theres few things u need:

  • making sure your .dat file you have copied icon number correctly correspond to your entry number.
  • make sure your dds is saved as format “Uncompressed A8R8G8B8 (32-bit)”, I use slx studio to do this, I do not know other software and have no intention to try new programs right now.
  • the image must be 256 x 256 (as of 2 months ago), I use photoshop to make all image like this for icon, smaller or bigger i’d sometimes have problem not loading.
  • make sure your icon directory is correct, following my mod folder path you probably have no issue here, just checking.
  • BuildingIcons101TradeW needs to be present in icons.json as well, you have got the materials.json correct.
  • I believe (havent test this extensively), if you are using entry 101, you will likely need all the previous entry in there as well, which means original game ends with 083, you need to have entries in icons.json from 084 to 100 to exist, even if they dont yet exist in materials.json. if they dont, 101 will not show correctly.

honestly i have spent way too much time on this because no one to ask, if you entered your entries from 084 to 100 in icon.json and still doesn’t work, try having all entries exist in materials.json as well.

as you can see its a lot of work just copy/paste alone can take hours, start with 084 if you can.

edit: I just read your comment again I missed the part you mentioned “it keeps loading icon for market”.

you probably haven’t copy graphics/icon properly in your empires2_x2_p1.dat file. usually when you edit an unit icon, it defaults to gaia. you will need to copy it manually to the civ you want it to show up.

Thank you for your extensive reply @thieftdp8498! I am going to run through everything you mentioned, although I think I may have done everything the way that you said, other than that I use GIMP for image manipulation, which seems to work fine, as I have successfully replaced the icon for 008Fortress with a .DDS already.

It is a lot of work, especially modifying the json files, but anybody with any scripting experience at all could certainly figure it out. Everything you mentioned though I pretty much spent time on figuring out as well, it was the “materials.json” that I didn’t realize I needed.

I am going to triple check my work and see what I can do… thanks again for your perspective, it’s going to help a lot. For something so simple in-game, it’s a lot of work to modify lol.

My hope is that somebody else that was wondering how to do this will see this thread and learn from it as well!

I was using replacement method until I ran out of icons to replace lol then i discover the entries name duplicates in materials.json im glad they allow us to modify it.

the new futuravailableunits.json they added as of last patch (or 2 ago) can only be edited in original game path. meaning copy paste into the mod folder directory and edit it will have no effect, but edited version in core game path will show its effect in game.

hope they can allow futuravailableunits modded too in future.

@thieftdp8498 Yeah I was taking a look at that file before, I was wondering what it did…

Would you mind adding me as a friend on Steam? We could exchange tips and/or ideas, and I can continue to ask you questions without having to bump up this thread with every reply lol.

My steam name is High-Devinition

On the other hand this information in here might help someone else in the future :slightly_smiling_face:

@Yorok0 Of course! If anyone comes across this at some point and has any questions, post them here!

Could you share more on this with a few screenshots to explain how you did this? I want to add more units but the substitution method ran into problems when the Lords of the West DLC came up and some icons got overridden by the modded icons. :o:
We need to be able to add icons for units/buildings/techs without needing to do this.

Added you too :slight_smile: navinkumarpk