Multiplayer, XML's, DLC folders and stuff

Iconian

Chieftain
Joined
May 16, 2021
Messages
73
I've visited the CivFanatics forum a number of times in the past, but now I've decided to create an account and start this thread.

I have a few questions about mods. I started working on a very large Civ 5 mod about 2 years ago, but ended up having new priorities arise and couldn't get back to it until the last few weeks. For the mod I've made extensive changes to the XML files, and once the mod is finished I plan on instructing users to make a copy of their current XML folder in Assets>DLC>Expansion2>Gameplay, and then replace the original with my XML folder. I consider this necessary because I've made such a large number of changes. I didn't really make much consideration for using those XML's for multiplayer games, one way or another, as I've never played multiplayer myself. So this brings me to my first question:

1. My understanding is that if two people playing Civ 5 both use the same set of XML files they should be able to play multiplayer with each other. Is that correct? Again, single-player has been my priority, not multiplayer, but I figure I should ask about it.


Next, I have a smaller mod I want to make prior to the large one I've mentioned above. I watched a video tutorial for modding and as of now I've already created a few small mods for the Steam Workshop, so I am somewhat familiar with Modbuddy, but I want to avoid working with SQL and Lua files if I can help it. And so far as I can tell, all the changes I want to make can be done just with the XML's.

The specific mod I want to make would change the recon flavors for probably all the civs in the game, as I have a cheap scouts mod out, and now want to change the leaders' recon flavors to make appropriate use of the mod. I want to be able to modify all the recon flavors individually. Basically I want to increase most or all of them, but each by different amounts--one civ might have its recon flavor increased by 5, another by 1, another by 3, etc--something I'll have to decide individually. That brings me to the second question.

2. Does anyone know what specific XML command would change a given leader's recon flavor? I've tried finding such a command in one or two tutorials, as well as looking around the Workshop for mods that already modify flavors. I've been surprised that thus far I haven't run across a single mod that modifies existing recon flavors though.

Looking in the "Leaders" folder, I know that I can modify some of the recon flavors by having players replace their XML folder--but for my small recon mod I wouldn't want to ask mod users to do that, and besides that, and besides that, not all of the civs' info is in the main XML folder. And that segues into the next issue.


While many of the relevant files for different civs are in the main XML folder, many others are dispersed throughout various DLC folders, and are bit of a pain to locate or get to, particularly seeing that I have planned many small changes that will require repeated fine-tuning of the various numbers to get my large mod in particular all cohesive with itself. Also, having users of my large mod replace just the XML folder with my version is relatively user-friendly. Having them go all around and replace lots of different XML files . . . not so much.

What I've been wondering is if there's a good way to centralize the information from the smaller DLC folders into one location. One thing I've started considering is actually deleting the civs that are associated with those folders from the game, then using my mod to add them back in, so that I'd have all their info in a few XML files in my mod that I'd have easy to access to repeatedly modify. But I'm not sure how easy, or successful, of an idea it would be to delete that many civs from the game. I know they tend to have lots of tentacles around in different locations here and there, and I'm not too sure what the consequences would be.

3. Does anyone have any good ideas on how to easily modify all the information on the civs added to the game in the various DLC folders? A single sweeping command that changes values is not enough, as I intend to have to go back repeatedly to make many small changes for fine-tuning.

My very large mod is around 90% complete at this point, all only using XML. I'd prefer not to have to learn to use SQL or LUA to do this, but if it's just a few small commands I might be up to it.

Any help would be appreciated.
Thank you :)
 
Code:
<GameData>
	<Leader_Flavors>
		<Update>
			<Where LeaderType="LEADER_NEBUCHADNEZZAR" FlavorType="FLAVOR_ARCHAEOLOGY" />
			<Set Flavor="7" />
		</Update>
	</Leader_Flavors>
</GameData>
This example would alter Nebbies' Leader Flavor for Archeology from the standard setting of "5" to a new setting of "7"

You can add this to a new xml file within your recon mod (obv changing the FlavorType to that for Recon -- FLAVOR_RECON) and then make sure your new file is set to update to the game's database. Alternately you can just add the stuff in the example that is updating the <Leader_Flavors> directly into the same XML file where you are making your changes to Recon units.

When making a true mod rather than directly-editing the game's xml files, you don't care what folder the original XML file is located in nor what the name of the file is -- you just care about the contents within the file, and then only as a guide so you know what the original settings were. In a mod you do not care about the names of your files other than a "standard" naming convention will help you find the code you altered previously. All you care about is the contents of your XML files, because that is all the game cares about when loading the contents of an XML or SQL file.

