Eunomiac's Strategy Layer

Looks fantastic and I want to play with it. is this in BUG? What is the key strokes to bring this puppy up?

Atm its in the Strategy Overlay.xml in config, Alt F10 and Ctrl F10 was what i threw into it for a default. Would have only done 1 but I wanted to make sure it worked with a couple keys.
Just unzip that last attachment into CustomAssets and it'll be good to go. I put what the 2 files it wants to overwrite have changed in the install.txt so if you want to do manual merges its like 2 lines of code is all.

For example, the stuff in XML would need to go back into Python

Which stuff? The game text or the key config part?

Actually shouldn't need to alter MI at all, (I avoid that monstrousity like the plague unless i need to get in there). Just call CyInterface().setShowInterface( InterfaceVisibility.INTERFACE_HIDE_ALL) or maybe InterfaceVisibility.INTERFACE_HIDE (I think this is the globe view hide) when the screen is opened and the reverse when closed. Should work with one of them. Also just dawned on me I never bothered to check if the city screen is up or not when it opens/closes...:(

My original plan was to do a WB style tab control thing but all the WB code for building those tab controls is hidden somewhere (probably a cpp file i didn't look in), figured I'd want fairly concrete example stuff for my first mod :D Was kinda planning on working toward a more minimal style UI where you had one box with your main options and as you added/removed from those you got a panel with the options for that main selection to popup/remove.
One of those "text is usually easier to deal with the first time around" things :mischief:

Kinda tossing around a custom class for a panels info that can do a dynamic layout for itself. Too many damn hardcoded coordinates as is. Key to doing this would be making it easy to use for most anything so it would become more a general panel utility instead of specific to this case. Probably something really simple like for building a grid of widgets X wide x Y tall with a title some hover text and sizing itself to whatever you popped into it.

I was kinda on the fence on making a right click remove style just because it allows input it doesn't eat to go through to the main ui. So if somebody had those right click popups they could use those (although come to think of it, it really should just eat everything that doesn't move the camera).

Also think I figured out a sneaky way of making the add/remove line stuff work. By making buttons named exactly the same as the ones on the world level strategy overlay and messing around with the CyGlobeLayerManager, I can activate/deactivate the add/remove/delete lines. There is also a interfacemode called GLOBE_LAYER_INPUT which does just what it sounds like no matter if the globe layer is up or not.

Did some more work on the signs too, basically the new version i'm working on interrupts any calls to the interface being set in add sign mode and brings up the add sign interface and sends the call that way whenever the screen is up. So doing that I can completely separate signs done in and out of its interface which it properly saves/restores now too. So you have 2 groups of signs, "always display" and "only show when the overlay is up". If they conflict, it shows the ones from the "overlay group" when the screen is up and puts back the "always show" group when it closes.

Also had a bunch of memory allocations and fun C++ blowups when having it up and zooming out to globe view for some reason so I made it auto-close when you zoom out that far. I think I'm pushing what they meant the interface to do a bit :D

By stand-alone do you mean a separate release from BUG? If so, which is totally cool, are you willing to maintain both versions? I ask because I'd like to maybe add some stuff to it, and we'll need to figure out the best way to do the coding.

Really I don't think its going to be feasible, looking at where its going there is gonna be too much reliance on BUG's utils and event manager functions for it to be less than a nightmare to maintain both. At the very least I'd be looking at either adding the custom event manager to the standalone version, and programming experience says I'll find 4597843 other things that need to be changed to make it work.

I figured there was something I was missing on the stuff added to CvUtil and how it went with BUG. If you want I can do a writeup for how to do those python popups, haven't found one for ones that actually have controls and you can get back a CvPopupReturn object to get the values out. Popups with listboxes, dropdownboxes, checkboxes, spinners, and Tables are mucho easier to build than screens from what i've done so far. I've only seen how to do ones using the CvPopupInfo style ones where you can click 1 of a number of buttons for your selection options. I'll wait till I see what you do to BUGify the code first though, I'm sure there will be a few things that are done different.

I tell ya though the further I dig into the screen building and whatnot the more i think Firaxis has a visual.net style interface builder app they are hiding up their sleeves. Usually hand coded stuff doesn't have nearly so many hard coordinates in it :D
 
I'm liking the progress Del. A couple random thoughts.

1) Why not add the ability to do landscape signs too to have a little variety with the normal civ-colored signs? Landmarks are the black ones that currently can only be set in WB in the normal game and the functions are pretty much the same:
Code:
VOID addLandmark (CyPlot pPlot, STRING caption)
VOID addLandmarkPopup (CyPlot pPlot)
VOID removeLandmark (CyPlot pPlot)

2) Does your dotmap overlay do anything to display the BFCs of current cities? Perhaps those can be marked too in a reserved color (or the civ color).
 
