Quick Modding Questions Thread

If I were not to add a 22px .dds icon file when adding a new resource icon, would the game crash when starting a new game, would it crash the first time it required the icon, or would it just show some placeholder icon? Or something else?

I don't think this would cause a game crash. From experience, whenever a game cannot load the 'right' icon in a particular scenario, it will show either 'nothing' or it will display the last icon of that type (in that size) that it previously loaded. It essentially drags it out of cache. This is general advice based on what I've seen when I've been testing mods without graphics added.

Edit: to include a couple of questions from myself (different topics).

1. How is the IMPROVEMENT_GREAT_WALL requirement (to be built on the territory border) get called in the game? I had a quick look the other day and couldn't see an appropriate Requirement.

2. Is there any mechanism that would theoretically allow a major civilization to construct things within City-State territory (rather than within their own)? Essentially the reverse of the City-State granting the major civilization access to a unique improvement.
 
1. How is the IMPROVEMENT_GREAT_WALL requirement (to be built on the territory border) get called in the game? I had a quick look the other day and couldn't see an appropriate Requirement.
BuildOnFrontier and BuildInLine in <Improvements>
 
Adding new unit class. best of my ability now (Because i've never do this before) ... and yes. errors incurred.

[3798381.900] [Gameplay] ERROR: UNIQUE constraint failed: TypeTags.Type, TypeTags.Tag
[3798381.900] [Gameplay]: While executing - 'UPDATE TypeTags SET "Tag" = ? WHERE "Type" = ?;'
[3798381.900] [Gameplay] ERROR: Database::XMLSerializer (ZaabSpicey_UnitGameplay.xml): There was an error executing the update statement! See Database.log for details.
[3798381.900] [Gameplay] ERROR: UNIQUE constraint failed: TypeTags.Type, TypeTags.Tag
[3798381.900] [Gameplay]: In XMLSerializer while updating table TypeTags from file ZaabSpicey_UnitGameplay.xml.
[3798381.918] [Gameplay] ERROR: table Modifiers has no column named Name
[3798381.918] [Gameplay]: In Query - insert into Modifiers('ModifierId', 'Name', 'Value') values (?, ?, ?);
[3798381.918] [Gameplay]: In XMLSerializer while updating table Modifiers from file ZaabSpicey_UnitPromotions.xml.
[3798381.933] [Localization] ERROR: Database::XMLSerializer (ZaabSpicey_PromotionsText.xml): 'Row' or 'Delete' expected, got 'Text'.
[3798381.933] [Localization]: In XMLSerializer while updating table BaseGameText from file ZaabSpicey_PromotionsText.xml.
[3798382.004] [Localization] ERROR: NOT NULL constraint failed: LocalizedText.Language
[3798382.004] [Localization]: While executing - 'insert into LocalizedText('Tag', 'Text') values (?, ?);'
[3798382.004] [Localization]: In XMLSerializer while inserting row into table insert into LocalizedText('Tag', 'Text') with values (LOC_UNIT_BATTLESHIP_DESCRIPTION, Early Atomic era Linear Battleship unit. Provides cover from air and nuclear attacks up to 1 tile away., ).
[3798382.004] [Localization]: In XMLSerializer while updating table LocalizedText from file ZaabSpicey_UnitText.xml.
[3798382.004] [Localization] ERROR: NOT NULL constraint failed: LocalizedText.Language
[3798384.409] [Gameplay]: Validating Foreign Key Constraints...
[3798384.448] [Gameplay]: Passed Validation.

This is error log

https://drive.google.com/file/d/1MRQoRljXXcxVQgDyVQDYnMlyopyeNW3A/view?usp=sharing

And the entire mod. WHAT DID I DO WRONG HERE? My Intentions is to add new class and some more units and reorganizations.
Which files should I declare a new class? and inherent abilities??

EDIT: This error doesn't crash a game.
 
Code:
<Update><Where Type="UNIT_BATTLESHIP"/> <Set Tag="CLASS_BATTLESHIP"/></Update>
This will make every pre-existing row in the table where "Type" is "UNIT_BATTLESHIP" have a "Tag" of "CLASS_BATTLESHIP". Since these two rows already exist in the Vanilla Units file you get a unique constraint error and the Update fails:
Code:
		<Row Type="UNIT_BATTLESHIP" Tag="CLASS_NAVAL_RANGED"/>
		<Row Type="UNIT_BATTLESHIP" Tag="CLASS_ANTI_AIR"/>
The Database.log error message give you the table, the Columns involved, and the type of code-method being attempted within that table
Code:
[3798381.900] [Gameplay] ERROR: UNIQUE constraint failed: TypeTags.Type, TypeTags.Tag
[3798381.900] [Gameplay]: While executing - 'UPDATE TypeTags SET "Tag" = ? WHERE "Type" = ?;'
[3798381.900] [Gameplay] ERROR: Database::XMLSerializer (ZaabSpicey_UnitGameplay.xml): There was an error executing the update statement! See Database.log for details.
[3798381.900] [Gameplay] ERROR: UNIQUE constraint failed: TypeTags.Type, TypeTags.Tag
[3798381.900] [Gameplay]: In XMLSerializer while updating table TypeTags from file ZaabSpicey_UnitGameplay.xml.
You get a "?" on the second error line instead of the actual data you were attempting to use because multiple rows were affected by the update attempt.

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

This ought to be self-explanatory
Code:
[3798381.918] [Gameplay] ERROR: table Modifiers has no column named Name
[3798381.918] [Gameplay]: In Query - insert into Modifiers('ModifierId', 'Name', 'Value') values (?, ?, ?);
[3798381.918] [Gameplay]: In XMLSerializer while updating table Modifiers from file ZaabSpicey_UnitPromotions.xml.
You have probably copy-pasted code into table Modifiers that you meant to copy-paste into table ModiiferArguments.

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

Code:
[3798381.933] [Localization] ERROR: Database::XMLSerializer (ZaabSpicey_PromotionsText.xml): 'Row' or 'Delete' expected, got 'Text'.
[3798381.933] [Localization]: In XMLSerializer while updating table BaseGameText from file ZaabSpicey_PromotionsText.xml.
You have multiple occurances within the file of closing the row before starting the text and then never closing the row before starting another row
Code:
		<!-- Battleship -->
		<Row Tag="LOC_PROMOTION_CLASS_BATTLESHIP_NAME" /><Text>Battleship</Text>

		<Row Tag="LOC_PROMOTION_SENIOR_CAPTAIN_NAME" /><Text>Senior Captain</Text>
		...etc....
Proper method of using that sort of syntax
Code:
		<Row Tag="LOC_BUILDING_NATIONAL_MUSEUM_LRS_NAME" Language="en_US">
			<Text>National Museum</Text>
		</Row>
This example taken from <LocalizedText> but the table being used is not important: what is important is not closing the row prematurely.

Notice there us no "/" at the end of starting line with the Row opening command.

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

Code:
[3798382.004] [Localization] ERROR: NOT NULL constraint failed: LocalizedText.Language
[3798382.004] [Localization]: While executing - 'insert into LocalizedText('Tag', 'Text') values (?, ?);'
[3798382.004] [Localization]: In XMLSerializer while inserting row into table insert into LocalizedText('Tag', 'Text') with values (LOC_UNIT_BATTLESHIP_DESCRIPTION, Early Atomic era Linear Battleship unit. Provides cover from air and nuclear attacks up to 1 tile away., ).
[3798382.004] [Localization]: In XMLSerializer while updating table LocalizedText from file ZaabSpicey_UnitText.xml.
in table LocalizedText you cannot omit the language designation
Code:
		<!--Atomic Era Units-->
		<Delete Tag="LOC_UNIT_BATTLESHIP_DESCRIPTION" />
		<Row Tag="LOC_UNIT_BATTLESHIP_DESCRIPTION">
			<Text>Early Atomic era Linear Battleship unit. Provides cover from air and nuclear attacks up to 1 tile away.</Text>
		</Row>

	</LocalizedText>
----------------------------------------------------

The game does not care what file you use to add a new class of unit, a new ability class, etc. It only cares that the Action-Type in Modbuddy (modinfo file of built mod) is proper, and the tables being written-to are the correct ones for the code you are trying to add or alter.

I can call all my files "Cheeseburger1.xml", "Cheeseburger2.xml", etc. so long as I use the correct Action-Type for these files.
 
Last edited:
EDIT: Just solved. now all errors are gone. phew.

But what are procedures when writing Promotions.XML because there are numerous interconnecting table headeaches.?

Next class will be hybrid class. to define class strenghts and weaknesses. what are syntaxes to define? for example 'Infantry' class is on equal terms with 'melee' and 'anti cavalry' while being strong against two cavalry class but weak against tanks and ranged.
 
Last edited:
Is the method explained in the guide How to make a Civilization Icon the correct one to use for Resource icons? It says:

- New File > Texture > Class: UserInterface

Is this the correct method? Is there a ReadMe file for the Asset Editor which describes what all Entities and Classes do?
---

I've noticed that both the Resourceful and Sukritact Resources mods include a .Dep file along with the .modinfo file. When I open it, the top reads <AssetObjects..GameDependencyData>

I only see the .Art.xml file in my own mod and the top reads <AssetObjects..GameArtSpecification>

I'm stuck. Really need help figuring this out.
---

Note: My icons are akin to Jeans or Cloves. I don't actually need art assets for the tiles, just the icons.
 
I'm having trouble when exporting my files as .dds. I've tested with Sukritact's .dds to see if the Asset Editor is importing it correctly, and it is. Something off with the way I'm creating the .dds file because DDSViewer is also unable to open it.

On the left is the error message I get in the Asset Editor, on the right are the settings I'm using when exporting (never mind that the icons are all the same, it's just for testing):

