.modinfo structure

Status
Not open for further replies.
Code:
     <Files>
          <File>Example1.xml</File>
          <File>Example2.xml</File>
          <File>Example3.xml</File>
          <File>Example4.xml</File>
     </Files>
You appear not to have this as is in my example of a partial modinfo file.
 
Finally, hallehjuha (sp??) i have it. I have success fully removed the technologies I dont want.

Hopefully I am doing it correctly and wont have unexpected errors later but for now it appears to work for technologies.

modinfo file:

<?xml version="1.0" encoding="utf-8"?>
<Mod id="18cd2475-eba6-4f67-bcc9-43697b748bc0" version="1">
<Properties>
<Name>ANCIENTERA</Name>
<Teaser>Ancient to Classical Eras</Teaser>
<Description>Ancient to Classical Eras</Description>
<Authors>Me</Authors>
</Properties>
<Components>
<UpdateDatabase id="GAMEPLAY_CHANGES">
<Items>
<File>Technologies.xml</File>
</Items>
</UpdateDatabase>

</Components>
<Files>
<File>Technologies.xml</File>
</Files>
</Mod>

Technologies file:

<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Ed Beach (Firaxis Games) -->
<GameInfo>
<Types>
<Delete Type="TECH_ADVANCED_FLIGHT"/>
<Delete Type="TECH_MASS_PRODUCTION"/>
<Delete Type="TECH_GUNPOWDER"/>
<Delete Type="TECH_PRINTING"/>
<Delete Type="TECH_SQUARE_RIGGING"/>
<Delete Type="TECH_ASTRONOMY"/>
<Delete Type="TECH_METAL_CASTING"/>
<Delete Type="TECH_INDUSTRIALIZATION"/>
<Delete Type="TECH_SCIENTIFIC_THEORY"/>
<Delete Type="TECH_BALLISTICS"/>
<Delete Type="TECH_MILITARY_SCIENCE"/>
<Delete Type="TECH_STEAM_POWER"/>
<Delete Type="TECH_SANITATION"/>
<Delete Type="TECH_ECONOMICS"/>
<Delete Type="TECH_RIFLING"/>
<Delete Type="TECH_FLIGHT"/>
<Delete Type="TECH_REPLACEABLE_PARTS"/>
<Delete Type="TECH_STEEL"/>
<Delete Type="TECH_ELECTRICITY"/>
<Delete Type="TECH_RADIO"/>
<Delete Type="TECH_CHEMISTRY"/>
<Delete Type="TECH_COMBUSTION"/>
<Delete Type="TECH_ADVANCED_FLIGHT"/>
<Delete Type="TECH_ROCKETRY"/>
<Delete Type="TECH_ADVANCED_BALLISTICS"/>
<Delete Type="TECH_COMBINED_ARMS"/>
<Delete Type="TECH_PLASTICS"/>
<Delete Type="TECH_COMPUTERS"/>
<Delete Type="TECH_NUCLEAR_FISSION"/>
<Delete Type="TECH_SYNTHETIC_MATERIALS"/>
<Delete Type="TECH_TELECOMMUNICATIONS"/>
<Delete Type="TECH_SATELLITES"/>
<Delete Type="TECH_GUIDANCE_SYSTEMS"/>
<Delete Type="TECH_LASERS"/>
<Delete Type="TECH_COMPOSITES"/>
<Delete Type="TECH_STEALTH_TECHNOLOGY"/>
<Delete Type="TECH_ROBOTICS"/>
<Delete Type="TECH_NANOTECHNOLOGY"/>
<Delete Type="TECH_NUCLEAR_FUSION"/>
</Types>

</GameInfo>

Only 11 more files to go :)

Next step is the eras file to remove the later eras.
 