Everything contained within the game's xml files (whether from Vanilla or Expansions or DLC) is first translated into SQL code and then inserted into a single unified SQL database from which the game runs. Code within mods is sent to this same unified SQL database -- all SQL databases care about is code (ie, file contents) rather than the names of files.

Making a mod instead of directly-editing original game files inherently gives you a central location where all your changes to the game are located. Patches to the game (not likely at this point, tbh) have no effect on the contents of any mod other than patches can potentially break mods by altering the fundamentals the mod-maker worked with when making the mod. But the code itself that is within the mod is not affected.

Unfortunately you have put a lot of time into a modding method that is I am sorry to say one of the most common mistakes inexperienced modders make. I honestly can't see that many people at this point in the game's lifecycle are going to be willing to copy/paste to replace the original game files with custom versions of them simply because of the amount of work involved. At one time it was necessary for certain kinds of mods (mostly those with new unit animation art) to directly over-write original game files, but this has not been necessary for multiple years and the userbase community has gotten used to the idea of not needing to do this as a general rule just to try out and run a new mod.

Don't despair, however. If it were me, I would :
  1. create a new empty folder directly in your MyDocuments to hold all the alterred copies of the original game files
  2. Copy all the files you have altered into that central folder.
  3. Create a new empty mod using modbuddy and add an XML file to it for (for example) changes you have made to civilizations.
  4. Copy the contents of the changes you have made to civilizations into this file
  5. Everywhere you see the "word" Row change it to Replace. Everywhere you see an "ID" designation within one of the original game files you have edited, delete that entire line of the code. So the end result would look something like this for America and Arabia. Instead of this
    Code:
    <GameData>
    	<Civilizations>
    		<Row>
    			<ID>0</ID>
    			<Type>CIVILIZATION_AMERICA</Type>
    			<Description>TXT_KEY_CIV_AMERICA_DESC</Description>
    			<ShortDescription>TXT_KEY_CIV_AMERICA_SHORT_DESC</ShortDescription>
    			<Adjective>TXT_KEY_CIV_AMERICA_ADJECTIVE</Adjective>
    			<CivilopediaTag>TXT_KEY_CIV5_UNITEDSTATES</CivilopediaTag>
    			<DefaultPlayerColor>PLAYERCOLOR_AMERICA</DefaultPlayerColor>
    			<ArtDefineTag>ART_DEF_CIVILIZATION_AMERICA</ArtDefineTag>
    			<ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
    			<PortraitIndex>0</PortraitIndex>
    			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
    			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
    			<MapImage>MapAmerica512.dds</MapImage>
    			<ArtStyleSuffix>_EURO</ArtStyleSuffix>
    			<ArtStylePrefix>EUROPEAN </ArtStylePrefix>
    			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_UNITEDSTATES_TEXT</DawnOfManQuote>
    			<DawnOfManImage>DOM_Washington.dds</DawnOfManImage>
    			<DawnOfManAudio>AS2D_DOM_SPEECH_UNITED_STATES</DawnOfManAudio>
    		</Row>
    		<Row>
    			<Type>CIVILIZATION_ARABIA</Type>
    			<Description>TXT_KEY_CIV_ARABIA_DESC</Description>
    			<ShortDescription>TXT_KEY_CIV_ARABIA_SHORT_DESC</ShortDescription>
    			<Adjective>TXT_KEY_CIV_ARABIA_ADJECTIVE</Adjective>
    			<CivilopediaTag>TXT_KEY_CIV5_ARABIA</CivilopediaTag>
    			<DefaultPlayerColor>PLAYERCOLOR_ARABIA</DefaultPlayerColor>
    			<ArtDefineTag>ART_DEF_CIVILIZATION_ARABIA</ArtDefineTag>
    			<ArtStyleType>ARTSTYLE_MIDDLE_EAST</ArtStyleType>
    			<ArtStyleSuffix>_AFRI</ArtStyleSuffix>
    			<ArtStylePrefix>AFRICAN </ArtStylePrefix>
    			<PortraitIndex>1</PortraitIndex>
    			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
    			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
    			<MapImage>MapAbbasid512.dds</MapImage>
    			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_ARABIA_TEXT</DawnOfManQuote>
    			<DawnOfManImage>DOM_AlRashid.dds</DawnOfManImage>
    			<DawnOfManAudio>AS2D_DOM_SPEECH_ARABIA</DawnOfManAudio>
    		</Row>
    	</Civilizations>
    </GameData>
    You would want this
    Code:
    <GameData>
    	<Civilizations>
    		<Replace>
    			<Type>CIVILIZATION_AMERICA</Type>
    			<Description>TXT_KEY_CIV_AMERICA_DESC</Description>
    			<ShortDescription>TXT_KEY_CIV_AMERICA_SHORT_DESC</ShortDescription>
    			<Adjective>TXT_KEY_CIV_AMERICA_ADJECTIVE</Adjective>
    			<CivilopediaTag>TXT_KEY_CIV5_UNITEDSTATES</CivilopediaTag>
    			<DefaultPlayerColor>PLAYERCOLOR_AMERICA</DefaultPlayerColor>
    			<ArtDefineTag>ART_DEF_CIVILIZATION_AMERICA</ArtDefineTag>
    			<ArtStyleType>ARTSTYLE_EUROPEAN</ArtStyleType>
    			<PortraitIndex>0</PortraitIndex>
    			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
    			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
    			<MapImage>MapAmerica512.dds</MapImage>
    			<ArtStyleSuffix>_EURO</ArtStyleSuffix>
    			<ArtStylePrefix>EUROPEAN </ArtStylePrefix>
    			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_UNITEDSTATES_TEXT</DawnOfManQuote>
    			<DawnOfManImage>DOM_Washington.dds</DawnOfManImage>
    			<DawnOfManAudio>AS2D_DOM_SPEECH_UNITED_STATES</DawnOfManAudio>
    		</Replace>
    		<Replace>
    			<Type>CIVILIZATION_ARABIA</Type>
    			<Description>TXT_KEY_CIV_ARABIA_DESC</Description>
    			<ShortDescription>TXT_KEY_CIV_ARABIA_SHORT_DESC</ShortDescription>
    			<Adjective>TXT_KEY_CIV_ARABIA_ADJECTIVE</Adjective>
    			<CivilopediaTag>TXT_KEY_CIV5_ARABIA</CivilopediaTag>
    			<DefaultPlayerColor>PLAYERCOLOR_ARABIA</DefaultPlayerColor>
    			<ArtDefineTag>ART_DEF_CIVILIZATION_ARABIA</ArtDefineTag>
    			<ArtStyleType>ARTSTYLE_MIDDLE_EAST</ArtStyleType>
    			<ArtStyleSuffix>_AFRI</ArtStyleSuffix>
    			<ArtStylePrefix>AFRICAN </ArtStylePrefix>
    			<PortraitIndex>1</PortraitIndex>
    			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
    			<AlphaIconAtlas>CIV_ALPHA_ATLAS</AlphaIconAtlas>
    			<MapImage>MapAbbasid512.dds</MapImage>
    			<DawnOfManQuote>TXT_KEY_CIV5_DAWN_ARABIA_TEXT</DawnOfManQuote>
    			<DawnOfManImage>DOM_AlRashid.dds</DawnOfManImage>
    			<DawnOfManAudio>AS2D_DOM_SPEECH_ARABIA</DawnOfManAudio>
    		</Replace>
    	</Civilizations>
    </GameData>
  6. For subsidiary tables that don't use column "Type" you can just do this
    Code:
    	<Civilization_BuildingClassOverrides>
    		<Delete CivilizationType="CIVILIZATION_ARABIA" />
    		<Row>
    			<CivilizationType>CIVILIZATION_ARABIA</CivilizationType>
    			<BuildingClassType>BUILDINGCLASS_MARKET</BuildingClassType>
    			<BuildingType>BUILDING_BAZAAR</BuildingType>
    		</Row>
    	</Civilization_BuildingClassOverrides>
    America does not have a Unique Building so you don't need to do anything in this table for America.
