Mod Merging or CustomAssets

AW Arcaeca

Deus Vult
Joined
Mar 10, 2013
Messages
3,019
Location
Operation Padlock ground zero
Hello, civ4 modding forums! I come as an envoy from the distant lands of civ5 modding, as you can tell from my sig. Civ5 is great and all, but as far as gameplay enjoyability, I have to give credit to civ4, due in no small part to drastically shorter turn and loading times. :)

That said, the XML schema of civ4 makes my head spin and my python skills are... um... well, if they ever actually got off the ground, I might be entitled to call them rusty. :p So I don't intend to start a civ4 modding career anytime soon.

One thing I do find irritating about civ4 though is its ability to only load one mod at a time, whereas I would like to play with both Dumanios' Iran AND jarm. (Sidenote: Dumanios strikes me as the civ4 equivalent of JFD) Since this is apparently impossible, I understand that there's essentially two options:

1) Merge the mods into one. Apparently this requires WinMerge which I have no idea how to use.

2) Load stuff into the CustomAssets folder.​

From what I understand, what goes into the CustomAssets folder actually functions as a direct override of existing game files, and so I essentially have to add the contents of whatever mod I want to those files into existing game files that have been copy-pasted into CustomAssets. Is this more or less correct?

The problem then exists that both mods include art files that don't override anything. Those are dealt with how...?

I've done a bit of industry research: there's this guide on merging mods which is Greek to me, this thread which basically redirects me to the already incomprehensible mod merging tutorial; there's this, which basically says to put stuff in the MODS folder... except I already know how to do that... it's just that that's only useful for one mod...

TL;DR Version: How would I enable both jarm and Dumanios' Iran civ?

Remember that I don't understand civ4 modding, so don't assume I know anything ahead of time, except, you know, that mods go in the mods folder and that you load them in-game through Advanced > Load a Mod. If it helps, you can pity me for civ5 moddability having weakened my reasoning capabilities. :p

TIA,
AW
 
I would like to add one more approach to merging: git. Make a tree with vanilla, add two branches, place a mod in each and tell git to merge. You can then merge a 3rd on top of that if you like and even carry on. Git is designed for merging branches and is likely the tool I have seen so far, which does the job the best and easiest. Having said that, I'm not about to write a git guide here.

I'm not really sure I can explain merging if you don't get the links and can't read the xml files. I'm trying hard to think of a way, but.... The links however seems to want to merge everything and presumably you only need to merge xml files. Merging is easy if no file is changed by both mods. In that case you can just move the two assets folders into each other. If there is at least one file, then it needs to be merged, either by tools or manually with copy paste.

I find merging to be quite annoying and I would love to see if anybody can provide a shortcut I haven't spotted. I don't think so, but one can hope :)

If it helps, you can pity me for civ5 moddability having weakened my reasoning capabilities. :p
It doesn't help with your problem, but it helps on my mood :p

 
Both JARM and Dumanios' Iran use Modular loading, so they are not highly difficult to merge.

I will try to guide you through.

First, CustomAssets is not the favoured approach. It is ideal for a graphical mod like Blue Marble who can be run there because it only deals with terrain graphical changes (which most mods don't change - but some do!).

Second, a Mod with a graphical Theme will not run from CustomAssets.

The positive point about CustomAssets is that... it's not the Program Files folder where you have the UAC that might restrict you to alter things if Civ4 is installed there.

So let's assume that you are creating your own Mod under Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\ called AW (or whatever). At the level of 'Charlemagne' - create a folder named AW. In it, drag (extract) JARM content. So now, you have a structure like AW/Assets/Modules.

From Iran, drag the folder Custom_Civilizations into your Modules folder.

The problem is that both Mods are altering two XML/Audio files that cannot be Modular. You will have to merge them. Or... wait! I just did it! Take the two Audio files and overwrite the two from JARM that should be located in the AW/Assets/XML/Audio folder. Next time, you will have to learn how to do it yourself (this was an easy one).

By the way, WinMerge is a tool, but Notepad++ is also one that can help you merge files manually. I always do it like that - I don't trust a tool to do the job for me, decisions should be yours.

Now you open BtS, load AW as a Mod, check the Civilopedia and hope that you will find the JARM religions and Iran! :)

PS: actually, you can create your Mod in CustomAssets if you want or use the MODS folder located there. I never use them.