ef0YYwS.png



Furthermore, this is what I get in Photoshop when loading the .dds file with the option "Load Alpha as Channel instead of Transparency":
Tl8GRhI.png


I have no idea where that weird background is coming from.
 
I wasn't able to solve it in Photoshop so I attempted to save it as .dds using Gimp.

Well, it seems to work... partially.

Now GIMP thinks it knows better than me the image size that I need to use. It's converting the default image size to something else... just why... whyyyy. :badcomp:
_____________

Well, Asset Editor seems to accept it, but when loading the file with DDSViewer or Photoshop with setting "Alpha as Channel rather than transparency", I get the black border you see in the image on the right.

Xgq5zMz.png


I don't know why that's happening or if it's going to affect things in the future.
_____________

Edit: Saved it as BC3 interpolated alpha in Photoshop. Asset Editor loaded it correctly. No weird alpha channel.

I'm fairly certain this is not the method they used to save the original DDS files, though, nor the one used by Sukritact or pokiehl for their mods.

I'd still appreciate any insights if anyone knows what's going on.

Edit 2: I may have found the correct format! I think it's 8.8.8.8 BGRA. It only took me the whole afternoon...
 
Last edited:
OK Here comes a real challenge when creating combined class

Is it possible to 'borrow' existing promotions of the existing class and reorganize for this class?

