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

Eunomiac's Strategy Layer

Discussion in 'Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)' started by ruff_hi, Aug 22, 2008.

  1. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    As you probably saw, you can alter the number of colors per row to make it tall or wide as you see fit.
     
  2. Gorey

    Gorey Chieftain

    Joined:
    Oct 11, 2008
    Messages:
    569
    Location:
    New Orleans, LA.
    finally decided to try out Rise of Mankind a few days ago. immesnsely deep mod. but it looks like it's using the older strategy layer. bleh!

    man, the new one is sooo much better. the merging of the BFC outlines was so annoying. i found myself using a diff color for each city just so i could see the overlappage.

    with the new one.. i can now color code my cities and have overlap.

    for me i use

    Green - Science Cities
    Blue - Production
    Yellow - Gernal Commerce
    Tan'ish - GP Farm
    White - Undecided


    anyway, how much of a PITA would it be to merge the new strategy layer into this mod? I've already merged a few mods, so im not new to the concept... just haven't had the time to look into it yet.

    i plan on playing a few games of RoM after my current game, but first i need to remove that annoyance.

    i dunno, if i like the mod alot i'll probably merge ALL of the new bug and bull stuff into it hehe. i already merged Dale's Combat Mod int BUG/BULL once before, so yeah. but that will be after the PLE stuff is reworked.

    ooook... im starting to babble.
     
  3. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    The Strategy Layer consists of the configuration XML "Strategy Layer.xml" plus some Python files:

    Code:
    Python/
      Contrib/
        CvOverlayScreenUtils.py (probably didn't change)
        CvStrategyOverlay.py
      Screens/
        CvDotMapOverlayScreen.py
    
    You may get away with replacing the ones in RoM with the new ones. However, I am continually adding new support code to the BUG Core that other modules depend on. If the new SL modules use any new stuff, you'll need to port that too.

    We'll be putting out a BUG 4.0 pretty soon, so maybe just wait for RoM to be updated.
     
  4. Gorey

    Gorey Chieftain

    Joined:
    Oct 11, 2008
    Messages:
    569
    Location:
    New Orleans, LA.
    yeah i'll probably wait. i'm kinda new to RoM and haven't been following it so i dunno how often they update it.
     
  5. NBAfan

    NBAfan boss

    Joined:
    Aug 30, 2007
    Messages:
    3,351
    Location:
    Dallas TX,United States
    I don't make Rise of Mankind but it is updated when Revdcm which includes the bug mod, gets updated .
     
  6. zappara

    zappara Mod Designer

    Joined:
    Dec 19, 2003
    Messages:
    2,781
    Location:
    Finland
    In about every 3 months there's larger patch for it. I haven't had really time to follow BUG mod's progression after v3.6 was released so some things in RoM might be "old" when comparing to BUG's current SVN version. New BUG versions will find their way to the RoM's future patches. :)
     
  7. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    @EF - how hard / easy would it be to pull this feature out as a stand along? I'll do it, but if you can let me know what I am getting myself in for, that would be good.

    I'm assuming I start with maininterface.py and go from there - is that right?
     
  8. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    This feature would be pretty tough to extract. It uses several core BUG components to work such as BugData and BugUtil, plus all the options loading which you could replace with hard-coded values with some effort.

    I would start first by looking at its import list at the top. See how many other BUG modules it uses and for what. Functions like BugUtil.getText() are trivial to replace by copying them out of their modules. Others will further depend on other modules, making it more difficult.

    Keep in mind that much of the inner workings exists in the config files. They don't just hold options but actually tie pieces together. For example, BugData is tied into the event manager there. Moving that out of BUG would require writing the equivalent CvOverlayScreenEventManager. IIRC there isn't anything in CvMainInterface for the overlay screen. All the drawing is done in its own modules.
     
  9. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    This is exactly where I started. I finished when looked at init.xml and didn't know what parts to delete and what parts had to remain.

    Based on what I saw, it pulls in lots of core BUG stuff. Am I right in thinking that the key parts are the two keyboard intercepts (Ctrl-X and Alt-X) and if I replicate them in an event manager, the rest of the stuff will just 'happen'?
     
  10. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Those for sure, plus all the events in its config file. Such as loading and saving. It has an init() function which you may need to call from either GameStart and/or GameLoad to create the layers themselves.
     
  11. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    finally got around to doing this ... I think I have it right but I cannot get the layers to initialize. @EF - can you look over what I have?

    Edit: zip file removed - mod now out of date. See below for updated version.
     
  12. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    hmm - getting closer. It initializes now but I cannot put down any dot maps. The strat layer isn't intercepting the mouse clicks ... they are going through to the units.
     
  13. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Did you include EntryPoints/CvScreenUtilsInterface.py? This is what ties to CvOverlayScreenUtils that does the mouse UI work.
     
  14. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    No I did not. I've added it now. Result after I removed some bugs ... mouse action stays in strat layer but I cannot get any dot map to appear when I click on a tile.

    Updated version of code attached.

    Edit: zip file removed - mod now out of date. See below for updated version.
     
  15. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    Digging further, I cannot seem to get 'onModNetMessage' in CvStrategyOverlay.py to fire. What calls that?

    More checking - ahh - it is in the xml file for StrategyOverlay ...

    Code:
    	<!-- Interacting -->
    	<event type="ModNetMessage" function="onModNetMessage"/>
    ... which is handled in 'BugEventManager'. Hmm - how to I replicate that in python without having to fold all of this BUG stuff in?
     
  16. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    CvStrategyOverlay.py contains

    Code:
    	def addCityAt(self, point, color, layer):
    		"""
    		Sends a message to add a city for the active player at the given point.
    		"""
    		CyMessageControl().sendModNetMessage(MSG_ADD_CITY, PlayerUtil.getActivePlayerID(), point[X] * 1000 + point[Y], color, layer)
    
    ... which is intercepted (?) by the BUG event handler and it calls ...

    Code:
    def onModNetMessage(args):
    
    	BugUtil.debug("BUGDotMap onModNetMessage")
    
    	iData1, iData2, iData3, iData4, iData5 = args
    	if iData1 == MSG_ADD_CITY:
    		getDotMap().addCityMessage(iData2, iData3, iData4, iData5)
    	elif iData1 == MSG_REMOVE_CITY:
    		getDotMap().removeCityMessage(iData2, iData3)
    	else:
    		return 0
    	return 1
    
    ... which, as you can see calls 'getDotMap().addCityMessage'.

    Can I mod 'addCityAt' to call 'getDotMap().addCityMessage' direct without the call out to BUG event manager?
     
  17. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    The mod net messages allow the dot map to work in multiplayer. If you care only about single player, I believe you can change the calls. However, onModNetMessage is a standard Civ4 event. If you're already including CvCustomEventManager from Dr. Elmer Jiggles, just add this handler.
     
  18. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    ok - progress! I can now put down dot maps, delete them, turn on and off their visibility. However, I can't seem to save / load them from a save file.

    Snippets from the debug file ...
    Code:
    09:39:50 DEBUG: BUGDotMap CvStrategyOverlay onPreSave
    09:39:50 DEBUG: BUGDotMap DotMapLayer - write StrategyOverlay CityDataDict
    Code:
    09:40:03 DEBUG: BUGDotMap OverlayLayer - init
    09:40:03 DEBUG: BUGDotMap DotMapLayer - read StrategyOverlay CityDataDict
    09:40:03 WARN : BugData not loaded; loading now
    09:40:03 DEBUG: BugData - loading root
    09:40:03 DEBUG: BugTable - StrategyOverlay not found in root
    Something is wrong there - why is BugData not loaded as part of the 'write'? Is there some centralized part of BUG that initializes BugData and actually controls the writing of SdToolKit stuff to the save?
     
  19. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    Yes, BugData hooks up two events in "BUG Core.xml" which you'll need to add to the custom event manager.

    Code:
    <event type="GameStart" module="BugData" function="onGameStart"/>
    <event type="OnLoad" module="BugData" function="onGameLoad"/>
    
     
  20. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    8,806
    Location:
    an Aussie in Boston
    done - but still doesn't find StrategyOverlay in BugTable. Any further suggestions?

    Hmm - just did some more testing and the act of saving the game flushes the city dot map. I added a city, turned off the dot map layer, saved the turn, turned the dot map layer back on and ... no more city dot map.
     

Share This Page