Mod switcher

Michelangelo said:
Thanx tdb,

I installed version 0.4 and the library required and started to work. I use some EFA, MSDA mods and other non-game altering mods.

I set the preferences, and expected the mod directory that I set in the preferences to be the directory when I opened to look for a mod to create via CREATE MOD menu option. However it started in the standard mod dir.

Yeah, I guess that configuration option can be pretty confusing... The mods directory is where the difference files get stored. I should probably change it to something else. Storage directory perhaps? Do you have suggestions?

Michelangelo said:
I had to change the customassets folder name that comes with most mods to assest for your program to work. Is this the way to do it, or should it also work with the customassets dir-name.

That's as expected. AFAIK, Civ4 only looks for an Assets directory under mods. If this is wrong, I can make it also detect CustomAssets.

Michelangelo said:
BTW when I close the modder and reopen it, the mod I just created is not displayed, clicking refresh doesn't solve it, only when I click in the listbox, the mod-properties are displayed and if I say "save" the mod is displayed again.

Weird. Sounds like some kind of glitch in updating the window. Are you saying that the mod properties window is displayed right away when you click on the list? It shouldn't be until you select Mod Properties from the menu. Does this trick make all mods show up or only that one?

What versions of GTK and Gtkmm do you have?

Michelangelo said:
It looks like there are some small glitches in the finishing in this gem. Or i'm doing something competely wrong ;)

Indeed, that's why the version number begins with a 0. Any feedback on bugs or possible enhancements is welcome.

Michelangelo said:
BTW, where do you store the diff-info??

As previously noted, into the directory labeled "mod directory" in the preferences. By default this will be a directory called "mods" under civ4modder's directory. (Pay attention to the "working directory" setting if you're making shortcuts.)
 
