Civ VI: Map Players for each Map Size fix

Joszs

Chieftain
Joined
Oct 27, 2016
Messages
5
Hi Modders,

I created a simple fix which raises the number of max players for each map to 20. It works when I just modify it in the civilization 6 source code. But when I add the same overwrite as a mod it doesn't work. I think that the system cannot find the file which needs to be overwritten, the mod is loaded when a map is started instead of when the menu is started or that the vanilla configuration overwrites the mod. The vanilla file can be found in Assets\Configuration\Data\MapSizes.xml and contains the following code:

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GameInfo>
    <MapSizes>
        <Row MapSizeType="MAPSIZE_DUEL" Name="LOC_MAPSIZE_DUEL_NAME" Description="LOC_MAPSIZE_DUEL_DESCRIPTION" MinPlayers="2" MaxPlayers="4" DefaultPlayers="2" MinCityStates="0" MaxCityStates="6" DefaultCityStates="3" SortIndex="10" />
        <Row MapSizeType="MAPSIZE_TINY" Name="LOC_MAPSIZE_TINY_NAME" Description="LOC_MAPSIZE_TINY_DESCRIPTION" MinPlayers="2" MaxPlayers="6" DefaultPlayers="4" MinCityStates="0" MaxCityStates="10" DefaultCityStates="6" SortIndex="20" />
        <Row MapSizeType="MAPSIZE_SMALL" Name="LOC_MAPSIZE_SMALL_NAME" Description="LOC_MAPSIZE_SMALL_DESCRIPTION" MinPlayers="2" MaxPlayers="10" DefaultPlayers="6" MinCityStates="0" MaxCityStates="14" DefaultCityStates="9" SortIndex="30" />
        <Row MapSizeType="MAPSIZE_STANDARD" Name="LOC_MAPSIZE_STANDARD_NAME" Description="LOC_MAPSIZE_STANDARD_DESCRIPTION" MinPlayers="2" MaxPlayers="14" DefaultPlayers="8" MinCityStates="0" MaxCityStates="18" DefaultCityStates="12" SortIndex="40" />
        <Row MapSizeType="MAPSIZE_LARGE" Name="LOC_MAPSIZE_LARGE_NAME" Description="LOC_MAPSIZE_LARGE_DESCRIPTION" MinPlayers="2" MaxPlayers="16" DefaultPlayers="10" MinCityStates="0" MaxCityStates="22" DefaultCityStates="15" SortIndex="50" />
        <Row MapSizeType="MAPSIZE_HUGE" Name="LOC_MAPSIZE_HUGE_NAME" Description="LOC_MAPSIZE_HUGE_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="12" MinCityStates="0" MaxCityStates="24" DefaultCityStates="18" SortIndex="60" />       
    </MapSizes>
</GameInfo>

My Mod is called MaxPlayers and has the following modinfo file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="ECAD2272-CCE4-49A9-9926-B1B31D72C0ED" version="1">
    <Properties>
        <Name>Max Players Fix</Name>
        <Teaser/>
        <Description>Each map size now has a maximum number of 20 civilizations.</Description>
        <Authors>Joszs</Authors>
        <ShowInBrowser>Show</ShowInBrowser>
        <EnabledByDefault>1</EnabledByDefault>
        <EnabledAtStartup>1</EnabledAtStartup>
    </Properties>
    <Components>
        <UpdateDatabase id="JOSZS_MAXPLAYERS">
            <Items>
                <File>Data/MaxPlayers_MapSizes.xml</File>
            </Items>
        </UpdateDatabase>
    </Components>
    <Files>
        <File>Data/MaxPlayers_MapSizes.xml</File>
    </Files>
</Mod>

The Data/MaxPlayers_MapSizes.xml file consists of the following code:

Code:
<GameInfo>
    <MapSizes>
        <Row MapSizeType="MAPSIZE_DUEL" Name="LOC_MAPSIZE_DUEL_NAME" Description="LOC_MAPSIZE_DUEL_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="2" MinCityStates="0" MaxCityStates="6" DefaultCityStates="3" SortIndex="10" />
        <Row MapSizeType="MAPSIZE_TINY" Name="LOC_MAPSIZE_TINY_NAME" Description="LOC_MAPSIZE_TINY_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="4" MinCityStates="0" MaxCityStates="10" DefaultCityStates="6" SortIndex="20" />
        <Row MapSizeType="MAPSIZE_SMALL" Name="LOC_MAPSIZE_SMALL_NAME" Description="LOC_MAPSIZE_SMALL_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="6" MinCityStates="0" MaxCityStates="14" DefaultCityStates="9" SortIndex="30" />
        <Row MapSizeType="MAPSIZE_STANDARD" Name="LOC_MAPSIZE_STANDARD_NAME" Description="LOC_MAPSIZE_STANDARD_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="8" MinCityStates="0" MaxCityStates="18" DefaultCityStates="12" SortIndex="40" />
        <Row MapSizeType="MAPSIZE_LARGE" Name="LOC_MAPSIZE_LARGE_NAME" Description="LOC_MAPSIZE_LARGE_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="10" MinCityStates="0" MaxCityStates="22" DefaultCityStates="15" SortIndex="50" />
        <Row MapSizeType="MAPSIZE_HUGE" Name="LOC_MAPSIZE_HUGE_NAME" Description="LOC_MAPSIZE_HUGE_DESCRIPTION" MinPlayers="2" MaxPlayers="20" DefaultPlayers="12" MinCityStates="0" MaxCityStates="24" DefaultCityStates="18" SortIndex="60" />       
    </MapSizes>
</GameInfo>

When I start up the game the Mod is found and is turned on. Does someone know what causes the Mod not to work?
 
I'm not sure, but it seems mods files are loaded when a game starts, not when the application is launched. It's weird.
 
How do you modify a .lua file through a mod? I want to fix the alt control camera spin to be permanent, this works now when I edit the source code but I want it in a mod so I can share it.
 
I just tried 2 days ago to do my first mod. I just read the thread .modinfo structure and look at what others modders have done (meaning, download their mods and look their files). Somehow, i did it :). I'm sure you can too.
Edit:
Here is the link to the source code of the Quick UI mod from vans163. he too changes some lua files.
You will need to do something like this:
Spoiler modinfo :
<Mod id="11111111-1111-1111-1111-111111111111" version="1">
<Properties>
<Name>Name of your mod</Name>
<Teaser>Short Description</Teaser>
<Description>LOC_DESCRIPTION</Description>
<Authors>Your name goes here</Authors>
<SpecialThanks>My name goes here :)</SpecialThanks>
</Properties>
<Components>
<ImportFiles>
<Items>
<File>YourGameplayScripts.Lua</File>
</Items>
</ImportFiles>
</Components>
<Files>
<File>YourGameplayScripts.Lua</File>>
</Files>
</Mod>

As for what you want to do ("alt" thing with the camera) i've nooo idea how you do this! But it is a nice idea :)
 
Last edited:
You cannot alter table MapSizes from any file activated in the modinfo file under
<UpdateDatabase id="xxxxxxxxxxxxx">

You need to place the code into a file that is activated in the modinfo file like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" version="1">
     <Properties>
          <Name>LOC_MOD_TITLE</Name>
          <Teaser>LOC_MOD_TEASER</Teaser>
          <Description>LOC_MOD_DESCRIPTION</Description>
          <Authors>LOC_MOD_AUTHORS</Authors>
     </Properties>
     <Settings>
          <Custom id="xxxxxxxxxxxxxxxxxxx">
               <Items>
                    <File>File.xml</File>
               </Items>
          </Custom>
     </Settings>
     <LocalizedText>
          <Text id="LOC_MOD_TITLE">
               <en_US>Mod Name</en_US>
          </Text>
          <Text id="LOC_MOD_TEASER">
               <en_US>Mod Teaser</en_US>
          </Text>
          <Text id="LOC_MOD_DESCRIPTION">
               <en_US>Mod Description</en_US>
          </Text>
          <Text id="LOC_MOD_AUTHORS">
               <en_US>Author</en_US>
          </Text>
     </LocalizedText>
     <Files>
          <File>File.xml</File>
     </Files>
</Mod>
The contents of the File.xml would need to be as this:
Code:
<GameInfo>
     <MapSizes>
          <Update>
               <Set MaxPlayers="20" />
          </Update>
     </MapSizes>
</GameInfo>
Attempting to re-state and thereby re-define the existing Rows within the table will simply cause the game to both reject your code and to lock the game's database from all further changes via mods until you close out and restart the game.

This also assumes we are allowed to use "Update" to the game configuration database. I have not as yet attempted an update on the "configurations" side of the CIV6 database.
 
I can confirm that it works fine.
 
Back
Top Bottom