Your question about the art: they don't need to overwrite other files. For each art, the path is defined in several XML/Art files. Those XML/Art define files are themselves referenced in the appropriate units, buildings etc folders. That's how the game fetches them.

A last note about Mod's ini files. Both JARM and Iran have their ini files. When you create and load a new Mod like AW, an AW.ini file will be created in the AW folder. You can then forget about JARM.ini and Iran.ini. It is important however that in AW.ini you have this line (I don't remember if it is the default value):
Code:
; Modular XML Loading
ModularLoading = 1
 
Sorry for the extremely late reply; I got too caught up in enjoying the mod. So I would like to bestow some belated kudos on you both :D

Now since I'm all for recycling threads, I've got a new question, which sort of fits in with this topic:

Call me a scrub, but I can barely survive on Noble difficulty, and definitely not win. Admittedly, most of it is my strategy, but I can chalk it up a bit to the mechanics of barbarians: how they - as I understand it - just pop out of nowhere in droves. I much prefer the civ5 model - barbarians spawn in centralized encampments. I mean, the encampments can still randomly pop up, but at least there's one place I have to deal with, not every border all at once while my cities are actually, you know, trying to do productive things instead of whipping up some emergency troops.

But I don't want to eliminate barbarians altogether, either. So, my twofold question is this: 1) Is the algorithm dictating the random, non-centralized (i.e. ignoring barbarian cities) spawning of barbarians located in a non-DLL file, and if so which, and 2) would this be accomplished by copying it to the Python folder (I'm assuming it would be python file) of the mod so as to override the base file?
 
The function responsible for spawning barbarians is CvGame::createBarbarianUnits(), which is inside the DLL. It has this call:
PHP:
gDLL->getPythonIFace()->callFunction(PYGameModule, "createBarbarianUnits", NULL, &lResult);
Somehow you should be able to add the function createBarbarianUnits in python and it will use that one instead of the DLL code. However I always forget precisely how to do this because I never do anything in python, if it can be done in C++. Python is inferior in many ways, but it does work without a compiler, which is the main benefit.
 
You can find the createBarbarianUnits() method in CvGameUtils.py:
Code:
	def createBarbarianUnits(self):
		return False
As you can see, the body is empty. You can code in there whatever you want to happen when the game would regularly do the stuff it does to create barbarian units in the DLL.

If you keep the return False statement in the end, it will first execute the Python code and then the DLL code. If you change it to return True, the DLL part will not be executed at all.

There is also a createBarbarianCities() in case you are interested in that as well after all.
 
The change doesn't seem to be doing anything as barb units are still swarming the map. All I did was copy-paste the file from the game files into the python folder of my mod, and then changed that False to True. Is there any other procedure that I missed - say, for loading the updating file into the game?
 
I admit I haven't tried it, maybe the Python callback needs to be enabled in the XML defines first. I'll look into the code again when I have it on hand.
 