I can't seem to get my modinfo file to work correctly. Can anyone tell me what I am doing wrong? The Lua doesn't load until after I launch a game and return to the main menu. And then the localization text doesn't load.

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="b1325bdf-9167-4c78-9faf-3fb285bd01ef" version="1.0.1">
    <Properties>
        <Name>Civilopedia on Main Menu</Name>
        <Teaser>Adds a Civilopedia shotcut to the Main Menu</Teaser>
        <Description>Adds Civilopedia to the main menu so you don't have to wait through a loading screen just to figure out which leader you want!</Description>
        <Authors>Remgrandt</Authors>
        <EnabledByDefault>1</EnabledByDefault>
        <EnabledAtStartup>1</EnabledAtStartup>
    </Properties>
    <Components>
        <ImportFiles id="MMCIVILOPEDIA_FILES">
            <Items>
                <File>UI/FrontEnd/MainMenu.lua</File>
                <File>UI/FrontEnd/MainMenu.xml</File>
                <File>Text/en_US/FrontEndText.xml</File>
            </Items>
        </ImportFiles>
    </Components>
    <Files>
        <File>UI/FrontEnd/MainMenu.lua</File>
        <File>UI/FrontEnd/MainMenu.xml</File>
        <File>Text/en_US/FrontEndText.xml</File>
    </Files>
</Mod>
 
Currently it is not anything you can get around re the text not reloading when you return to the main menu. All mods are doing it. Localized text wants an exit to desktop and a restart of the game in order to load properly.

Anything that is not in the <Settings> portions of the modinfo file does not load until after a game is started. This appears to also be true for replacement lua files that are creating a replacement UI. You could try putting your import segment under <Settings> but then your text would not load anyway because it will not be updated to the database until after you start a game.

Also so far as I know you can't import your text file anyway because it should be using a format of
Code:
<GameData>
     <LocalizedText>
          <Row Tag="LOC_SOMETHING" Language="en_US">
                <Text>Your Text</Text>
          </Row>
     </LocalizedText>
</GameData>
and anything in a file that uses <GameData> or <GameInfo> will never be implemented via a file-import method. They have to use
Code:
<Components>
     <LocalizedText id="BASE_GAMEPLAY_TEXT">
          <Items>
               <File>Text/en_US/FrontEndText.xml</File>
           </Items>
     </LocalizedText>
</Components>
in the modinfo file in order to get the contents of file FrontEndText.xml added to the localization table. Or they have to use as
Code:
<Settings>
     <LocalizedText id="BASE_GAMEPLAY_SETTING_TEXT">
          <Items>
               <File>Text/en_US/FrontEndText.xml</File>
           </Items>
     </LocalizedText>
</Settings>
But the game is finicky in that it does not like to see non-configuration stuff in the configuration Text database.

Tbh it's really a bit PITA at the moment.
 
Currently it is not anything you can get around re the text not reloading when you return to the main menu. All mods are doing it. Localized text wants an exit to desktop and a restart of the game in order to load properly.

Anything that is not in the <Settings> portions of the modinfo file does not load until after a game is started. This appears to also be true for replacement lua files that are creating a replacement UI. You could try putting your import segment under <Settings> but then your text would not load anyway because it will not be updated to the database until after you start a game.

Also so far as I know you can't import your text file anyway because it should be using a format of
Code:
<GameData>
     <LocalizedText>
          <Row Tag="LOC_SOMETHING" Language="en_US">
                <Text>Your Text</Text>
          </Row>
     </LocalizedText>
</GameData>
and anything in a file that uses <GameData> or <GameInfo> will never be implemented via a file-import method. They have to use
Code:
<Components>
     <LocalizedText id="BASE_GAMEPLAY_TEXT">
          <Items>
               <File>Text/en_US/FrontEndText.xml</File>
           </Items>
     </LocalizedText>
</Components>
in the modinfo file in order to get the contents of file FrontEndText.xml added to the localization table. Or they have to use as
Code:
<Settings>
     <LocalizedText id="BASE_GAMEPLAY_SETTING_TEXT">
          <Items>
               <File>Text/en_US/FrontEndText.xml</File>
           </Items>
     </LocalizedText>
