1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Merging BUG with other Mods

Discussion in 'Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)' started by EmperorFool, Oct 17, 2008.

  1. EmperorFool

    EmperorFool Chieftain

    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.
     
  2. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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.
     
  3. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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.
     
  4. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    I've written much of the Events and Options sections. I also added brief write-ups for the Configuration and Initialization sections.
     
  5. zappara

    zappara Mod Designer

    Joined:
    Dec 19, 2003
    Messages:
    2,781
    Location:
    Finland
    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.
     
  6. Dresden

    Dresden Chieftain

    Joined:
    Jul 10, 2008
    Messages:
    1,081
  7. Dresden

    Dresden Chieftain

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    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.
     
  8. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Thanks, fixed both. I also added a link to your BetterAI example thread.
     
  9. Del69

    Del69 Chieftain

    Joined:
    Oct 6, 2008
    Messages:
    34
    Location:
    Covington, WA
    Just a quick note, having the https:// in the links brings up an authentication box, removing the s so its http:// fixes it. Assuming thats what you use for editing it.
     
  10. draco963

    draco963 Chieftain

    Joined:
    Jan 26, 2007
    Messages:
    438
    Location:
    Ottawa
    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
     
  11. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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.
     
  12. draco963

    draco963 Chieftain

    Joined:
    Jan 26, 2007
    Messages:
    438
    Location:
    Ottawa
    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.
     
  13. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,477
    edit: solved
     
  14. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    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! :)
     
  15. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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?
     
  16. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    Thanks, I'll give it a shot tonight. What about the EventInterface files?
     
  17. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Keep the BUG versions of the files in EntryPoints. CvEventInterface.py specifies the event manager to use and typically doesn't do anything else.
     
  18. draco963

    draco963 Chieftain

    Joined:
    Jan 26, 2007
    Messages:
    438
    Location:
    Ottawa
    What about if we're using a changed CvEventManager.py? Can that just be copied into BUG's Python folder?
     
  19. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    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.
     
  20. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    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:
     

Share This Page