Yeah, I guess that configuration option can be pretty confusing... The mods directory is where the difference files get stored. I should probably change it to something else. Storage directory perhaps? Do you have suggestions?
Ah, that explains it. Mayby you can have two preferences one for your store of separate mods to read from and one for Modder-mods (doesn't sound right though), mod vault, modlist. Your default choice of the mods-dir is offcourse a valid one, but it would be nice if we could overide it.

That's as expected. AFAIK, Civ4 only looks for an Assets directory under mods. If this is wrong, I can make it also detect CustomAssets.
I mostly use mods as use-allways mods in the custom assets dir. Most modmakers have their mods tailored to this so the dir-tree starts with custom assets. The game also looks in this directory for mods to use. I don't know however if you select a standard mod ingame how the game handles customassets.


Weird. Sounds like some kind of glitch in updating the window. Are you saying that the mod properties window is displayed right away when you click on the list? It shouldn't be until you select Mod Properties from the menu. Does this trick make all mods show up or only that one?

What versions of GTK and Gtkmm do you have?
GTK 2.0 and GTKmm 2.4 (2.8.8.1. via version info) just downloaded them today from your link.

This is what I get when opening modder,I get this screen
modder16wq.jpg


The version number is empty again, I inserted 0.95. If I reinsert it again and close it again, the mod is displayed correctly, like

modder37kv.jpg
 
Hm, looks like a problem with reading the mod file headers. Can you send me the .Civ4Mod file for that? EFA should have few enough changes that the file fits here as an attachment.
 
Noticed their wasn't any Building support on the element.txt I'll add it to the file and upload it here, if you think it looks good you could use it in the next update.

I'm realy enthusiastic about this tool it could be on par with the SDK in its significance to the Moding community.

EDIT: I was also thinking of a method to bundle diff files together as a quick way to get around dependencies, allow people to place folders containing Diff files in the Mods directory, the interface would then allow only the whole folder to be checked or unchecked, thus the user can create bundles of diff files that they know should always be compiled together and thus avoid dangling references. Yet they are still able to breakup their work into the smallest possible blocks such as individual units, techs or buildings so other can extract and re-use the bits with a minimum of work.
 
There's probably plenty of other stuff missing as well from the elements.txt file. Any help is appreciated. If you can, please send patch files (as generated by diff -u).

Good idea there with the folders. I could show them as an expandable group in the list so the individual components could be switched on or off as well, if the user so desires. (I'd very much like to have only the new resources from GreenMod...)

And thanks for showing so much interest in this program :) It's always nice to know my work is appreciated.
 
Excellent program! Does the last update (23/6) save the "changes" as whole xml files? Won't that make it impossible to select what mods you want to include and exclude?
 
Here's the updated elements.txt

I added, BuildingInfos, SpecialBuildingInfo, TraitInfos and PromotionInfos. I made some small additions to other areas ware they were lacking. Externalizing that list was a great idea, I see now that most of my trouble in the past versions was due to my habit of activating nested elements that arn't normal used in the game and thus weren't on the lists. The new warning "Such and such element has Children maybe its not a value element" is very handy for catching these ommisions, pervious versions just skiped such elements causing changes to not be recorded. Oh also when I compiled my New Traits Mod I got an 88% reduction in size :goodjob:

Also I see the program succesfully added new value Tags that I added with SDK work, I am shure if I add support for my my complex nested tags on elements.txt these will work as well and shouldn't cause any trouble for people not using them. Anyone have requests for additional documents which need support?

Good idea there with the folders. I could show them as an expandable group in the list so the individual components could be switched on or off as well, if the user so desires. (I'd very much like to have only the new resources from GreenMod...)

Actual that would defeat the point, the idea was that everything in the Folder needs to be compiled together or not at all because of cross dependency and dangling references. So for example I create a new Civ and reference 2 new leaders on the Civ, the 2 Leaders can be seperate Diff files of their own so I have 3 files and put them all in the folder. If you compiled the Civ without the leaders you would have a dangling reference on loading. Now if a person knows what their doing and wants to replace one of the leaders its rather easy for them to remove one leader file and replace it with another, then they can compile and manualy edit the dangling reference away. The folder level checkbox helps keep newbies from making errors and helps experts modularize their content to the greatest extent possible.
 

Attachments

Such and such element has Children. Maybe its not a value element? appears for like every mod I try to merge! That includes the mercenaries and immigration mods!! What should I do??
 
Impaler: Thanks, I'll take a look at that in a few days. I'm currently visiting a friend for midsummer (have been since Friday), and will be building my model railway a few days after I come back, but I should have time to continue working on this program from Tuesday on.

I guess I misunderstood your idea with the folders then... It's certainly possible to make it handle them as unsplittable units as well.

Fachy: What are the mods in question? I also need to know the name of the file that produced the error (should be visible over the progress bar). You could try grabbing the updated elements.txt from Impaler's post above, if the files he reported to have added ring ny bells.
 
Immigration mod: Unit Formations / Civ4FormationInfos.xml
Mercenaries mod: Units Combats / Civ4PromotionInfos.xml
Fachy's (updated) Reglions mod: Civ4Defines / GlobalDefines.xml
Btw this last mod has no pyhton at all!

For some reason it also deleted my CustomAssets folder! (in my documents) I didn't lose any data, but it's acting weird...
 
Another very rediculous problem I just discovered.. it's showing conflicts between just about everything!

-Tech cost mod (which decreases some tech costs as they become more known) is contradicting with the training barracks mod (something totally irrelevant)
-Enhanced tech is contradicting with enhanced conquest
-Junit religion won't go with the revolution mod!!

Btw, how am I supposed to merge something like "CvModName.py" when merging 2 mods? Should it include both names?
 
I will further expand the elements.txt that should clear up the "element has children" problem your getting and allow you to diff more mods.

The merge conflicts are probably due to the EventManager Python files, almost all Python based Mods change this file and will generate conflicts their, theirs not much I can do their untill people re-design their mods using a better registration based eventmanager which puts the mod logic is a seperate file and uses a special eventmanager that automaticaly imports the file. The CCP has such an EventManager (made by SimCutie) which should allow easier merging of Python Mods by hand and with ModSwitcher.
 
But as it implied, the problem wasn't in that file.. rather in other xml files (at least)
 
Fachy: I suppose CvModName.py is a completely new file, i.e. doesn't exist in the base game? Two mods adding the same file will always cause a conflict. As Impaler noted, there's not much I can do for that.

As for deleting the CustomAssets directory... If you specified it as the civ4modder custom assets directory, that's normal behavior. I've even noted it in the first post. The program has to get rid of any old files so they won't cause problems.

Michelangelo: Thanks, I'll take a look at those next week.
 
I thought the main advantage if your program was to merge different data into one file ^^
 
Eventualy (next version or 2) it should be possible to compare the diffs when their both trying to add the same whole file. If they match then theirs no conflict and you can pick either copy to use. Alternativly if you wanted to move more of the processing towards diffing and away from merging you could at diffing run an MD5 sumcheck or other such arbitary number generator on the file and use that as a keys to identify it, the two mods add a file with matching name and key then again we can assume no conflict and visa-versa. These algorithms are widly avalible and shouldn't be hard to incorporate.
 
The program works by merging the changes made by two or more mods, as compared to the original data set. Adding a file is the same as changing everything in it, so it's a bit more complicated. There are basically three different levels in this:

1. Both mods have exactly the same contents in the file. Detecting this is fairly trivial (like Impaler suggested) and the file from either one can be used. I'll probably add this soonish.

2. The file in mod A is a superset of the one in mod B, so the one from mod A could be used without ill effects. One such case is the DomPyHelpers.py in Modified Special Domestic Advisor and Exotic Foreign Advisor. This requires some additional logic to detect, basically generating a diff from B to A. If there were no removals, the file in A can be used. This will probably come after version 1.0.

3. The files are different. You used CvModName.py as an example, which I believe contains the name of the mod in some variable. If two mods have this same file, how is the program supposed to decide which one to use? Implementing an algorithm that really understands what the script does is really difficult, and won't be seen in this program (unless someone else supplies it).
 
Back
Top Bottom