Still no results? My games continue to go sour from massive barbarian invasions from every direction. :(

Also, to confirm, overriding createBarbarianUnits won't cause all barbarians to stop spawning, right? They'll still appear from random events and in cities?
Even if I could just halve the number of barbarian invaders, that would be a significant improvement, but I assume that's much harder than eliminating random spawning altogether.
 
Hello? Hi? It's been about 2 months now and my games continue to do nothing but frustrate me. I've tried changing the False to True within createBarbarianUnits - in the actual game file (Program Files (x86)/2K Games/.../Beyond The Sword/Assets/Python), and then copy-pasted into the python folder of CustomAssets for good measure. I'm not sure what else needs to be done but SOMETHING has to.
 
Changing it only affects spawning of new units. It won't affect existing barbarians already swarming your cities.

And changing it to True without any additional codes effectively ignore the DLL codes, which means no barbarians will spawn randomly. You might as well just use the No Barbs option...
 
I've tried changing the False to True within createBarbarianUnits - in the actual game file (Program Files (x86)/2K Games/.../Beyond The Sword/Assets/Python)
Never edit those files. Make a mod, copy the file(s) you want to change and then edit them in your mod. Changing the vanilla files will cause problems and break other mods.
 
Changing it only affects spawning of new units. It won't affect existing barbarians already swarming your cities.
I know, but the point is to remove swarming entirely so they don't have a chance to get to my cities. The trouble is I don't know whether or not whatever I did worked until 100+ turns into the game, when swarming begins.
And changing it to True without any additional codes effectively ignore the DLL codes, which means no barbarians will spawn randomly.
I know; intentional
You might as well just use the No Barbs option...
See above - I want Barbarians, but civ5 style: sourced one single point, as in an encampment or city.
Never edit those files.
Oops
Make a mod, copy the file(s) you want to change and then edit them in your mod.
Then, within the python folder of the AW mod rather than CustomAssets?

Leoreth was also talking about enabling python callback - anyone have any thoughts as to what effect that may have? Admittedly, I don't know exactly what that is, but I found Kael's BTS modding guide which gives a list of callbacks... none of which seem to correspond, at least by name, to createBarbarianUnits.
 
It should be possible to disable spawning of barbarian units through XML. If you want to give this a try, locate Civ4HandicapInfo.xml in BtS/Assets/XML/GameInfo and copy it to e.g. BtS/Mods/AW/Assets/XML/GameInfo. That is, unless your mod already contains that file, in which case you should just edit the modded file.
Then, locate the difficulty setting you're using (or do it for all settings) and increase the respective iUnownedTilesPerBarbarianUnit value, say, to 10000 in order to disable (land) unit spawning. Cities should still appear, and can also be adjusted in this file, i.e. on which turn they start appearing, at which rate and with how many initial defenders.

For faster testing, you could try game.aiplay from the in-game Python console:
http://www.gamefaqs.com/pc/919352-sid-meiers-civilization-iv/cheats
(I've only done this once because I use the AI Auto-Play mod for this.)
 
You can't change the style of barb spawning by purely turning True to False or vice versa. That is just to switch dll codes on or off. You want them to spawn in an entirely different system, you need to write extensive codes for them.

What f1rpo suggest would probably just slow/stop them spawning, but again it will not change the way they spawn.

Python Callbacks are used to enable certain functions in CvGameUtils. Without enabling them, writing codes there has no effect. createBarbarianUnits function, however is not one of these in default BTS, unless your mod added this requirement.
 
Cities would still spawn, and at some point send out attackers. Perhaps cities should start appearing earlier then, but that can also be configured in XML. Also, if you can work out the Python thing (having createBarbarianCities return True):
Also, to confirm, overriding createBarbarianUnits won't cause all barbarians to stop spawning, right? They'll still appear from random events and in cities?
Yes, I don't think it would be like "No Barbarians"; cities are placed separately by createBarbarianCities.

Reading between the lines, it sounds like you play huge Marathon games. These are known to have too much overall barbarian activity (see e.g. this recent thread). If you throttle the spawning a bit, e.g. by replacing all the Noble-difficulty barb values with the ones from Settler, perhaps the placement algorithm will be less of an issue.
 
Reading between the lines, it sounds like you play huge Marathon games. These are known to have too much overall barbarian activity (see e.g. this recent thread). If you throttle the spawning a bit, e.g. by replacing all the Noble-difficulty barb values with the ones from Settler, perhaps the placement algorithm will be less of an issue.
Nope, I play Noble-difficulty epic-speed games. I'm just a scrub, that's all :lol:

That said, I jacked up all the iUnownedTilesPerBarbarianUnit values to 100,000 and it works great, so kudos for that! :goodjob: The problem is, um, it's functionally equivalent to having the No Barbs option enabled, so I think I'll decrease the barbarian city spawning threshold (i.e. iUnownedTilesPerBarbarianCity) by a significant amount (hopefully 130 --> 90 is noticeable) and see if that gets me closer to search-and-destroy encampment style barbarians.

TL;DR: thanks, it worked!
 
Ah, I figured because you mentioned turn times and barbs showing up by turn 100. (Though actually Marathon starts spawning barbs even later than that.)

Anyway, glad to hear it worked to an extent, but I've now tested it on a large map, epic speed, even with Raging Barbarians, and the result was very pitiful. On the main continent, three barb cities appeared around turn 150. On Turn 180, one has been captured by an AI civ, and the others don't look like they'll send out units anytime soon. Maybe if they'd spawn earlier ... but the game doesn't place them until (on average) each civ has founded a second city, so iBarbarianCityCreationTurnsElapsed doesn't have much of an effect. iBarbarianDefenders also seems unhelpful because the initial defenders never march out. Perhaps this isn't a viable approach.
 
Back
Top Bottom