</Settings>
But the game is finicky in that it does not like to see non-configuration stuff in the configuration Text database.

Tbh it's really a bit PITA at the moment.
So is direct modification of the game files the only way to do my mod at this point?
 
While poking around in modding.sql, I came across:
Code:
-- Components associated with a setting.
-- @SettingRowId is the locally unique id of the setting.
-- @ComponentRowId is the locally unique id of the component.
CREATE TABLE SettingComponents(
    'SettingRowId' INTEGER NOT NULL,
    'ComponentRowId' INTEGER NOT NULL,
    PRIMARY KEY('SettingRowId', 'ComponentRowId'),
    FOREIGN KEY('SettingRowId') REFERENCES Settings('SettingRowId') ON DELETE CASCADE ON UPDATE CASCADE,
    FOREIGN KEY('ComponentRowId') REFERENCES Components('ComponentRowId') ON DELETE CASCADE ON UPDATE CASCADE
);

Which would as mentioned in the code let you associate components with settings.
And since we allready know that settings loads at startup and components loads during game creation.
This would perhaps let us run components at startup.

My only problem, is that I don't know yet how to structure the modinfo file to pick up on this association
 
Stupid question here: why do we have two databases? Does one get queried before the other?
 
Stupid question here: why do we have two databases? Does one get queried before the other?

I am assuming you are talking about the DebugConfiguration.sqlite and DebugGameplay.sqlite (actually there are three databases, Mods.sqlite :D)

From a developer perspective, I am guessing its to make it "simpler" and more structured.
Keeping all information related to the gameplay itself in one database,
And then all configurations needed to create a game in the other,
And in the last, all information related to mods.
 
Don't forget localisation, which is stored in a fourth
 
This is a Template of all the possible functions (if thats the right word) you can have in a Modinfo. There maybe others that I have not found yet. there is a brief description for some, but most are self explanitory.

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Mod ID, needs to be unique to your mod. -->
<Mod id="0afa7ecd-5d9f-4c49-9184-a69de3ce45ee" version="1">
    <!-- Basic Mod information -->
    <Properties>
        <Name>LOC_MOD_TITLE</Name>
        <Stability>Alpha</Stability>
        <Teaser>LOC_MOD_TEASER</Teaser>
        <Description>LOC_MOD_DESCRIPTION</Description>
        <Authors>LOC_MOD_AUTHORS</Authors>
        <EnabledByDefault>1</EnabledByDefault>
        <EnabledAtStartup>1</EnabledAtStartup>
    </Properties>
   <Dependencies />
   <References />
   <Blocks />
    <!-- Settings, Loaded at boot by the game engine-->
   <Settings>
       <Custom id="MOD_Setting">
           <Items>
               <!-- Update Configuration Database-->
               <File>NewFile_C_Config.sql</File>
               <File>NewFile_B_Config.xml</File>
               <!-- Load order of Components, this is important. -->
               <Component>MOD_Component_A</Component>
               <Component>MOD_Component_D</Component>
               <Component>MOD_Component_C</Component>
               <Component>MOD_Component_B</Component>
               <Component>MOD_Text</Component>
           </Items>
       </Custom>
       <!-- Configuration Database Text -->
       <LocalizedText id="MOD_Setting">
           <Items>
               <File>NewText_Config.xml</File>
           </Items>
       </LocalizedText>
   </Settings>
    <!-- Different parts of the mod. Database entries are loaded once you hit Start Game.
        Import files are loaded at game boot up (I think).-->
    <Components>
       <!-- Gameplay Scripts -->
       <GameplayScripts>
           <Property>
               <RuleSet>YOUR_RULESET</RuleSet>
           </Property>
           <Items>
               <File>YourGameplayScripts.Lua</File>
           </Items>
       </GameplayScripts>
       <!-- What files to Import -->
        <ImportFiles id="MOD_Import">
            <Items>
               <File>LuaFile.lua</File>
            </Items>
        </ImportFiles>
       <!-- What files to update database with -->
       <UpdateDatabase id="MOD_Component_D">
           <Items>
               <File>NewFile_D.sql</File>
           </Items>
       </UpdateDatabase>
       <UpdateDatabase id="MOD_Component_C">
           <Items>
               <File>NewFile_C.xml</File>
           </Items>
       </UpdateDatabase>
       <UpdateDatabase id="MOD_Component_B">
           <Items>
               <File>NewFile_B.xml</File>
           </Items>
       </UpdateDatabase>
       <UpdateDatabase id="MOD_Component_A">
           <Items>
               <File>NewFile_A.xml</File>
           </Items>
       </UpdateDatabase>
       <!-- Localized text files to add -->
       <LocalizedText id="MOD_Text">
           <Items>
               <File>ModText.xml</File>
           </Items>
       </LocalizedText>
    </Components>
   <!-- Mod Text -->
   <LocalizedText>
       <Text id="LOC_MOD_TITLE">
           <en_US>Title</en_US>
       </Text>
       <Text id="LOC_MOD_TEASER">
           <en_US>Teaser</en_US>
       </Text>
       <Text id="LOC_MOD_DESCRIPTION">
           <en_US>Description</en_US>
       </Text>
       <Text id="LOC_MOD_AUTHORS">
           <en_US>Author</en_US>
       </Text>
   </LocalizedText>
    <!-- Files to included in the mod -->
    <Files>
       <File>LuaFile.lua</File>
       <File>ModText.xml</File>
       <File>NewFile_A.xml</File>
       <File>NewFile_B.xml</File>
       <File>NewFile_C.xml</File>
       <File>NewFile_D.sql</File>
       <File>NewFile_C_Config.sql</File>
       <File>NewFile_B_Config.xml</File>
       <File>NewText_Config.xml</File>
    </Files>