I can't count the number of times I came this close to building a LayoutManager! And now that we're doing so many remakes of the screens, it's really tempting to make a good base class with all the trimmings along with a simple LM: anything to avoid dealing with coordinates and allow resizing by resolution.

About the XML, I only meant that if you intend to release outside of BUG you'd need to move the config XML stuff--the keys and event manager hookup--back into Python. Since you're not planning that, it's moot.

I wrote up the stuff about CvUtil and popup handlers in the events documentation. Really it just provides a function to call to get an event ID that will also add that ID to the list of silent events by default without having to modify CvUtil. You have to do it from Python right now, but there's no reason I couldn't add the ability to specify them in XML. You can take a look at ReminderEventManager for a working example.

Any info you can write about more advanced popups would be great appreciated and used at CFC. There is a simple tutorial, but nothing about the more complicated possibilities. I have an enhancement to Civ4lerts that would make use of popups; I just haven't had the time to play with it yet. Most important to me is to figure out how to allow custom popups to be minimized along the right side using the "Minimize Popups" Civ4 option setting, even if we have to specify it ourselves. There's a POPUP_MINIMIZED constant (or something similarly named), but my tests using it had no effect. :(
 
I'm liking the progress Del. A couple random thoughts.

1) Why not add the ability to do landscape signs too to have a little variety with the normal civ-colored signs? Landmarks are the black ones that currently can only be set in WB in the normal game and the functions are pretty much the same:
Code:
VOID addLandmark (CyPlot pPlot, STRING caption)
VOID addLandmarkPopup (CyPlot pPlot)
VOID removeLandmark (CyPlot pPlot)

2) Does your dotmap overlay do anything to display the BFCs of current cities? Perhaps those can be marked too in a reserved color (or the civ color).

1) Ya i thought about the landmark signs but I think those are viewable from any player so it might not work for multiplayer use. Pretty sure your opponent could see those

2) Didn't do anything with current cities as of yet, that would probably work fine all in one color/layer, I don't think the merging effect of the borders would matter for current cities. Most likely you just want to see where your overall boundaries are not the specific city ones when planning new ones. I'll throw that on my list o' crap to do :D

Ah ok I see where you were going with the XML thing. I figured there was something like that for the popup event handlers, just after trailing the popup handler chain through the default UI code I was getting tired of tracing code in my head. Was starting to kinda look like this guy -> :twitch:

I'll muck around for a bit testing out the popup stuff see if I can get it nailed down a bit.

I really think a basic layout manager is gonna be needed, especially if the custom dll option goes. There would be some nice uses for it. Not to mention having one would take all the grunt work out of new small screens and you'd be a lot more likely to look at that for an option on new displays etc. I've made a couple crappy ones before in c and its not too hard, just takes a bit of planning or it won't be worth much.

Oh and on the API docs, void CyGlobeLayerManager().setCurrentLayer() should be void CyGlobeLayerManager().setCurrentLayer(int LayerID), sets the current layer to the ID passed in which is in the range given by 0 - CyGlobeLayerManager().getNumLayers()
 
Oh and on the API docs, void CyGlobeLayerManager().setCurrentLayer() should be void CyGlobeLayerManager().setCurrentLayer(int LayerID), sets the current layer to the ID passed in which is in the range given by 0 - CyGlobeLayerManager().getNumLayers()
Cool, thanks for that; I'll update the script with the proper argument.
 
Writeup on how to do advanced popups is over thataway.

Done with bug's event manager but I added a section at the end on how to do it without it as well. And minimizing did work with this method, not sure how it will handle queuing yet though.
 
Players current cities show on dot map, had to hide the culture visibility though since it was messy as hell if you leave it up (probably add that as a ini option or something later).

Also got adding the scribble lines to work but I need to refine it a bit more, they get stuck and stuff so its kinda messy atm. Also throws out memory exceptions like nobodys business atm. :wallbash:

Going to start working on a basic panel class/layout manager for a grid of check box buttons. Once I get that functional I'll start moving on to redoing the UI to use it. For this I'm going for like the WB main menu, just a grid of X by Y buttons with hoverhelp and only one selectable at a time. I'll work on leaving it as expandable as possible so we can use it as a base for a more robust layout manager later.

Sidebar:
Have you guys thought about using some doc tools? Most of the default python ones your kinda fubared since they require the code to interpret correctly since they use pythons default docstring capabilities to parse it, and the custom Civ4 stuff doesn't load correctly since your not in its interpreter (which sucks since thats one of pythons best points). I did a bit of looking to find one that parsed the code itself and wound up with the old C++ standby doxygen. It works with python and as a bonus if you ever started doing a dll it would work with that. Does really nice html or pdf api docs. Really helps on functions where your taking/returning obscure dictionary or tuple args.

Example of using it:
Code:
## Some function documentation
# @param someparam Some parameter the function takes
# @param otherparam The other parameter it takes
# @return What it returns
def someFunc(someparam, otherparam):
    blah blah blah