Code:
<!--Infantry-->
<Types>
       <Row Type="PROMOTION_CLASS_INFANTRY" Kind="KIND_PROMOTION_CLASS"/>
       <Row Type="PROMOTION_FORMATION_DRILL" Kind="KIND_PROMOTION"/>               <!-- Lvl1 Mid, Combines: Battlecry, Tortoise, Echelon,and Thrust-->
</Types>

<UnitPromotionClasses>
       <Row PromotionClassType="PROMOTION_CLASS_INFANTRY" Name="LOC_PROMOTION_CLASS_INFANTRY_NAME"/>
</UnitPromotionClasses>

<UnitPromotions>
       <!--Infantry-->
       <Row UnitPromotionType="PROMOTION_FORMATION_DRILL" Name="LOC_FORMATION_DRILL_NAME" Description="LOC_PROMOTION_FORMATION_DRILL_DESCRIPTION" Level="1" Specialization="" Column="2" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_COMMANDO" Name="LOC_PROMOTION_COMMANDO_NAME" Description="LOC_PROMOTION_COMMANDO_DESCRIPTION" Level="2" Column="1" Specialization="" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_URBAN_WARFARE" Name="LOC_PROMOTION_URBAN_WARFARE_NAME" Description="LOC_PROMOTION_URBAN_WARFARE_DESCRIPTION" Level="3" Column="1" Specialization="" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_ELITE_GUARD" Name="LOC_PROMOTION_ELITE_GUARD_NAME" Description="LOC_PROMOTION_ELITE_GUARD_DESCRIPTION" Level="4" Column="1" Specialization="" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_SQUARE" Name="LOC_PROMOTION_SQUARE_NAME" Description="LOC_PROMOTION_SQUARE_DESCRIPTION" Level="2" Specialization="" Column="3" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_CHOKE_POINTS" Name="LOC_PROMOTION_CHOKE_POINTS_NAME" Description="LOC_PROMOTION_CHOKE_POINTS_DESCRIPTION" Level="3" Specialization="" Column="3" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
       <Row UnitPromotionType="PROMOTION_HOLD_THE_LINE" Name="LOC_PROMOTION_HOLD_THE_LINE_NAME" Description="LOC_PROMOTION_HOLD_THE_LINE_DESCRIPTION" Level="4" Specialization="" Column="3" PromotionClass="PROMOTION_CLASS_INFANTRY"/>