</Mod>
 
This is a Template of all the possible functions (if thats the right word) you can have in a Modinfo. There maybe others that I have not found yet. there is a brief description for some, but most are self explanitory.

Couple of things I've found as well;
-- Properties section - Doesn't require the "LOC_MOD_XXX" and then the 'localized text' at the bottom, you can put plain English text in those fields.

-- You don't need to split each file out in the GameplayScripts (see the AI+ mod for example)

I don't know what/whether there are benefits to doing it either way, just thought I'd throw out what I've used/seen used.
 
Any thoughts on adding a lua as a component to a setting?

Still having some difficulties there.
 
Having difficulties updating the Configuration database. I am trying to alter the minimum and maximum number of City States on a Small map. I don't see any errors in the log but the changes do not occur.

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="f7b57f92-c92b-495d-8840-2993539024f5" version="1">
    <Properties>
        <Name>Misc Improvements</Name>
        <Teaser>LOC_AZTEC_MONTEZUMA_MOD_TEASER</Teaser>
        <Description>Misc Game Tweaks</Description>
        <Authors>dls1961</Authors>
        <ShowInBrowser>AlwaysHidden</ShowInBrowser>
        <EnabledByDefault>1</EnabledByDefault>
        <EnabledAtStartup>1</EnabledAtStartup>
    </Properties>
    <Components>
        <UpdateDatabase id="RulesGameTweaks">           
            <Items>
                <File>RulesGameTweaks.sql</File>               
            </Items>
        </UpdateDatabase>
    </Components>
    <Settings>
        <Custom id="DLS_CONFIG_DATA">
            <Items>
                <File>RulesConfigTweaks.sql</File>
            </Items>
        </Custom>       
    </Settings>
    <Files>
        <File>RulesConfigTweaks.sql</File>
        <File>RulesGameTweaks.sql</File>       
    </Files>   
</Mod>

And my RulesConfigTweaks.sql looks like this:
Code:
-- Insert SQL Rules Here