The only bad thing is it can't use its special codes (@param, @return, etc) when you use a regular docstring. But really since you can't access them outside of python running inside civ4 its kinda moot if ya ask me :D

Anyway I attached a pdf of what it kind of output you can get from it.

Edit: Just got a chance to test it and the method I used for popups in that tutorial I wrote up does work properly for queuing minimized events. If you have minimize till end of turn up any popups you leave minimized queue up until the end of turn along with all the ones the default game puts there.
 

Attachments

  • refman.pdf
    109.9 KB · Views: 92
1) Ya i thought about the landmark signs but I think those are viewable from any player so it might not work for multiplayer use. Pretty sure your opponent could see those

I can think of plenty of uses for multiplayer-visible signs. Marking borders, sharing intel, planning strategy, etc.

All things I do now by marking up signs, taking a screenshots, editing out intel I DON'T want revealed, and then emailing them. Or other convoluted methods.

I'd love to slap a global sign in front of an exploring opponents axe that says "Turn back or be destroyed!" rather than having to try to explain which axe to him (and which way it should run) in the trade screen.
 
Just posting that I haven't stopped work on this. Just had a new baby girl so thats taking up a bit of time :D. Working on putting in the Overlay Icons and moving the screen to the small layout manager I made.

Stay tuned for updates :D
 
Just had a new baby girl.

Woot! :clap: Take the time to enjoy your time with her and relax so you can. :)

Keep us posted, and congrats!
 
EmporerFool said:
Woot! Take the time to enjoy your time with her and relax so you can.
Kinda glad I was laid off my job so I have a lot of time to spend with her and the wife until the unemployment insurance runs out at least. :D
 
Here is some feedback ...

1) Two Views
I think that there should be two views for the Strategy Layer (SL). One for 'edit' and one for 'play / display'. The 'edit' view is as current where you get to add dot maps and / of flags. The 'play / display' view shows the strategy layer information but not the dialog boxes and allows the player to play through it.

I would have one hot key for each ... Alt-F10 for Edit and Ctrl-F10 for play?

2) Sub Layers
Another thing I think we should add is sub-layers. The names for these layers should be contained in an external txt file so that the player has complete control over how many there are and what they are called. I would automatically make the first layer 'Dot Map'. All other sub layers should display flags.

If the strategy layer is being displayed (either edit or play), we should display the current sub layer (suggest just below the Field of View slider with little arrows for scrolling between the sub layers) ...

Strategy Layer
< Dot Map >

Click on the '<' arrow and it moves up to the next higher sub layer, click on the '>' and it moves down. The list should wrap. As you move from one sub layer to the next, the strategy information completely changes.

This would do away with one of the dialog boxes, the one that specifies 'dot map' or 'flags'.

Sub layers that I would play with would include ... 'Tiles', 'Roads', 'Railroads', 'AI Attitudes', 'Religions', 'Keep / Raze Cities', 'Military', etc.

Bug: I found some inconsistencies if I went from the Strategy layer straight into WB. It lost some of the dot maps, kept others ... also lost some of the center dots.
 
A simple question:
why is this not yet included in BUG?
I know it's work in progress, but it can be useful even in this stage, and I suppose that we can comment out something if it give some problem... after all, SVN version is supposed to be a work-in-progress one :)
 
At the time, Del69 was churning on it frequently, and he wanted to get it to a more stable state. Given that he has less time now and it is useful, I'd be happy to include it in BUG.
 
I've been using the strategy layer in a couple games recently and have some feedback and ideas.

First, let me just say it's totally freakin' awesome! I used to draw lines to make dot maps before (rarely), and that was a huge PITA. Plus I had to zoom out so far to draw the lines that it was hard to see the tile boundaries.

1. Need a one-handed (CTRL or ALT + X or Z) shortcut for showing/hiding the layer. I'm sick of taking my hand off the mouse to bring it up. Also, the same shortcut should hide it. Though your report said otherwise, it didn't work for me. I had to click EXIT.

2. Mode to add/remove dots/signs should be separate from viewing them. As you suggested, I often want to leave the layer showing without the two windows while playing.

3. "Show current cities" view. Allocate one layer/color to show the boundaries of your existing cities. This should be viewable with and without the other layers. It should have it's own shortcut.

4. Make the editing interface more like WB in that it hides the main interface or integrates with it. For example, take over the action buttons and unit info areas for showing the color and editing buttons.

5. Switch to using buttons over text (goes with 4). The two screens take up too much space on-screen. Plus we've got NikNaks itching to make more buttons. :)

6. This might be tougher, but some way to mark future cities specializations. I used colors to denote my use for a city, but that sometimes causes problems. I laid out green cities for science (commerce), red for production, and magenta for hybrid. Then I used cyan for filler cities to be founded later. The problem was that a lot of the green cities overlapped, but it became harder to tell where.

