• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days (this includes any time you see the message "account suspended"). For more updates please see here.

New Font Icon for Custom Strategic Resource?

Ricarius

Chieftain
Joined
Sep 16, 2015
Messages
20
Location
Orlando, FL
I've been having trouble finding a good tutorial or walkthrough on how to add a new font icon specifically for a custom Strategic Resource. The mod I've attached contains a resource that's pretty much working flawlessly, however now I remain unclear about the aforementioned problem. Anyone who could point me in the direction of a good and simple tutorial, or perhaps any of you could point out what specifically I'm doing wrong for the font icon, and how to fix it?

I will provide more info on demand, but this is all I could think to mention for this particular issue. Thanks in advance for the help.

(If any of you are feeling like being extra thorough, you could probably tell me if there's anything unrelated to the issue mentioned above that needs cleaning up in this mod. It's not necessary, but appreciated.)
 

Attachments

See File Attributes (3rd link in my sig)

Specifically,

.ggxml - Font Icon Map
Must have the same base name as the associated DDS file (eg MyFontIcons.dds and MyFontIcons.ggxml)
 
Thanks for the help (your tutorial guides are amazing btw), I renamed both the .ggmxl and the .dds to FontIcons_Geass, and I didn't have any "error loading font texture" messages popping up, so that's definitely a good sign. However, it still isn't completely fixing the issue.

My custom Strategic Resource shows up in the Strategic Resource List with the Iron icon instead of the custom icon I created for it, and I'm not sure how to make it so the custom icon shows up instead.

Here's a picture to better demonstrate my problem:
8n6OavZ.jpg
 
Check your log files. You'll be getting errors, as you have entries in the XML for columns that don't exist in the database.

The format for the two icon font tables is

Code:
<GameData>
  <IconFontMapping>
     <Row>
      <IconName>ICON_BUILDING_GRANARY</IconName>
      <IconFontTexture>ICON_BUILDING1_FONT</IconFontTexture>
      <IconMapping>1</IconMapping>
    </Row>
  </IconFontMapping>

  <IconFontTextures>
    <Row>
      <IconFontTexture>ICON_BUILDING1_FONT</IconFontTexture>
      <IconFontTextureFile>BuildingAtlas360</IconFontTextureFile>
    </Row>
  </IconFontTextures>
</GameData>

from what I can see, you have an error in one and a missing entry for the other
 
Code:
[585235.265] table [COLOR="Blue"]IconFontMapping[/COLOR] has no column named [COLOR="Red"]IconSize[/COLOR]
[585235.265] In Query - insert into IconFontMapping('IconName', 'IconSize', 'Filename', 'IconsPerRow', 'IconsPerColumn') values (?, ?, ?, ?, ?);
[585235.265] In XMLSerializer while updating table IconFontMapping from file XML/GameInfo/IconTextureAtlases_Geass.xml.
This causes the entire file to be discarded by the game, and forces the game to use the Iron resource icon because Iron is resource #0 (as I recall). I don't have one of the 'more resources' mods handy to compare to, but your definition under table IconFontMapping indeed does not look correct.

---------------------------------------------------------------------------------------------------

