Modding of yore VS modding nowadays (asking for help :))

Ikael

King
Joined
Dec 2, 2005
Messages
873
Soooo after extensive modding during my old Civ 2 and Civ 3 days, I felt compelled to re-take this old past time of mine and try to bring some balance to the force (mainly, to the much, much flawed BE, but also to Civ 5).

So I have already watched the first two tutorial videos about how to mod Civ 5. I've got my Modbuddy installed, and I've been pointed out towards what I consider to be the game's "treasure cove", aka the .xml files that contains the entirety of the game's rules. Yay! So far, so good, very similar to ye olde Civ 2 modding! I have only to modify the xml rules and... well, modding doesn't seem to work like that anymore.

For what I've seen so far, rather than replacing the xml entirely a la civ 2 .txt replacement, the mod has to instruct the game to change only certain, precise parameters of the said xml, a la programming orders.

While not complex per se, this seems like a much, much more cucumbersome and tedious way of modding than just tweaking the game ruleset directly and replacing it on its entirety like on previous Civ entries. Is there any way to create mods in that oldschool way? Is it there a command for "replace the game's xml with my mod's" so I can focus on tinkering with the game's ruleset rather than coding?

Thank you in advance for helping this noob / old modder! :D
 
I have no idea how older Civs worked, but C5 uses database to store settings. And XML files are not some sort of config files to store parameters, but these are instructions to tell the game at start what it needs to do with its database (remove, add, update records).

If you load the game without mods, it uses its original unaltered database. But if you enable any mod with XML then the game reads during start sequence those instructions in XML file and updates database accordingly.
 
Hmmm, I think I understand the process. But can you tell the mod to outright replace a different database on its entirety with one of your own creation rather than ordering punctual alterations to apply over the original database?

Also, if we use modbuddy and its XML in order to give instructions to the game so it modifies a certain number of parameters, where are located the config files that store the said parameters?
 
The entire database is located in Documents\My Games\Sid Meier's Civilization 5\cache\Civ5DebugDatabase.db - you can view it using any program that can open SQLite databases (I use the SQLite Managaer add-on for the Firefox browser).

You can delete the content of an entire table in the database and replace it with your own content, but in some cases in can cause problems - see this thread.
 
I can only add that XML files are just one of the ways to manipulate the data in game's database. You may want to check .sql files instead, as they are much simpler and cleaner in structure, and more robust to make a lot of many changes in database than somehow "cluttered" and unorganized XML files.
 
First of all, thank you guys for your answers! What a supportive community! :)

Yep, the .sql files, they are indeed far, far more clean and simple than the .xml boondongle. Can you modify them trought Modbuddy and xml instructions, or do you need to do it by hand?
 
Well, if you need to modify a LOT of variables in a single .xml file, and you have some coding-know-how, you can write a script (I used Python) to create a copy of the file, replace the 'Row's with 'Update's (along with some other string/substring manipulation to get it into the ''correct'' format), and you have yourself a .xml file that you can tweak in modbuddy a-la-Civ4 (and I suppose for Civ2-3 as well?) style.

Works best for tables with very few columns (such as Defines), but can be scaled for larger tables (just a lot more copy-pasting and debugging when you accidentally reference the wrong character index of the string or something).
 
Yep, the .sql files, they are indeed far, far more clean and simple than the .xml boondongle. Can you modify them trought Modbuddy and xml instructions, or do you need to do it by hand?

You can edit both types in ModBuddy but SQL files and XML files have no any connections with each other at all. You can't manipulate one with another. SQL stands for Structured Query Language, and XML for eXtensible Markup Language. Both are just text files with different extensions and structure.
SQL is used to manipulate the data in database only and nothing else. XML can do the same but uses just different syntax. It is just matter of personal preference what solution you want to use to manipulate data in game's DB.
Though while working with XML knowing stucture of DB is not necessary for many tasks, but if you work with SQL the knowledge of DB's structure is a must.
 
Hmmm, so what do you guys think that it is the optimal solution for non-heavy modding?

And welp, thing is, I have no coding know-how or whatsoever. I only know about tinkering with databases and copy-pasting bits of code a la web-designer, hence my interest in looking at the original game code / databases so I can just tune it for my purpouses rather than building programing orders and lines of code from scratch (kinda like meddling with .html without knowing how to program).
 
Then whether you want to go with .xml or SQL, will be purely as a decision of what flavour you want to go with (since you will essentially be starting from scratch, because as noted, XML modding in Civ5 is completely different from XML modding in previous versions), as both forms of editing are essentially writing a query to the database to perform a new entry/update/delete entry.
 
Thanks for the imput Thorhammerz!

I've one additional question: If I want to mod BNW, can I do it trought Modbuddy? Also, where can I find the BNW .xml files? I've been looking for them like crazy so I can mod religion :S

Anyways, I will start with something simple like adding pantheons, and then I will publish it here, so stay tuned! :D
 
Thanks for the imput Thorhammerz!

I've one additional question: If I want to mod BNW, can I do it trought Modbuddy?