You will have to rinse, repeat for Leaders, Buildings, Units, etc., that you have changed. But this will when completed give you everything you have changed in one central location (ie, within the actual mod) as well as not requiring users to replace original game files with customized versions in multiple different file locations. Steps 1 and 2 aren't going to be any more work than you would already need to do in order to package all your customized files into a mod that users would have to copy/paste to their game folders.
 
Couple of extra final thoughts and notes.

Do not include any of this table definition stuff in any of the files you create following the suggestions above. These are all table definitions
Code:
	<!-- Table definition -->
	<Table name="Civilizations">
		<Column name="ID" type="integer" primarykey="true" autoincrement="true"/>
		<Column name="Type" type="text" notnull="true" unique="true"/>
		<Column name="Description" type="text" reference="Language_en_US(Tag)"/>
		<Column name="Civilopedia" type="text" default="NULL"/>
		<!-- NOTE: This column is deprecated (for this table only). -->
		<Column name="CivilopediaTag" type="text"/>
		<Column name="Strategy" type="text" reference="Language_en_US(Tag)"/>
		<Column name="Playable" type="boolean" default="true"/>
		<Column name="AIPlayable" type="boolean" default="true"/>
		<Column name="ShortDescription" type="text" default="NULL" reference="Language_en_US(Tag)"/>
		<Column name="Adjective" type="text" default="NULL" reference="Language_en_US(Tag)"/>
		<Column name="DefaultPlayerColor" type="text" default="NULL" reference="PlayerColors(Type)"/>
		<Column name="ArtDefineTag" type="text" default="NULL"/>
		<Column name="ArtStyleType" type="text" default="NULL"/>
		<Column name="ArtStyleSuffix" type="text" default="NULL"/>
		<Column name="ArtStylePrefix" type="text" default="NULL"/>
		<Column name="DerivativeCiv" type="text" default="NULL"/>
		<!--NOTE: This column is deprecated (for this table only). -->
		<Column name="PortraitIndex" type="integer" default="-1"/>
		<Column name="IconAtlas" type="text" default="NULL" reference="IconTextureAtlases(Atlas)"/>
		<Column name="AlphaIconAtlas" type="text" default="NULL" reference="IconTextureAtlases(Atlas)"/>
		<Column name="MapImage" type="text" default="NULL"/>
		<Column name="DawnOfManQuote" type="text" default="NULL"/>
		<Column name="DawnOfManImage" type="text" default="NULL"/>
		<Column name="DawnOfManAudio" type="text" default="NULL"/>
		<Column name="PackageID" type="text" default="NULL"/>
		<Column name="SoundtrackTag" type="text" default="NULL"/>
	</Table>
	<Table name="Civilization_BuildingClassOverrides">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="BuildingClassType" type="text" notnull="true" reference="BuildingClasses(Type)"/>
		<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
	</Table>
	<Table name="Civilization_CityNames">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="CityName" type="text" notnull="true" reference="Language_en_US(Tag)"/>
	</Table>
	<Table name="Civilization_DisableTechs">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="TechType" type="text" reference="Technologies(Type)"/>
	</Table>
	<Table name="Civilization_FreeBuildingClasses">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
	</Table>
	<Table name="Civilization_FreeTechs">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="TechType" type="text" reference="Technologies(Type)"/>
	</Table>
	<Table name="Civilization_FreeUnits">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="UnitClassType" type="text" reference="UnitClasses(Type)"/>
		<Column name="UnitAIType" type="text" reference="UnitAIInfos(Type)"/>
		<Column name="Count" type="integer"/>
	</Table>
	<Table name="Civilization_Leaders">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="LeaderheadType" type="text" reference="Leaders(Type)"/>
	</Table>
	<Table name="Civilization_Religions">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="ReligionType" type="text" reference="Religions(Type)"/>
	</Table>
	<Table name="Civilization_SpyNames">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="SpyName" type="text" notnull="true" reference="Language_en_US(Tag)"/>
	</Table>
	<Table name="Civilization_UnitClassOverrides">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="UnitClassType" type="text" notnull="true" reference="UnitClasses(Type)"/>
		<Column name="UnitType" type="text" reference="Units(Type)"/>
	</Table>
	<Table name="Civilization_Start_Along_Ocean">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="StartAlongOcean" type="boolean" default="false"/>
	</Table>
	<Table name="Civilization_Start_Along_River">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="StartAlongRiver" type="boolean" default="false"/>
	</Table>
	<Table name="Civilization_Start_Region_Priority">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="RegionType" type="text" reference="Regions(Type)"/>
	</Table>
	<Table name="Civilization_Start_Region_Avoid">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="RegionType" type="text" reference="Regions(Type)"/>
	</Table>
	<Table name="Civilization_Start_Place_First_Along_Ocean">
		<Column name="CivilizationType" type="text" reference="Civilizations(Type)"/>
		<Column name="PlaceFirst" type="boolean" default="false"/>
	</Table>
Adding them into the code of a mod XML file will cause the game to reject the entire contents of the XML file because these table definitions were already given in the game's original files.

You will likely make mistakes in code, see this tutorial on how to enable error logging: whoward69's enable error logging tutorial
By moving your changes to the game into a proper mod, when you make code mistakes you will not cause your entire game to become borked and unplayable until you fix the mistake. You will get error messages in Database,log clueing to the problem so you can solve it.

Post questions and ask for help when needed. Just bear in mind that the people who have your answers may not see your thread / question right away and that the answer may take a while. I only just today saw this thread, so, there's an example. Generally though it does not take multiple months to get any sort of feedback.
 
Top Bottom