As a reference, this is what one mod-author did to add a Rice Luxury Resource to the game that was given for having successfully constructed a world wonder, but you should still be able to use it as a reference-template for defining the Atlas and the IconFontMapping, etc.:
Spoiler :
Code:
<GameData>
	<IconTextureAtlases>
		<Row>
			<Atlas>RICE_ATLAS</Atlas>
			<IconSize>256</IconSize>
			<Filename>RICE_256.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>RICE_ATLAS</Atlas>
			<IconSize>128</IconSize>
			<Filename>RICE_128.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>RICE_ATLAS</Atlas>
			<IconSize>64</IconSize>
			<Filename>RICE_64.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>RICE_ATLAS</Atlas>
			<IconSize>80</IconSize>
			<Filename>RICE_80.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
		<Row>
			<Atlas>RICE_ATLAS</Atlas>
			<IconSize>45</IconSize>
			<Filename>RICE_45.dds</Filename>
			<IconsPerRow>1</IconsPerRow>
			<IconsPerColumn>1</IconsPerColumn>
		</Row>
	</IconTextureAtlases>
	<IconFontTextures>
		<Row>
			<IconFontTexture>ICON_FONT_TEXTURE_RICE</IconFontTexture>
			<IconFontTextureFile>Rice_fonticons</IconFontTextureFile>
		</Row>
	</IconFontTextures>
	<IconFontMapping>
		<Row>
			<IconName>ICON_RES_RICE</IconName>
			<IconFontTexture>ICON_FONT_TEXTURE_RICE</IconFontTexture>
			<IconMapping>1</IconMapping>
		</Row>
	</IconFontMapping>
	<Resources>
		<Row>
			<Type>RESOURCE_RICE</Type>
			<Happiness>4</Happiness>
			<TechCityTrade>TECH_THE_WHEEL</TechCityTrade>
			<Description>TXT_KEY_RESOURCE_RICE</Description>
			<Civilopedia>TXT_KEY_CIV5_RESOURCE_RICE_TEXT</Civilopedia>
			<ResourceClassType>RESOURCECLASS_LUXURY</ResourceClassType>
			<ArtDefineTag>ART_DEF_RESOURCE_SUGAR</ArtDefineTag>
			<AltArtDefineTag>ART_DEF_RESOURCE_SUGAR</AltArtDefineTag>
			<AIObjective>3</AIObjective>
			<PlacementOrder>4</PlacementOrder>
			<ConstAppearance>50</ConstAppearance>
			<MinAreaSize>3</MinAreaSize>
			<MaxLatitude>0</MaxLatitude>
			<RandApp1>25</RandApp1>
			<RandApp2>25</RandApp2>
			<Player>67</Player>
			<Hills>true</Hills>
			<IconString>[ICON_RES_RICE]</IconString>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>RICE_ATLAS</IconAtlas>
		</Row>
	</Resources>
	<Resource_Flavors>
		<Row>
			<ResourceType>RESOURCE_RICE</ResourceType>
			<FlavorType>FLAVOR_HAPPINESS</FlavorType>
			<Flavor>15</Flavor>
		</Row>
	</Resource_Flavors>

	<Language_en_US>
		<!--Resource tags-->
		<Row Tag="TXT_KEY_RESOURCE_RICE">
			<Text>Rice</Text>
		</Row>
		<Row Tag="TXT_KEY_CIV5_RESOURCE_RICE_TEXT">
			<Text>Rice is a cereal grain produced primarily from plants of the Oryza genus. It serves as the staple crop for millions of people worldwide, mainly in areas of Eastern and Southern Asia and the West Indies, each group having their own preferences as to the preparation of the crop. Different regions also have different ways to grow Rice - in flatter areas of Japan and China, Rice is grown in large fields known as Rice Paddies, whereas in areas with less flat ground such as the mountainous areas of China or the Philippines, terraces are cut into the mountainside for Rice to be grown in, to support the wet conditions needed for the rice to grow.</Text>
		</Row>
	</Language_en_US>
</GameData>

--------------------------------------------------------------------------------------------------------------------------------------------

[edit]double-ninja'd by whoward
Powerful code-ninja is he, Powerful Code-Ninja
 
I checked the xml.log and database.log files, and found no errors relating to the resource, though I did correct a few other errors, so thanks for the help in that regard. I also added the following code to my Resources_Geass.xml file:

<IconFontMapping>
<Row>
<IconName>ICON_RES_SAKURADITE</IconName>
<IconFontTexture>ICON_RES_FONT</IconFontTexture>
<IconMapping>1</IconMapping>
</Row>
</IconFontMapping>

And I added this code to my IconTextureAtlases_Geass.xml file:

<IconFontTextures>
<Row>
<IconFontTexture>ICON_RES_FONT</IconFontTexture>
<IconFontTextureFile>FontIconsGeass</IconFontTextureFile>
</Row>
</IconFontTextures>

Now a pop-up window is appearing that says "Error loading font texture", and everything in-game seems to be fine, except now my custom Strategic Resource doesn't have any icon attached to it, instead having what appears to be a green and red checkered box.
 
As the mod has been updated from the original attachment, please zip and attach the latest version ... that way we don't have to guess what you may or may not have done/changed ;)
 
FontIconsGeass.ggxml is referencing the wrong .dds file
 
Back
Top Bottom