Merging BUG with other Mods

EmperorFool

Deity
Joined
Mar 2, 2007
Messages
9,633
Location
Mountain View, California
This thread is for discussing the documentation/tutorial for merging BUG into other mods, creating a new mod starting with BUG or adding a feature to BUG.


Update: I have begun working on a real tutorial for modding with BUG:


I will update this thread as I make progress, so you don't have to continually check the site. Just subscribe to this thread to get email updates.
 
My main focus tonight has been the XML Reference for the module configuration files. I should have the reference completed this weekend and then move on to the more tutorial-oriented pages.
 
I have completed the XML Reference, though I will continue to expand the descriptions as I write the tutorial. The tags are presented in alphabetical order, but they link to each other where they are related.

The section on configuration will provide a more readable tutorial on how to put the tags together.
 
I've written much of the Events and Options sections. I also added brief write-ups for the Configuration and Initialization sections.
 
Thanks for this documentation :) - I already had merged BUG 3.5 to my Rise of Mankind mod's newest version before I saw this thread (had some trouble with enabling Revolution eventmanager but managed to figure it out by looking BUG config XMLs :D). Those docs probably will help me more in future.
 
A couple of things from the Modder's Corner Core XML Reference page that need fixin':

1) Under <arg> the entry for the list type in the table says same as list under the examples column. Both it and the set entry below it should probably say same as tuple instead since tuple is the one with a full example.

2) Under <event> the type attribute description says name of the Python module (doesn't include the ".py" extension) (i.e. a copy of the module description) and it should probably say something like name of the event instead.
 
Please excuse my noobness, and I'm positive the answer to my question is in plain site, on both EmperorFool's website, and Dresden's instructions, but my ability to read Python is so lacking, I still can't make heads or tales of it...

I'm trying to merge TheLopez's Great Generals from Barb Combat mod into BUG. The mod was kindly updated to BtS 3.17 by Thomas_SG. I don't understand what to do to the BUG EventManager file, as the GGfBC mod has alot of Python going on... Some help would be so much appreciated...

EDIT 7:38 AM 10/30
New file copy of GGfBC for download, now a rar.
View attachment GGfBC Mod.rar
 
The first thing that differs from merging mods normally is that with BUG you should not modify BugEventManager or most other BUG files (there will still be rare cases where it's necessary, but not with most mods).

The ZIP seems to be corrupt as I can see files inside it, but when I copy and paste them into a normal folder some of them don't come along.

Looking at the ZIP, though, here are some starting points:

  • Ditch CvEventInterface.py and CvCustomEventManager.py. Copy all the other Python files.
  • Create a configuration XML file for the mod in BUG's [Custom]Assets/Config folder called GreatGeneralsFromBarbarianCombat.xml. Use an existing one like Reminder.xml as an example.
  • It should only need to hook up the event manager using <events module="GreatGeneralsFromBarbarianCombatEventManager"/>
  • GGfBC includes INIParser (BUG has its own), but it should work in tandem as-is.
 
EmperorFool, thanks for the reply. I think that'll get me through, but I updated the download file just in case. The problem might be path\filename length, as GGfBC has some really long filenames, and zip doesn't give an error message when the path is more longer than Windows can handle. New one's a rar, you might have more luck with that, as it throws out the "path too long error" properly.

Thanks again.
 
I'm trying to merge BUG 3.5 into my Merged Mod 0.83 (see sig). In 0.83, I have quite a few mods using python already included. For this reason, you'll probably find that some of it is quite convoluted or even redundant, but I just don't know enough python to start chopping away. I've tried my best to use the guides that you have provided, but in the end I simply start a new game with no interface.

Between the five python directories in my mod, I have 4 files with the word "eventmanager" in it, and 3 with the word "eventinterface". I'm sure I need to do a little extra work to get all this lined up correctly (or better yet, get some of it streamlined), but I can't figure it out on my own, so any and all help is much appreciated! :)
 
One of the most confusing aspects is that many mods using CvCustomEventManager call the module that handles there own events FooEventManager. This is misleading as there is a definite difference between an event manager and an event handler.

Event Manager: Receives all events and dispatches them to the event handler(s) that are interested in them. There must be only one event manager in the game. BUG uses BugEventManager, replacing CvCustomEventManager and CvEventManager.

Event Handler: Registers with the event manager those events it wants to receives and performs actions when it receives them. These are the old-style "event managers."

If you have CvCustomEventManager in your mod, dump it. Look at the top part of that module where it imports all the event handlers in your mod and put those names into your <mod-name>.xml configuration file using the <events> tag. This tag is designed to work with old-style "event managers."

Does this help?
 
Thanks, I'll give it a shot tonight. What about the EventInterface files?
 
Keep the BUG versions of the files in EntryPoints. CvEventInterface.py specifies the event manager to use and typically doesn't do anything else.
 
What about if we're using a changed CvEventManager.py? Can that just be copied into BUG's Python folder?

Absolutely, if all you've done is modify some of the event handling functions in the class: onCityBuilt, onUnitKilled, etc.

The only problem would be if you added a function with the same name as one of the new functions in BugEventManager: checkEvent, fireEvent, setEventManager, etc.
 
Okay, I need some help! :)

I'm trying to merge BUG 3.5 with my Merged Mod. I've got BUG working, but some of the old python code isn't working as it should. I have two old event manager files, one for pirates and one for partisans. I've set it up like this:

init.xml, after FavoriteCivicDetector:
Code:
<load mod="MergedMod"/>

MergedMod.xml (inside Config folder):
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<mod id="MergedMod" 
	 name="Merged Mod 0.85" 
	 version="0.85" 
	 url="http://forums.civfanatics.com/showthread.php?t=262206">
	 
	<events module="CvPartisanEventManager"/>
	<events module="CvPiratesModEventManager"/>
</mod>

The two eventmanager files are inside the Contrib folder. But the events don't work as they used to. What am I doing wrong? :confused:
 
Top Bottom