</UnitPromotions>

If so what are correct syntax for this table? I've made one promotions for Infantry class, and borrow three from Melee and Anticav class.
 
Last edited:
How do I access the XML file (?) to edit city names? When playing a game, I just want to be able to pronounce the city names and/or otherwise have names I would like to see in my game.
 
How do I access the XML file (?) to edit city names? When playing a game, I just want to be able to pronounce the city names and/or otherwise have names I would like to see in my game.
You can open any of the game's original XML files with a text editor such as Notepad or Notepad++
Editing Localization files (ie, IN-Game Text files) can be a little confusing for those not familiar with how the Localization system is organized.

For Vanilla the Localization XML files are found at
C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Text
Within that folder is a sub-folder called "en_US" where the various files for English-Language text is stored. File "CityNames_Text.xml" contains the ingame text for city-names. Just be forewarned that
  1. The Ingame text for the two expansions is in entirely different folder locations.
    C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion1\Text
    C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization VI\DLC\Expansion2\Text
  2. The Civ and Scenario DLC often have their own Text files embedded within the individual folders for that DLC
  3. If you alter original game files your changes may very well be wiped by the next game patch update
  4. If you alter original game files and whoops the needed syntax of the XML files you can end up with very bad things. So always make a complete backup of the original file somewhere else on your computer such as directly in your "My Documents" area. Do so before you make any edits to the original file the game uses.
 
Is there a mod that adds new route types?
So far as I know, no. At least not seamlessly or with complete success.

I think some people have tried but the real problem is that so much of what roads (routes) do and how they are registered into the game engine and graphically represented is controlled directly within the game's inaccessible operating code.

Trade Routes are nearly impossible to mod to any appreciable degree except to alter the yield rewards they give for Domestic or International Trade Routes, for example.
 
If tables from different databases aren't supposed to communicate with one another, how come the line LOC_RESOURCES_BANANAS_NAME from the Resources table located in GameplaySchema retrieves information from the LocalizedText table in the LocalizationDatabaseSchema database?

Clearly I'm misunderstanding this:
Additional Civ6 Databases
Civilization 6 also is structured to make use of a couple of additional databases for ancillary information
such as language text and icon definitions.