I would like to instead leave colors usage to make overlaps easier to see. IOW, colors would lose their meaning. Instead, I'd like to have signs appear where the cities go with some way to mark them. Yes, I can do that myself, but I'd like some buttons that will place common ones. I'm almost thinking that it should choose the color for me based on what cities are nearby, and change them as I add/remove other cities as necessary to avoid putting the same color next to itself.

7. That brings me to signs for future cities that I can show/hide separately from the colored dots. These I'd likely leave up as I play. This would mean integrating somewhat with EventSigns I think to make it truly user-friendly, but that's not absolutely necessary.

(BTW, I never realized how many tile-modifying events I had been missing. I love discovering the signs! Sure, they don't really alter my game plan -- "Ooh, +1:commerce: on that jungle plot? Looks like it's war, Lizzy!" -- but it adds fun and atmosphere to the game. :goodjob: Dresden)
 
I really need to try this out in my next game. Regarding the shortcut, how about CTRL-X (for the BUG eXtra Strategy Layer(s) :p)? Somehow that one is apparently unmapped in the original game aside from its use as "Cut" when entering text in popups (I'm assuming that won't conflict but if so ALT-X should work).

Glad you like the EventSigns -- that's pretty much my intent with them; the bonuses themselves are often inconsequential but it's neat to have them mapped out and have something close to actual landmarks in the game. I did have to laugh when on a recent game the poor Russians got both the Sour Crude and Clunker Coal events which is something I probably wouldn't have noticed without the signs.
 
6. This might be tougher, but some way to mark future cities specializations. I used colors to denote my use for a city, but that sometimes causes problems. I laid out green cities for science (commerce), red for production, and magenta for hybrid. Then I used cyan for filler cities to be founded later. The problem was that a lot of the green cities overlapped, but it became harder to tell where.
This is what I want sub-layers for. If you add a 'City Desc' layer, then you can tag with a sign a city as commerce, production, etc. With sub-layers, you could have the same tile with 10 different signs, one per sub-layer.

EG:
When the sub-layer is 'City Desc', the tile says 'production'
When the sub-layer is 'Tiles', the tile says 'mine'
When the sub-layer is 'Roads / RR', the tile says 'RR First'
When the sub-layer is 'Military', the tile is 'Rally Point'
etc
 
I committed Del69's latest Strategy Overlay to the SVN and have started to tweak it.

I have managed to rewrite the dot-mapping code so that you no longer need the add/remove modes. Instead, when in dot-mapping mode you left-click to add a BFC and right-click to remove one. As well, instead of the single-tile green highlight, the full BFC in the chosen color is shown as you move the mouse around the screen.

I still need to clean it up (remove the add/remove panel) before committing, but it works quite well and is much faster to use. One thing I need to figure out is a way to block click events from selecting/moving units.

The next step is to make the transparency of the BFCs adjustable on the options screen (0% to 100%). I'll keep the new BFC highlight at 100% opaque so it's easier to see the new BFC.

I will then do something similar to the sign mode.

For the coup de grace, I'd like to remove the panels and switch to icons. This might be tricky for the colors since you can't receive clicks on plain panels, nor can you click through them. I'd need specific buttons to do this, limiting the user's ability to override the colors themselves.

I suppose if we assign meaning to the different colors for the dotmap (green for research city, yellow for gold city, etc), we could use icons for the buttons. However, I suspect most people don't get that far, nor would our selection be what everyone would want.

What I'd like is a show/hide toggle button on the left side, just above the build queue area (like show/hide scores on the right). This would merely toggle the visibility of the dotmap. A second button would enter dotmapping mode, showing the dotmap if not already visible.

The same pair of buttons would exist for signs as well.

Going forward from there, I'd like to add the previously talked about icon mode where we replace the numpad icons with other planning icons and allow the user to drop them on the map. I see this as being much easier to than signs if we define a good set of icons since you won't have to type the same stuff over and over. Plus we can make buttons with those icons.
 
I've made a little more progress. Unfortunately, I cannot intercept mouse down events and keep them from reaching the main interface without using the green-square plot-picking mode. However, it seems to work okay, and I use it instead of drawing the colored dot where the city will go (the outline is still drawn).

I have added two transparencies: placed cities (default 50%) and highlighted city to be placed (default 0%). Currently, the city to be added if you click is drawn in the same color as it will be placed. Does anyone think a separate highlight color (not available for any placed cities) should be used instead? I'd use green as it stands out nicely and matches the plot picking square, but I really like it for placed cities myself.

I have removed the add/remove panel since they are the same mode now.

Most importantly, I have managed to get the layers and dots to remain visible after you close the strategy layer. This will allow me to separate visibility from editability--allowing the dotmap to remain visible while you play!
 
Top Bottom