That's what ModBuddy is for :)

Also, where can I find the BNW .xml files? I've been looking for them like crazy so I can mod religion :S

Anyways, I will start with something simple like adding pantheons, and then I will publish it here, so stay tuned! :D

assets\DLC\Expansion2\Gameplay\XML (Some XML files are missing here, in these cases the vanilla files from assets\Gameplay\XML are used.)
 
Ikael said:
I've one additional question: If I want to mod BNW, can I do it trought Modbuddy? Also, where can I find the BNW .xml files? I've been looking for them like crazy so I can mod religion :S

A quick tip if you cannot find the specific table "row" in the Expansion2 DLC Assets XML: you can find all the game data arranged in its table format in the debug database file (Civ5DebugDatabase.db), located in under the Civ5 folder inside the cache folder under my documents (basically, the its where you find your MODS folder under my documents).

This database will also update (need to refresh table with the refresh button however) in real-time in response to your XML mod changes (on loading your mod, no need to actually start a game), so it is a very useful tool to check if what you think you changed actually went through.

This is important as a LOT of the tooltips and UI text in-game is NOT linked to the actual game changes (gone are the days in Civ4 where the only text changes you really had to do was to change the Civilopedia lore entries) - only a select few raw stat numbers (such as cost, combat, flat yield amounts) will change in response to your tweaks (i.e. Social Policy tooltip text, religion belief text, etc need to be manually updated to reflect your changes).
 
Ok, so I just finished my first mod attempt at trying to add one additional pantheon, "lake fairies" and...

...good news is, the game don't crash nor my PC explodes once I run it. Yay!

...bad news is, it doesn't work. It does not add my new pantheon D: I played with the mod activated and once I got to choose pantheons it simply didn't appear on the list of where to pick them up.

You can download it from here if you wish.

Any ideas as to why it is not working? Thank you guys in advance!
 
Some things I noticed that will make your mod fail:

1. Belief type name should start with BELIEF_ (so it should be BELIEF_LAKE_FAIRIES instead of LAKE_FAIRIES).
2. Multiple FeatureType tags in one <Row> in Belief_FeatureYieldChanges - if you want to increase yields from multiple features, you should have multiple <Row>s with one feature in each of them.
3. FEATURE_LAKE is not a real feature (it's only a fake feature used for civilopedia purposes), so changes to its yields won't work. Actually it's not easy to make a belief increase yields from lakes, I suppose you need a Lua script and a hidden building to do so.
4. It should be <Language_en_US> and <Text> instead of <language_en_US> and <text> - capitalization is important.
5. Did you add your XML file to the Actions tab? (OnModActivated -> UpdateDatabase)

Btw, you can attach small files to posts at this forum, no need to use an external service.

@ThorHammerz - beliefs don't need buttons, icons or anything like that. The text is created in the mod.
 
Holy freaking crap, there were so many mistakes on my mod, thanks a lot for pointing them out, PawelS.

I will try to correct the errors that you noticed, and I will try adding a more noob-friendly pantheon instead rather than landing straight in Lua madness territory

And nope, I didn't add any action tab nor update command. I guess that's why my pantheon was nowhere to be found once the game fired the mod. Could the order be added on the same xml file or should it be placed elsewhere?

As for the lake yields, damn, it is a shame that it can't be modded "naturally" :( are other features such as oasis or marshes also "fake" ones? As for buildings, how does one add invisible, non-tech dependant buildings? Perhaps I can increase lake yields by re-using the floating garden's UB code, I will try it latter and see what I can get.
 
The update action is added in the mod properties window, see here for more details.

Fake features are the ones that are in the FakeFeatures table - lakes and rivers. All other features are real :)

To make a building invisible (in BNW), set its GreatWorkCount to -1. It will be unbuildable if you set its Cost to -1. But you will need Lua to make this building appear in cities depending on the belief in their pantheon or religion.
 
Alright, I implemented PawelS's corrections (BELIEF label, multiple rows, proper capitalization) and made the Oncemodactivated => Update database action....

...still not working >____< the game boots correctly and doesn't crash, but once you get to pick your pantheon, the new one is nowhere to be found *sigh*
 

Attachments

  • New Pantheons.rar
    7.3 KB · Views: 26
The Belief_FeatureYieldChanges should look like this:
Code:
	<Belief_FeatureYieldChanges>
		<Row>
			<BeliefType>BELIEF_LAKE_FAIRIES</BeliefType>
			<FeatureType>FEATURE_LAKE</FeatureType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<BeliefType>BELIEF_LAKE_FAIRIES</BeliefType>
			<FeatureType>FEATURE_MARSH</FeatureType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<BeliefType>BELIEF_LAKE_FAIRIES</BeliefType>
			<FeatureType>FEATURE_OASIS</FeatureType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>2</Yield>
		</Row>
	</Belief_FeatureYieldChanges>

(As I wrote before, FEATURE_LAKE won't work, but it shouldn't make the mod fail.)

Also, in the text part, change all language to Language, and all <RowTag to <Row Tag
 
Top Bottom