Can the Different Databases "Talk" to Each Other ?
None of the game's databases can share information with any of the others. You cannot therefore
extract information from one database into another. If you are skilled at SQL syntax, for example, you
might find it convenient to extract information from within one of the game's databases into another of
the game's databases, but you cannot. The databases are each their own "sandbox", so you cannot for
example extract the information within the Language database and use it within the main InGame
database, nor can you extract or access information held within the main Frontend database for use
within the InGame database, or vice versa.
_____________

2nd: Can I have the main code be in a SQL file and the Icon/Text files in XML? Or do I have to stick to the same for all of them?
 
Last edited:
If tables from different databases aren't supposed to communicate with one another, how come the line LOC_RESOURCES_BANANAS_NAME from the Resources table located in GameplaySchema retrieves information from the LocalizedText table in the LocalizationDatabaseSchema database?

Clearly I'm misunderstanding this:
The databases do not share this information between them. You cannot for example in a UpdateDatabase file access table <BaseGameText> nor table <LocalizedText> because both these tables are part of the Localization Database and not part of the Gameplay or Configuration databases.

The seeming communication to pull the value of the <Text> field is done behind the scenes by the game engine and in the User Interface lua files.

All "LOC_RESOURCE_BANANAS_NAME" in the Gameplay database does is signify which Localization Tag should be used for the In-Game "Name" that is displayed to the user for the Bananas Resource. Depending on which language a user is running they will get "Bananas", "Banane", "Plátanos", "Bananen", "Banana", "바나나", "Bananes", "バナナ", "Banany", "香蕉", "Бананы", or "香蕉".

What you see in table <Resources> is merely a reference to tell the game which Tag to look up depending on the language the user is running. But the Gameplay database itself cannot access any of this information.
 
I see a lot of modders inserting new text directly into the LocalizedText table. Yet Sukritact chose to use INSERT OR REPLACE INTO BaseGameText command for his Resources mod.

Looking at the Localization Schema file, there's this bit:

These views and triggers are temporary and are used to simplify the XML files used to populate the database.
They are dropped in post processing.


CREATE TRIGGER AddBaseGameText INSTEAD OF INSERT ON BaseGameText
BEGIN
INSERT INTO LocalizedText ('Language', 'Tag', 'Text', 'Gender', 'Plurality') VALUES('en_US', NEW.Tag, NEW.Text, NEW.Gender, NEW.Plurality);
END
;

In practical terms is there any meaningful difference for a modder to insert to BasGameText vs LocalizedText?
 
Nope.

I generally advise people to get used to and use <LocalizedText> since that is where everything ends up anyway.

<BaseGameText> as I recall does not allow use of UPDATE statements for anything within <BaseGameText> whereas <LocalizedText> does allow usage of UPDATE statements for stuff that was added by the Vanilla game.

Stuff that is added to the Language Localization by the expansions does not appear in the Localization Database that modding can access, so for the Expansions its a moot point re UPDATE statements.
 
Thanks for the help.

The mods I'm looking at do not specify a Language for the LocalizedText table, but I don't understand why that's accepted. It seems to default to en_US somehow, but that information isn't in the table itself, which reads:

CREATE TABLE LocalizedText( 'Language' TEXT NOT NULL,
'Tag' TEXT NOT NULL,
'Text' TEXT,
'Gender' TEXT,
'Plurality' TEXT,
PRIMARY KEY (Language, Tag));

Language is a primary key with not Default value and a NOT NULL constraint, so how come so many mods ignore it when adding new rows? All I see is the Tag and Text columns being used.

Edit: Nvm. The mods which use LocalizedText do seem to specify it.

The original files and Sukritact use BaseGameText, and those do not specify a language. I have a bunch of tabs open and didn't realise I was reading the original game files.

So I guess that's one advantage of BaseGameText. It defines the language to be used as 'en_US'. Maybe that's why Sukritact used it.
 
Last edited:
Back
Top Bottom