Update Parameters Set DefaultValue = 'DIFFICULTY_WARLORD' Where Name = 'LOC_GAME_HANDICAP';
Update Parameters Set DefaultValue = 'GAMESPEED_QUICK' Where RecNo = 5;
Update MapSizes Set MinCityStates = 8, MaxCityStates = 8, DefaultCityStates = 8 Where MapSizeType = 'MAPSIZE_SMALL';
 
From what I've been seeing from tests, this is all that is needed in order to force file loading order of xml files
Code:
<Mod id="17462E0F-1EE1-4819-A44A-052B589LEESB" version="1">
	<Properties>
		<Name>Really Advanced Setup Lite</Name>
		<Teaser>Allows user to set up additional starting conditions, meant esp to help mod-makers</Teaser>
		<Description>Really Advanced Setup Lite</Description>
		<Authors>LeeS</Authors>
	</Properties>
	<Files>
		<File>RASL_Set-Up.xml</File>
		<File>RASL_Set-Up2.xml</File>
		<File>LUA/RASL.lua</File>
	</Files>
	<Components>
		<UpdateDatabase id="MOD_Component_A">
			<Items>
				<File>RASL_Set-Up.xml</File>
				<File>RASL_Set-Up2.xml</File>
			</Items>
		</UpdateDatabase>
		<GameplayScripts id="RASL_LUA">
			<Items>
				<File>LUA/RASL.lua</File>
			</Items>
		</GameplayScripts>
	</Components>
</Mod>
You can also do as this (and perhaps it is better to do so):
Code:
<Mod id="17462E0F-1EE1-4819-A44A-052B589LEESB" version="1">
	<Properties>
		<Name>Really Advanced Setup Lite</Name>
		<Teaser>Allows user to set up additional starting conditions, meant esp to help mod-makers</Teaser>
		<Description>Really Advanced Setup Lite</Description>
		<Authors>LeeS</Authors>
	</Properties>
	<Files>
		<File>RASL_Set-Up.xml</File>
		<File>RASL_Set-Up2.xml</File>
		<File>LUA/RASL.lua</File>
	</Files>
	<Components>
		<UpdateDatabase id="MOD_Component_A">
			<Items>
				<File>RASL_Set-Up.xml</File>
			</Items>
		</UpdateDatabase>
		<UpdateDatabase id="MOD_Component_B">
			<Items>
				<File>RASL_Set-Up2.xml</File>
			</Items>
		</UpdateDatabase>
		<GameplayScripts id="RASL_LUA">
			<Items>
				<File>LUA/RASL.lua</File>
			</Items>
		</GameplayScripts>
	</Components>
</Mod>
But in neither case did a <Settings> table make any difference to the loading order. If I did as this, I got a failure of desired loading order:
Code:
<Mod id="17462E0F-1EE1-4819-A44A-052B589LEESB" version="1">
	<Properties>
		<Name>Really Advanced Setup Lite</Name>
		<Teaser>Allows user to set up additional starting conditions, meant esp to help mod-makers</Teaser>
		<Description>Really Advanced Setup Lite</Description>
		<Authors>LeeS</Authors>
	</Properties>
	<Files>
		<File>RASL_Set-Up.xml</File>
		<File>RASL_Set-Up2.xml</File>
		<File>LUA/RASL.lua</File>
	</Files>
	<Settings>
		<Custom id="RASL_SETTINGS">
			<Items>
				<Component>MOD_Component_A</Component>
				<Component>MOD_Component_B</Component>
			</Items>
		</Custom>
	</Settings>
	<Components>
		<UpdateDatabase id="MOD_Component_B">
			<Items>
				<File>RASL_Set-Up2.xml</File>
			</Items>
		</UpdateDatabase>
		<UpdateDatabase id="MOD_Component_A">
			<Items>
				<File>RASL_Set-Up.xml</File>
			</Items>
		</UpdateDatabase>
		<GameplayScripts id="RASL_LUA">
			<Items>
				<File>LUA/RASL.lua</File>
			</Items>
		</GameplayScripts>
	</Components>
