Eunomiac's Strategy Layer

As you probably saw, you can alter the number of colors per row to make it tall or wide as you see fit.
 
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.
 
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.
 
I don't make Rise of Mankind but it is updated when Revdcm which includes the bug mod, gets updated .
 
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.
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. :)
 
@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?
 
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.
 
I would start first by looking at its import list at the top.
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'?
 
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.
 
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.
 
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.
 
Did you include EntryPoints/CvScreenUtilsInterface.py? This is what ties to CvOverlayScreenUtils that does the mouse UI work.
 
Did you include EntryPoints/CvScreenUtilsInterface.py? This is what ties to CvOverlayScreenUtils that does the mouse UI work.
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.
 
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?
 
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?
 
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.
 
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?
 
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"/>
 
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.
 
Top Bottom