View Full Version : Fast mod creation and merging


rf900
Nov 05, 2010, 05:14 AM
Not sure if this has been found out before but there is an easy way to generate and merge mods that only imply xml changes.

You will have to use the SQLite addon for Firefox (https://addons.mozilla.org/en-US/firefox/addon/5817/) I am looking for other tools to provide additional functionality.

Steps to merge:

1- Run the game and activate whatever mods you want. It would be good to do it with vanilla also to have a copy of the original settings. Go into the addon and open the database (Civ5DebugDatabase.db), then in Database>ExportDatabase you can save it as an sql file. This sql file has all the needed code to recreate the modifications in one go.

2- Create your own mod and use that sql file that has all the "xml" changes. Still looking for a way to easily merge lua bits.


Steps to create mods:

1- Open the vanilla database.

2- Make modifications directly in the addon, change values, add rows...

3- Same thing Database>ExportDatabase and you will have the sql code to generate your mod.

4- To clean it up a bit, use a text comparisson tool (WinMerge) and compare both the sql generate with vanilla and the one after modification. That will indicate the sentences that have changed, leave only those and you will have your mod more understandable.


The texts are kept in My Documents\My Games\Sid Meier's Civilization 5\cache Civ5LocalizationDatabase.db so that one can also be exported.

Whys
Nov 05, 2010, 08:50 PM
I like it, but just one thing...

What about deletes? Updates and inserts will show up just fine, but deletes aren't going to carry over, are they? They'll show up as a difference, but as a difference in the vanilla file, not the mod file.

rf900
Nov 08, 2010, 01:43 AM
Deletes should carry over, what the sql generated does is recreate the entire database from scratch. So if you remove a row from a table when the database is recreated it will have that same row removed (or more exactly it will not add that row).

Here is an example from the first few lines, you can see it deletes each table and creates them again:

DROP TABLE IF EXISTS "AICityStrategies";
CREATE TABLE AICityStrategies ('ID' integer primary key autoincrement , 'Type' text not null unique , 'CheckTriggerTurnCount' integer , 'MinimumNumTurnsExecuted' integer , 'WeightThreshold' integer default 0 , 'NoMinorCivs' boolean default 0 , 'Permanent' boolean default 0 , 'TechPrereq' text default NULL , 'TechObsolete' text default NULL , 'Advisor' text , 'AdvisorCounsel' text , 'AdvisorCounselImportance' integer default 1 , foreign key (TechPrereq) references Technologies(Type), foreign key (TechObsolete) references Technologies(Type));
INSERT INTO "AICityStrategies" VALUES(0,'AICITYSTRATEGY_SMALL_CITY',5,5,0,0,0,NUL L,NULL,'ECONOMIC','TXT_KEY_AICITYSTRATEGY_SMALL_CI TY',1);
INSERT INTO "AICityStrategies" VALUES(1,'AICITYSTRATEGY_MEDIUM_CITY',5,5,0,0,0,NU LL,NULL,NULL,NULL,1);
INSERT INTO "AICityStrategies" VALUES(2,'AICITYSTRATEGY_LARGE_CITY',5,5,0,0,0,NUL L,NULL,NULL,NULL,1);

I am going to convert my mod to SQL lines only, hope to make it more manageable and get rid of redundant and conflicting changes.

Whys
Nov 08, 2010, 03:15 AM
Cool. No more XML. :)

Thanks for the tip.