</Mod>
Even when using the <Settings> table, only this seemed to matter:
Code:
<Components>
	<UpdateDatabase id="MOD_Component_A">
		<Items>
			<File>RASL_Set-Up.xml</File>
		</Items>
	</UpdateDatabase>
	<UpdateDatabase id="MOD_Component_B">
		<Items>
			<File>RASL_Set-Up2.xml</File>
		</Items>
	</UpdateDatabase>
</Components>
instead of
Code:
<Components>
	<UpdateDatabase id="MOD_Component_B">
		<Items>
			<File>RASL_Set-Up2.xml</File>
		</Items>
	</UpdateDatabase>
	<UpdateDatabase id="MOD_Component_A">
		<Items>
			<File>RASL_Set-Up.xml</File>
		</Items>
	</UpdateDatabase>
</Components>
Combinations of SQL and XML files might behave differently and require the seperated listing of the <UpdateDatabase> rows, but <Components> database files do not seem to need anything from the <Settings> (ie, configuration) side of the game database stated within the modinfo file in order to ensure file loading order.
 
Having difficulties updating the Configuration database. I am trying to alter the minimum and maximum number of City States on a Small map. I don't see any errors in the log but the changes do not occur.

And my RulesConfigTweaks.sql looks like this:
Code:
-- Insert SQL Rules Here

Update Parameters Set DefaultValue = 'DIFFICULTY_WARLORD' Where Name = 'LOC_GAME_HANDICAP';
Update Parameters Set DefaultValue = 'GAMESPEED_QUICK' Where RecNo = 5;
Update MapSizes Set MinCityStates = 8, MaxCityStates = 8, DefaultCityStates = 8 Where MapSizeType = 'MAPSIZE_SMALL';

I believe the min and max city state stuff is currently broken, and it's just hard coded to be 1.5 * number of major civs.

If you look in Base\Assets\UI\FrontEnd\GameSetupLogic.lua.MapSize_ValueNeedsChanging you'll find:

Code:
 -- TODO: Add Min/Max city states, set defaults.

I've had no luck changing the number of city states by changing those values in MapSizes, though I can verify the changes are in the DB. I also had no luck calling MapConfiguration.SetMinMinorPlayers(20), etc., at that "TODO" comment.
 
[edit]As mentioned a few replies down this doesn't actually affect the city-states number added to a game:

Your changes have no effect because you are looking at a UI file: the data from within it is only for UI display to the player.

The relevant code would appear to be in AssignStartingPlots.lua:
Code:
	--Find Default Number
	MapSizeTypes = {};
	for row in GameInfo.Maps() do
		MapSizeTypes[row.RowId] = row.DefaultPlayers;
	end
	local sizekey = Map.GetMapSize() + 1;
	local iDefaultNumberPlayers = MapSizeTypes[sizekey] or 8;
	self.iDefaultNumberMajor = iDefaultNumberPlayers ;
	self.iDefaultNumberMinor = math.floor(iDefaultNumberPlayers * 1.5);
The xml table being accessed is the from the Gameplay rather than Configuration side of the database: C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Gameplay\Data/Maps.xml

C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization VI\Base\Assets\Maps\Utility\AssignStartingPlots.lua
 
Last edited:
Added UserInterface example to OP.
Code:
        <UserInterface>     
            <Properties>
                <Context>InGame</Context>
            </Properties>
            <Items>
                <File>YourUI.xml</File>
            </Items>
        </UserInterface>

with both the xml and corresponding YourUI.lua file listed in the <Files> section, and I've used this in the YourUI.xml
(as I only use it for a script ATM)
<?xml version="1.0" encoding="utf-8" ?>
<Context Name="YourUI">
</Context>
 
Last edited:
Status
Not open for further replies.
Top Bottom