View Full Version : Military Advisor


Pages : [1] 2

ruff_hi
Apr 10, 2008, 06:09 AM
I've been thinking about the worst advisor screen in the game ... the military adviser! Here are some suggestions for improvements ...


add some tabs
put the location of Great Leaders (ie units with attached Great Generals) in the list of units
Tab - Situation Room, that shows ...
List of other leaders
Their relationship with you
current thread level (see below)
Will Declare war on someone else? (yes / no - including reason if NO)
key resources indicator? (ie do they have copper!)
copy of glance tab but include if 2 AIs have touching borders


Threat Level
5 levels (very low, low, moderate, high, extreme)
Basic position is level 3 (moderate), adjusted as follows:
+1 for border tension
+1 if str > 2.0
+2 if WHEOOH
-1 if str < 0.5
-1 if Friendly (I always mix these up, is 'Pleased' better than 'Friendly'?)
-2 if Pleased


I'm not planning on putting in adjustments for nutcases (ie monty)


Thoughts, suggestions, other?

Ekmek
Apr 10, 2008, 11:03 AM
very cool idea! maybe something that identifies key resources (i.e. oil, iron, horses, uranium) or who has them. since thats what you are most likely to fight for too.

OnmyojiOmn
Apr 11, 2008, 04:11 PM
Honestly, I'd just really like it if you could make it open a little faster. I'd use it more often if not for the delay.

ruff_hi
Apr 15, 2008, 03:44 PM
Honestly, I'd just really like it if you could make it open a little faster. I'd use it more often if not for the delay.Not much you can do about the delay - it is cycling over all visible units to build the unit list.

Ekmek
Apr 15, 2008, 05:19 PM
this idea maybe too much work but it would be cool to get it organized by wars. so any units lost when at war with that civ gets recorded in "the Xciv-YCiv war or Turn/year"
then you get a better idea if you killed a lot or not. I'd be happy if it just simply calculated casualties using the numbers from the demographics screen. Everytime you lost a unit that equal 10,000 people that value gets added. So at the end you would see a report like:

"XCiv-YCiv War of 950AD - 50,000:150,000"

just a thought...

·Imhotep·
Apr 16, 2008, 12:21 PM
I'd rather like to see an overview of units with the currently highest XP. Maybe even with the option to locate them via map...

ruff_hi
Apr 16, 2008, 12:58 PM
The current system stores units by ...

combat type unit type

I looked at the code to see if I could pull Great Leader units (ie ones with GGs attached) out and it got a little confusing. I'll see (warning: low priority, lower even than other things) if I can free up the first index and make it a user specified item ... options are:

XP level promotion location (in city, in territory, outside territory)

Any other options? Once I can do one, it should be easy to do the others.

·Imhotep·
Apr 16, 2008, 04:00 PM
I think that would suffice. Indeed it would be rather nice to have that feature, especially for HE and West Point planning...

ruff_hi
Apr 20, 2008, 12:50 PM
skeleton posted to the SVN. I will post some screenies and discussion here tonight.

alerum68
Apr 20, 2008, 01:01 PM
sweet!:) Will try and play around with it today and see what can be tweaked.;) BTW - Can you modify your Unit Renamer Mod so it will have the .INI file for it located in a BUG Mod directory in My Games, instead of the BTS folder? I think we'll need to do that with the CustomDomAdvisor folder too.

ruff_hi
Apr 20, 2008, 01:22 PM
The military advisor has been built out from the victory condition screen. I left the 'settings' tab in just for testing purposes.

Screen Shot 1 ...

http://img88.imageshack.us/img88/5800/bugmilitary0052uz9.jpg

Standard military adviser. Moved the GG emergence bar from the bottom and put a border around it. Not happy with that border yet - will play some more. One issue is that the standard military adviser minimap has a border but I cannot get that to work ... border works but the minimap appears behind the border if you leave the 'deployment' tab.

Screen Shot 2 ...

http://img88.imageshack.us/img88/7277/bugmilitary0053rs6.jpg

Obviously not complete Worse Enemy will be "n/a" until the patch. After that, it will show the leaderhead icon (or none) Threat index I will discuss later. Thinking of a progress bar that changes color based on some items Active wars - leader heads of people who indicated leader is fighting strat res - icons of strategic resources (copper, iron, oil, aluminum, ??) with a little counter showing how many (determined from trade screen) create reminders - duh! - typo, meant to be 'declare war?' with a yes or no ... if no, will include reason why not

Ekmek
Apr 20, 2008, 01:28 PM
:eek: really cool! I like it so far!

alerum68
Apr 20, 2008, 01:32 PM
Looks good Ruff. How about we change that Settings Tab to one that will let you create a list that will have units listed based on combat experiences, so you can find that guy with 19 exp a bit easier?

ruff_hi
Apr 20, 2008, 01:38 PM
Threat Index ...

progress bar, 0 to 100

0 - 20, words = NIL, color = green
20-40, Low, Brown
40-60, Moderate, Yellow
60-75, High, Orange
75-100, Extreme, Red

25 pts for ATTITUDE ... -15 to +15 = 25 to 0
25 pts for strength rating ... -50% to +50% = 25 to 0 (str = us / them - 1)
20 pts for close borders or ocean exposure (us) and them with knowledge of astronomy
30 pts if they are WHEOOH

ruff_hi
Apr 20, 2008, 01:39 PM
Looks good Ruff. How about we change that Settings Tab to one that will let you create a list that will have units listed based on combat experiences, so you can find that guy with 19 exp a bit easier?Current listing is sorted on unit-type. Going to free that up so that you can select level, XP, Location (city, within borders, outside borders), etc. Any other suggestions?

alerum68
Apr 20, 2008, 01:40 PM
Only one:

Hurry Up So I Can Play With It!:p

edit: I got some! Listing based on health status, and if the unit can be upgraded.

EmperorFool
Apr 20, 2008, 08:29 PM
BTW - Can you modify your Unit Renamer Mod so it will have the .INI file for it located in a BUG Mod directory in My Games, instead of the BTS folder? I think we'll need to do that with the CustomDomAdvisor folder too.

I will do those at the same time I fix the main INI file loading. Rather, fixing the main INI file loading will change those automatically.

ruff_hi
Apr 21, 2008, 09:34 AM
Re the strategic resouces (Copper, Iron, Horses, Ivory, Oil, Aluminium, Uranium) ... there are lots of options about how to show this. I'm flipping between ...

A) only showing the resources that we know (from the trading screen) they have and the number they have
B) showing all resources (and number from trading screen). If they know the tech that reveals it (and we do too), but they don't have any, then showing zero. If they don't know the tech (or we don't), then just show an empty resource icon with no counter on it. Is there a way of showing a resource icon but having it "grey'ed" out?

I'm leaning towards B.

·Imhotep·
Apr 22, 2008, 04:54 AM
@ruff:

Threat is spelled with "t" :p ...or are those direct links to the CFC threads about wars with those leaders :D ?

Other than that: Looks great ! :goodjob:

ruff_hi
Apr 22, 2008, 06:13 AM
@imhotep - thanks for that. I picked that up last night. I even had threadindex scattered thru the code. Not sure what I was thinking ... could have been that people were giving me a hard time on here and I decided to code up a thread threat index. :D

·Imhotep·
Apr 22, 2008, 08:59 AM
@ruff:

I've loaded up your new Military Advisor in my recent SP game. Interestingly enough it shows worst enemies, but doesn't apply the correct attitude icons in some cases (Tokugawa is furious for example).

http://img156.imageshack.us/img156/2770/madq9.jpg

Imhotep

ruff_hi
Apr 22, 2008, 09:23 AM
I know that I have an attitude issue with BUG Military adviser at present (I wish that was the only problem with it). Also, worse enemy is not 'unaltered' for version 3.13 (it will be 'n/a' in the formal BUG MA release). I put it in as a place holder because a little bird told me that this information will be in the next patch.

alerum68
Apr 22, 2008, 10:10 PM
Did that little birdie happen to mention when that patch is likely to come out?;)

ruff_hi
Apr 23, 2008, 06:58 PM
Been thinking about my threat index ... here are the colours that we could use to grade from NIL to EXTREME. I'll take a look at this tonight and see if I can put it in order. Feel free to suggest your own order. I'm thinking of having 10 colours that slowly move from ??? to RED.

http://img165.imageshack.us/img165/7681/bugmagrade0061ws1.jpg

Note: The colours in the game look more vibrant than those shown above.

ruff_hi
Apr 23, 2008, 08:45 PM
Here is my suggestion. The 10 colours at the bottom in order from LOW to EXTREME risk.

http://img294.imageshack.us/img294/7971/bugma0065st3.jpg

EmperorFool
Apr 23, 2008, 10:46 PM
Mixing shades of grey in with colors looks confusing to me. I think I'd go with the reverse of the chromatic spectrum. From lowest to highest.


Black
Dark Grey
Light Grey
White
Violet (Purple)
Blue
Green
Yellow
Orange
Red
This way first the brightness increases from black to white, then it gets into colors and goes from highest spectrum to lowest. Maybe swap out the grey and white for other colors, like brown or whatnot.

The Doc
Apr 24, 2008, 03:43 AM
I think 10 colors are too much because they differentiate too little. I would prefer a simpler system with 5 colors that have a clear definition. Maybe the colors that the "Homeland Security Advisory System (http://en.wikipedia.org/wiki/Image:Hsas-chart.jpg)" is using.

ruff_hi
Apr 24, 2008, 05:27 AM
sounds good to me ...

http://upload.wikimedia.org/wikipedia/commons/f/f3/Hsas-chart.jpg

ruff_hi
Apr 24, 2008, 05:29 AM
sounds good to me ...

http://upload.wikimedia.org/wikipedia/commons/f/f3/Hsas-chart.jpg

Threat Index ...

progress bar, 0 to 100

0 - 20
20-40
40-60
60-75
75-100

25 pts for ATTITUDE ... -15 to +15 = 25 to 0
25 pts for strength rating ... -50% to +50% = 25 to 0 (str = us / them - 1)
20 pts for close borders or ocean exposure (us) and them with knowledge of astronomy
30 pts if they are WHEOOH

Can anyone suggest items that we can add to the calculation of the threat index so that it is more gradual and not so lump (ie WHEOOH!)

The Doc
Apr 24, 2008, 06:42 AM
WHEOOH could be something like era/technologies researched, culture points accumulated, land area, population, power of allies or number of cities/units. Or is that all part of the strength rating? :dunno:

alerum68
Apr 24, 2008, 07:38 AM
Hey Ruff... don't forget to write up a doc for this.;)

And I like 5 colors myself.

ruff_hi
Apr 24, 2008, 07:49 AM
Hey Ruff... don't forget to write up a doc for this.;)Baaa - humbug! Its hard enough to produce the actual screens. I was also going to post the BUG MA as a mod component which will need some docs for it.

Bindamel
Apr 24, 2008, 09:56 AM
sounds good to me ...

http://upload.wikimedia.org/wikipedia/commons/f/f3/Hsas-chart.jpg

Threat Index ...

progress bar, 0 to 100

0 - 20
20-40
40-60
60-75
75-100

25 pts for ATTITUDE ... -15 to +15 = 25 to 0
25 pts for strength rating ... -50% to +50% = 25 to 0 (str = us / them - 1)
20 pts for close borders or ocean exposure (us) and them with knowledge of astronomy
30 pts if they are WHEOOH

Can anyone suggest items that we can add to the calculation of the threat index so that it is more gradual and not so lump (ie WHEOOH!)

WHEOOH should be a multiplier, rather than an addition. If the overall threat level is low, then the odds that they're coming after you is also low.

Do AI also say WHEOOH if they're already at war? That would be low threat level as well. In fact you may want to add in already at war with someone else as a reduction to threat level anyway.

Close borders should be a bigger value than astronomy + coastal city. Unless their fleet is known to be in the ocean, approaching. :eek:

EmperorFool
Apr 24, 2008, 10:52 AM
WHEOOH should be a multiplier, rather than an addition. If the overall threat level is low, then the odds that they're coming after you is also low.

I agree; if I don't fear their army, that they are gearing up for war doesn't increase my fear any more. If I fear their SoD, I pretty much drop whatever I'm doing and start mobilizing if I see they go WHEOOH.

Do AI also say WHEOOH if they're already at war? That would be low threat level as well. In fact you may want to add in already at war with someone else as a reduction to threat level anyway.

I believe so. I can't remember having an AI declare on me while being at war with someone else.

I know power rating captures the following, but maybe some would still be good to include separately.

First, key technological differences like access to Macemen when you only have Axemen or Riflemen when you only have Macemen. Ideally it would increase with each turn that the gap remained and dissipate once you close it.

Second, access to strategic resources.


Iron is slight at first
No metals is bigger at time of Macemen
Coal is slight (faster redeploy in borders)
Oil is huge
I think the major thing that is missing from all this is some sort of insanity level of the particular AI. Monty, Issy and Shaka should get an automatic bump up to the next higher threat level.

Finally, is there an event for when the AI extorts money or a tech. Perhaps this is a sign they think they might like to attack. I know I've started giving in to those demands more often after reading Sisiutil's ALCs.

ruff_hi
Apr 24, 2008, 11:00 AM
I like the WHEOOH as a multiplier. Building in complicated tech differentials is possible but I'm not sure I want to hard code those. Maybe I include key military techs (Copper, Iron, CS+Mach, Rifling, Industrialisation, Tank tech) in a similar way that I am including strategic resources. I am not putting in modifications for known nut-cases (Monty, Boudica, etc) as the player has to think about this themselves. Actually, we could make this a configuration (list of leaders with level adjuster ... -1, 0, +1) and include that in the ini file (not the option screen).

I think that they have a different reason for not trading war declarations if they are already in a war.

EmperorFool
Apr 24, 2008, 12:29 PM
Actually, we could make this a configuration (list of leaders with level adjuster ... -1, 0, +1) and include that in the ini file (not the option screen).

GMTA. I thought exactly this as I read your post. This would work great.

I think that they have a different reason for not trading war declarations if they are already in a war.

Sure, and the point is that you need to take that into consideration. If they are WHEOOH, it's only a multiplier if they are not at war. Maybe being at war just makes it less of a multiplier, but I almost think being at war itself should be a multiplier (e.g. 50% or 66%). Actually, sometimes they will be at war but not be WHEOOH, right?

ruff_hi
Apr 24, 2008, 12:32 PM
I think they are WHEOOH if, and only if, they are preparing for war. If they are in a war, they give another reason.

http://civilization4.net/files/modding/PythonAPI/Types/DenialTypes.html

EmperorFool
Apr 24, 2008, 02:56 PM
I'm pretty sure in my current game one of my friends was at war and said WHEOOH when I checked if they'd join in my war against a different AI. I'll check some of my back saves.

Edit: Yes indeed. Brennus declared war on Elizabeth (who was at war with Monty). This is the only war at this time. Brennus is WHEOOH for declaring on all other AIs. I don't know if it makes a difference, but he wants peace with Elizabeth as he's lost all his troops in her land and cannot advance (didn't advance actually).

Perhaps that's the difference. If the AI is willing to end the war, it cannot start another one yet?

ruff_hi
Apr 26, 2008, 05:22 AM
I'm stuck! I'm trying to write a short python function that will return the following (input parameter is the leader the active player is trying to trade with):

1) Yes / No / Mixed based on if it will declare war on all known players, no known players or a mixture of yes and no
2) The reason for not declaring war (first No answer)
3) boolean if any reason is WHEOOHs

I've looked at the code for trading tech and resouces but, to me, a war declaration is different as I need to loop over the other players to see if the input player will trade war to the active player.

This is what I have so far ...

def getDeclareWar(self, iLeader):
sReturn = ["", "", False]
tradeData = TradeData()
tradeData.ItemType = TradeableItems.TRADE_WAR

for iLoopLeader in range(gc.getMAX_PLAYERS()):
gcLoopLeader = gc.getPlayer(iLoopLeader)
if (gcLoopLeader.isAlive()
and (gc.getTeam(gcLoopLeader.getTeam()).isHasMet(gc.ge tPlayer(self.iActiveLeader).getTeam())
or gc.getGame().isDebugMode())
and not iLoopLeader == self.iActiveLeader
and not gcLoopLeader.isBarbarian()
and not gcLoopLeader.isMinorCiv()):

# code here to check if iLeader will trade war with iLoopLeader to iActiveLeader

return sReturn


Other functions I will have to use ...
loopPlayer.canTradeItem(iActivePlayerID, tradeData, False))
loopPlayer.getTradeDenial(iActivePlayerID, tradeData) == DenialTypes.NO_DENIAL and other denial types ... in particular 'DENIAL_TOO_MUCH'

ruff_hi
Apr 26, 2008, 05:35 AM
I've committed what I have to the SVN. It is still very much (!!) a work in progress - the code is a bit of a mess but it works. Be sure to grab IconGrid_BUG.py as I had to add some functionality to IconGrid.py for the military adviser (namely, the ability to hide the grid items and for a cell to hold a progress bar).

EmperorFool
Apr 26, 2008, 07:24 AM
I'm heading out for the weekend, returning Monday, but off the top of my head I'm guessing that you need to put the target Civ into the TradeData.iData field.


tradeData.iData = iLoopLeader
# Check if it will trade, and if not, grab the DenialType

Sorry for the lack of detail. Check MoreCiv4lerts for examples of checking the status of a trade. I think that's all you're missing.

BTW, if you want to match your naming style with the rest of the BUG code (and most mods I've seen so far), here are a few changes.


Use "p" as a prefix when "pointing" at an object instead of "gc".
Technically, iLoopLeader is actually a player #; you'll see iLoopPlayer a lot. The pPlayer you get from gc.getPlayer(iLoopPlayer) has a method, getLeaderType() which returns a LeaderHeadType, technically the Leader #.
I can't wait to check it out when I get back. This will be a really nice addition to the game.

ruff_hi
Apr 26, 2008, 08:01 AM
noted on the player / leader thing ... I've only recently been using leader so it shouldn't be a biggie swapping that back. re pointer ... as soon as I figure out what a fracking pointer is ... I will start using a 'p'.

Thx for the trade info ... I'm off to watch the mets v braves ... will look at it when I get back or tomorrow.

EmperorFool
Apr 26, 2008, 01:00 PM
A pointer is the address of some object in memory, whether that's an int, a string, or a CyPlayer.

Think of an address like the address to your home. The address is not your home -- you cannot live in it, and it has no bedrooms. It only "points to" your home. Given your address, I can find your home.

If you want me to come to your home, you don't describe your home in every detail, thus "giving me" your home. That would take too much time; it's an "expensive" operation. Instead you give me the address.

The same goes for objects like CyPlayer. The code uses the address in memory of the object as a reference to it. It can pass the pointer to other functions cheaply since it's a small amount of data. If it were to pass all of the data in the CyPlayer each time, it would be more expensive.

Pointers serve other more important purposes, however. By passing a pointer, the function that receives it can modify the original object.

For example, if you tell me your house is blue, I can't change its color. But if you give me your address, I can go to your home and paint it.

On a related note, the ever popular prefix in Windows coding "sz" means "string, zero-terminated." That means that the variable holds a string of characters ending in a special "this is the end" character that has ASCII value zero.

The practice of using standard prefixes in variable names is called Hungarian Notation. It became popular with the introduction of loosely-typed languages like VB. Python is loosely-typed as well. Languages like C, C++ and Java are strongly-typed: you have to tell the compiler exactly what each variable can hold.

This is acceptable, though confusing, in Python


x = 5 # holds an int
x = x + 3 # ok, now it holds the int 8
x = "Bob" # now it holds a string
x = x + 4 # runtime error, "cannot concatenate str and int"

You won't find the problem until you run the code. In Java, it won't even be runnable at all.


int x = 5; // can only hold an int
x = x + 3; // ok
x = "Bob"; // compile error, "cannot assign String to int"

Each type of language typing rules has its advantages. Most people shy away from Hungarian Notation (clear documentation is far preferable), but almost all of the code pulled into BUG uses it, so I did as well when changing things. You'll see much of the new BUG code doesn't use it.

ruff_hi
Apr 27, 2008, 12:09 PM
Just uploaded the latest version of the military adviser. The only (!) outstanding items are the threat index and the strategic resources.

http://img72.imageshack.us/img72/7034/bugma0067pn3.jpg

ruff_hi
Apr 27, 2008, 12:11 PM
For example, if you tell me your house is blue, I can't change its color. But if you give me your address, I can go to your home and paint it.Actually, the house is gray and it does need a paint. Thx for your offer - I will be in contact to take you up on that ... gee I hope you paint well.

Anyway - back to pointers - very nice description above. That just leaves me with the problem of when is a variable a pointer and when is it an int :D

ruff_hi
Apr 27, 2008, 12:54 PM
I'm at a bit of a cross roads about what to do with the strategic resources column. Initially, I thought to show the strategic resources they didn't have and / or the number that they did. Then I thought that the resources don't hurt you - it is the units they can build that do. So, I could show the units that they can build in this column - that would be a lot in the late game and devalue this column.

So, now I am considering showing the units that they can currently build (that you cannot build) based on their known tech and known resource. Thus, if they know bronze working and have copper but you cannot build axemen, then this column would show axemen in that list.

Thoughts / comments / input?

alerum68
Apr 27, 2008, 01:30 PM
I like the last option best. That, or maybe just their most powerful unit they can build with their resources?

ruff_hi
Apr 27, 2008, 02:20 PM
I like the last option best.Thinking further about this ... it should be pretty easy. Get the list of units that the other leader can build (excluding non-combat units - workers, spies, missionaries, settlers, etc) Get the list of units you can build (excluding non-combat units) Compare lists removing duplicates Remove units from the list where the player does not know, or cannot research, the required tech and you are done (I think)

EmperorFool
Apr 27, 2008, 05:25 PM
I like that a lot as well. It sums up their military technological advantage. I wonder how easy it will be to code up, however.

Consider that cities that are not attached to their trade network will have a different set of buildable units. I know this is very rare in the late game where the list could get large. A good source of example code will be the code in CvMainInterface that draws the build order section in the bottom-center of the screen.

About the "denial reason" column, I wonder if this has any value as is. Clearly, if they are WHEOOH, that needs to be shown. I believe if they say that about AI X, they say it about all AIs.

However, the other denial reasons will vary based on the AI, so a single reason is misleading and I dare say unimportant. Perhaps this just needs to be a WHEOOH column by itself. Sure, it's in the threat index, but I think it's important enough to be called out separately. I still want to add it to the scoreboard.

ruff_hi
Apr 27, 2008, 07:22 PM
Some people have been talking about how unbalancing a WHEOOH alert is. I wanted to display the info but make the user work a little bit for it. Oh - by the way, the underlying denial for WHEOOH is 'DENIAL_TOO_MANY_WARS' which is interesting. It is generated when the AI is at war and has too much to do to. I guess it is also generated when the AI is planning for war. I was thinking of wrapping the text to fix the overflow problem but maybe we just go with the WHEOOH option and put a little fist beside the leader head.

EmperorFool
Apr 27, 2008, 10:33 PM
I understand the argument about it being an unbalancing feature, but I disagree somewhat. If you have the patience to check each AI each turn, you will get the same feature.

Thus, being uber patient or having nothing better to do with your time is an unbalancing feature. Similarly, being a good tactition is an unbalancing feature.

This alert would actually balance it so everyone -- even impatient people -- can use this information. As it stands, I only benefit from the info now if I happen to randomly check and they have it. That's not skill -- it's luck, and I don't want luck where it's not needed.

In any case, make it an option and we satisfy everyone. :) I know, that wouldn't satisfy everyone, but it sounds good.

And ya, I was thinking the fist, too.

ruff_hi
Apr 28, 2008, 03:59 AM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
strategic units on the main screen
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside
free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box
glance screen


I'm not above asking for help so if anyone wants to chip in, feel free. I'm going to be looking at the main sort criteria today so the other items are free for your pleasure.

ruff_hi
Apr 28, 2008, 07:49 PM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
strategic units on the main screen
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside
free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box
glance screen


How do you return 2 items from a function?

EmperorFool
Apr 28, 2008, 09:30 PM
How do you return 2 items from a function?


def getXandY():
return 2, 5

def printXandY():
x, y = getXandY()
print x
print y

In the above the return statement creates a tuple (an unmodifiable list) containing the two values 2 and 5. Using "x, y = ..." breaks apart the tuple. You could also do


def printXandY():
values = getXandY()
print values[0]
print values[1]

but I generally reserve that for when the returned items truly form a single item, for example a 3D point (x, y, z).

ruff_hi
Apr 29, 2008, 07:38 AM
Thx EFool - that will come in useful. I've split my work into first release and future release so that I am forced to concentrate on getting a version finished as opposed to playing with future features.

MA status ...

threat index - need to settle on the initial calculation routine and put it into play
strategic units on the main screen
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)
hide strategic resource information if no tech and resource trading
hide threat index if cannot see power


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box
glance screen

Currently working on threat index.

ruff_hi
Apr 29, 2008, 08:25 PM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
hide threat index if cannot see power
strategic units on the main screen
hide strategic resource information if no tech and resource trading
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box
glance screen

Currently working on threat index.

·Imhotep·
May 01, 2008, 08:35 AM
@ruff:

Here is a shot from my recent game.

http://img360.imageshack.us/img360/3664/mave3.jpg

Right now it doesn't weight defensive pacts correctly. I have defensive pacts with Mehmed and Ramesses (both are friendly towards me) which means they can't declare on me right now - so the threat index should be guarded/green. Also Monty is a vassal of Mehmed and can't declare, yet the threat index is high... This is with latest revision 654 (or 652?) from the SVN.

Imhotep

ruff_hi
May 01, 2008, 08:46 AM
Threat index is calculated from:

relationship ... -15 to +15 is rescaled to 0 to 38
strength ... 50% to 150% (us / them) is rescaled to 38 to 0
threat is sum of above times 1.3 if WHEOOH

(38+38) * 1.3 is approx 100 which is what I was aiming for.

5 categories are delimited by ...

< 15 then Low
>= 15 and < 35 then Guarded
>= 35 and < 55 then Elevated
>= 55 and < 75 then High
>=75 then Extreme


I am more than happy to take suggestions into the make up of this threat index to include other items and to change the cutoff positions.

EmperorFool
May 01, 2008, 10:51 AM
First is to define exactly what "Threat Index" means in subjective terms (not numbers). For example, is it the likelihood that an AI will DoW on you or the danger they would pose if you were warring?

If it's the former, than having a PA should eliminate the index, and a DP with them should lower it (can they not declare war at all, or just less likely to?). Also, perhaps them having a DP with other civs would lower their likelihood of DoWing and losing the DP (dunno). Being a vassal would eliminate the index since they cannot DoW.

If it's the latter, having a DP with a civ other than you should possibly increase the index because it only matters if you DoW on them. Having a PA with another civ should increase the index as well.

Actually, I can see the argument against both of these as long as the player keeps in mind to consider the index of all civs that will be involved in the war. It would be difficult to quantify how the index should change as a result of a DP or PA, since it should really change based on the index of the other civs, but that then causes a feedback loop.

I think were aiming for the latter, not trying to guess the likelihood of a DoW but rather just judging the seriousness of being in a war with each civ.

Suggestion: Maybe PAs should be denoted in the screen somehow, perhaps by grouping those civs together. At least have some sort of mark so you are aware that you may be fighting multiple civs.

ruff_hi
May 01, 2008, 11:43 AM
I view the threat Index (TI) as an indication of the likeihood of a war declaration combined with how bad that would be. I think that we should include DP and Vassals in the calculation - maybe combine the calculation for PAs. All of the calculation inputs should be opened to the user so that they can turn things off but we should definitely have a view on what it is. I'll think about this and post more later (maybe the weekend).

Also, allow for an adjustment by leader.

Ekmek
May 01, 2008, 12:16 PM
I like the WHEOOH as a multiplier. Building in complicated tech differentials is possible but I'm not sure I want to hard code those. Maybe I include key military techs (Copper, Iron, CS+Mach, Rifling, Industrialisation, Tank tech) in a similar way that I am including strategic resources. I am not putting in modifications for known nut-cases (Monty, Boudica, etc) as the player has to think about this themselves. Actually, we could make this a configuration (list of leaders with level adjuster ... -1, 0, +1) and include that in the ini file (not the option screen).

I think that they have a different reason for not trading war declarations if they are already in a war.

arent there AI weights in the xml associated with more important resources and techs. Maybe that could used in the point system for the threat level.

ruff_hi
May 01, 2008, 12:29 PM
arent there AI weights in the xml associated with more important resources and techs. Maybe that could used in the point system for the threat level.No. That information is not available via the usual interface and so I don't think that we will be reflecting this information. Actually, this is another argument against having any leader adjustments included. Hmmn - as such, I don't think the 'production' version of BUG will include this but I think that we should include the ability for this so that the user can adjust it - just to stop requests coming in - thoughts?

EmperorFool
May 01, 2008, 12:54 PM
I'd recommend leaving out the per-AI user adjustments and focus on the main features. I'm already used to keeping an eye on Monty, and I bet others are as well. Put it into the feature tracker and we can hit it later.

ruff_hi
May 01, 2008, 02:33 PM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
hide threat index if cannot see power - could include comment "n/a"?
strategic units on the main screen
hide strategic resource information if no tech and resource trading - see if I can include comment
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)
Add list of leaders that the current leader has a DP with
Add list of leaders that the current leader has vassalaged
Adjust Threat Index to include reduction value for DPs (say, 0.6?)
Adjust Threat Index for leaders that are vassals (duplicate their masters or completely remove?)
master icon - do we want this?


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box
glance screen
worst enemy icon (only when patch has been released)

Currently working on threat index.

ruff_hi
May 02, 2008, 02:44 PM
Main sort criteria on the deployment tab ...

Currently, the main sort criteria is unitcombattype. Non combat units (workers, settlers, etc) have a combat type of 0. The other units have a combat type of 1, 2, etc. This makes it really easy to use the combat type as an index (0, 1, 2, 3, ...) and that is the way the code has been set up.

I want to free up the main index (leave the other 3 as they are - which are unit, array of all units, unit count). There are also some sub-routines (is that the right name) that control if you select a group, then you also select the subsets of that group. The parameters are very inconsistent in that some take the unit id, some take the unit type, others take the unit pointer. I want to consolidate all of those items and make it a single type ... unit pointer.

Now, if python was like C, or Visual VB, we could use a text value as a pointer to an array value (or the key to a member of a class). However, to the best of my knowledge, we cannot do that. So - here is what I am thinking regarding the main index ...

it needs to be a number .. 0, 1, 2, 3, ... it should be open ended and anything could be it
So, in my advanced programing skill (HAHA!), here is the method that I developed that will do this ...

create an array called PrimaryIndexKey. Use that index to hold the values that reflect the main index and use the array index for that value as the index for the unitlist index. Maybe an example would be clearer ...

Example

Say you want to use the following as your main index ... Own City Own Territory Foreign City Foreign Territory Other

... then you would need to execute the following code (pseudo) ...

PrimaryIndexKey = []
call getPrimaryIndexValue (pUnit) which does the following: determine the type of key you are looking for (in this case, one that is unit location based) check PrimaryIndexKey to see if the value this unit has (ie Own City) is in the array (loop over the PrimaryIndexKey array if it is, just return the index and the fact that you found the index and you are done if it isn't, append the value and return the index and the fact that you had to append the value.... now, back to the calling subroutine, then you get back a true / false and a number. If the boolean value is true, then you need to append an array to the unitlist array (I think it is [0,0,[],0 but check the code). Then use the number you get back from getPrimaryIndexValue to add that unit to the unitlist array.

The following is the code that zero-ises the unit list array ...

for iUnit in range(gc.getNumUnitInfos()):
self.unitsList[iUnit] = (gc.getUnitInfo(iUnit).getUnitCombatType(), iUnit, [], 0)


obviously, we cannot use this, thus we need to go with ...

self.unitList = [[]]

... and when we append a unit, we add something like this ...

x = getprimarykeyindex

self.unitlist.append(x, unit.unittype, [], 0)

Well - that was my thoughts but feel free to laugh and tell me the right way to do it. When we do it, I thing that the first that we should code up is the type of key = unitcombattype (ie what it is now) and then we should have the code exactly replicate what you currently see.

ruff_hi
May 02, 2008, 02:48 PM
Now - regarding the screen - I was thinking that we move the map down a touch, put in a drop down that contains the possible primary keys available, a check box that says "auto refresh" with hover "auto refresh when changing the drop down or using F5)" and a Text "Refresh" that is visible when the list box is dirty and not there when it is not.

Layout would be ..

[-----------drop down----------------]
[------check box-----][---refresh-----]

[-------------MAP -------------------]
[-------------MAP -------------------]
[-------------MAP -------------------]
[-------------MAP -------------------]
[-------------MAP -------------------]
[-------------MAP -------------------]
[-------------MAP -------------------]

[---GREAT GENERAL -PROGRESS BAR---]

EmperorFool
May 02, 2008, 03:16 PM
I'll start with the easy part first. :)

. . . a check box that says "auto refresh" with hover "auto refresh when changing the drop down or using F5)" and a Text "Refresh" that is visible when the list box is dirty and not there when it is not.

Why is this needed? The only reason to change the primary key index is to refresh the list. If there were multiple selection criteria, e.g. filtering checkboxes and such, then it may make sense. Also, it isn't necessary if it is quick to run.

That being said, I understand all that you said there and am on the same page. Now that tougher part.

First, as I understand you, the primary key index is the criteria by which the list groups units. Initially we'll have combat type, but others could be location, promotions, whatever. Okay, I doubt we'd do promotions, but it could be done.

Now, if python was like C, or Visual VB, we could use a text value as a pointer to an array value (or the key to a member of a class).

I think by this you mean a Python dict(tionary) class (http://docs.python.org/lib/typesmapping.html). It is like an array in that you use an index to locate an item, but it is different in that the index can be anything -- a string, an int, a float, a Butterfly or PyPlayer object, whatever you want. Also, with Python you can mix them in the same dict, which I do not recommend.


units = {}
units["Warrior"] = [CombatType.MELEE, gc.getUnitInfo(...)]
units["Archer"] = [CombatType.ARCHERY, gc.getUnitInfo(...)]
...
print units["Warrior"][1].getName()

The only naughty point is that dictionary keys are not ordered, so you have to sort them some other way. This is pretty straightforward, but not as trivial as when using an array.


# print out unit names, sorted by combat type above
keys = units.keys()
keys.sort()
for key in keys:
unit = units[key]
print unit[1].getName()

Now I poked around the code a little when looking at the GG thing, and my first impression is :eek:. It is horribly inefficient and needlessly complex. It would not take much to rewrite it, and I highly recommend doing so in order to make adding more grouping types.

I'm quite happy to do this part if you don't mind. I think what I can come up with will then be far easier for you to add more groupings to.

ruff_hi
May 02, 2008, 06:06 PM
Why is this needed?The F5 takes a long time to load because it is populating the array prior to displaying it. I can easily see the situation where the user wants to display units by location (say) but the last time he used F5 it was set up to show by level. He hits F5, has to wait until the stupid array is populated just to change the primary key and wait again.

I think by this you mean a Python dict(tionary) class (http://docs.python.org/lib/typesmapping.html).Did you read the part about me being a hack coder and not actually understanding anything that I am doing?

I'm quite happy to do this part if you don't mind.Be my guest. Are you planning on linking the dropdown to the bug.ini file - that was what I was thinking.

EmperorFool
May 02, 2008, 06:17 PM
He hits F5, has to wait until the stupid array is populated just to change the primary key and wait again.

Ah good point. I hadn't thought of it applying between F5 hits. I also realized there are other filters: the leaders you select. The user may want to click a few leaders and then load the list.

Did you read the part about me being a hack coder and not actually understanding anything that I am doing?

You've done some good stuff so far, so don't sell yourself short. I just wanted to make sure I understood what you were saying so I could explain the right thing.

Are you planning on linking the dropdown to the bug.ini file - that was what I was thinking.

How about an option to set the default selection that gets used each time you start civ? I would just rather not rewrite the .ini file every time they select a new option in the MA itself. I'm going to do the same thing for Raw Commerce -- you will set a BUG option to determine the default when civ loads, but switching it in the city screen won't change that default. Cool?

ruff_hi
May 02, 2008, 06:26 PM
How about an option to set the default selection that gets used each time you start civ? I would just rather not rewrite the .ini file every time they select a new option in the MA itself. I'm going to do the same thing for Raw Commerce -- you will set a BUG option to determine the default when civ loads, but switching it in the city screen won't change that default. Cool?Sounds good.

As I read the code, all visible units (regardless of leader) are loaded into the array at the start so selecting the leader is just a matter of refreshing the list box and you don't have to loop over the units again.

I'm at the stage of removing junk from the MA but I haven't touched the deployment subroutines for ages. Feel free to work from the version in the SVN. I only have the strategic resources columns to go and then I will upload what I have.

Edit: Oh, have to revisit the index too and ... oh, just see the latest status post above.

ruff_hi
May 03, 2008, 08:01 AM
Here is a screenie from the sit rep from the latest version ...

http://img292.imageshack.us/img292/6954/bugma0068jx0.jpg

little fist shows WHEOOH strategic advantage is when you can build a unit and the AI player cannot strategic disadvantage is when the AI player can build a unit and you cannot two hidden columns that should get displayed if they become required (vassals, defensive packs)

Note re no player water units in above pic: the units to build are generated from the capital city so if the capital city doesn't have water access, then no navel units can be built and it appears that the AI has an advantage. I'm going to include code to cycle thru the units and include all combat units that can be built anywhere - this will remove this problem.

Note re strategic disadvantage of out of date units: I'm currently just checking on a 1 to 1 basis, I need to remove a unit if a player can build it or one of the units that that unit upgrades to. This will remove (say) the horse archer from Monty because I can build the knight.

The threat index is as per above but now includes: not shown if AI player is a vassal multiplied by 20% if AI player has a defensive pact with human player

ruff_hi
May 03, 2008, 08:04 AM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
hide threat index if cannot see power - could include comment "n/a"?
strategic units on the main screen
hide strategic resource information if no tech and resource trading - see if I can include comment
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)
Add list of leaders that the current leader has a DP with
Add list of leaders that the current leader has vassalaged
Adjust Threat Index to include reduction value for DPs
Adjust Threat Index for leaders that are vassals (duplicate their masters or completely remove?)
master icon - not enough room
remove strategic units if player can build an upgrade of a unit
cycle thru cities so that all units possible are included
expose all text to XML for multi-language support


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box <-- EmperorFool has stuck his hand up for this one - good luck!
glance screen
worst enemy icon (only when patch has been released)


Currently working on improving the strategic unit list for improved units and water units.

alerum68
May 03, 2008, 08:06 AM
That looks so good Ruff... I wouldn't be suprised if this gets rolled into the next patch for BTS. BTW - Are you using the US's comical threat index names?:)

ruff_hi
May 03, 2008, 08:09 AM
That looks so good Ruff... I wouldn't be suprised if this gets rolled into the next patch for BTS. BTW - Are you using the US's comical threat index names?:)Yes - see post a page or two back. Using that terminology and colour scheme.

Cammagno
May 03, 2008, 08:39 AM
Note re no player water units in above pic: the units to build are generated from the capital city so if the capital city doesn't have water access, then no navel units can be built and it appears that the AI has an advantage. I'm going to include code to cycle thru the units and include all combat units that can be built anywhere - this will remove this problem.

It will also remove problem of capital city not been connected to some resource to which the other cities instead are connected.

Note: last commit in SVN seems to have a bug (I think in IconGrid_BUG.py), no interface at all using it, everything ok reverting to previous one.

ruff_hi
May 03, 2008, 08:53 AM
oops - that is what happens if you change a statement with zero testing. Fixed.

·Imhotep·
May 03, 2008, 09:53 AM
@ruff:

Sit - Rep is not working ATM for me - if I try to change to it all I get is a the map from the overview page and the rest is blank. Tried clearing the cache too...

The Doc
May 03, 2008, 10:21 AM
That looks so good Ruff... I wouldn't be suprised if this gets rolled into the next patch for BTS. BTW - Are you using the US's comical threat index names?:)

+++
Really awesome. :D

Just a small suggestion: I think it would be better to show the threat index even when the civ is an ally or vassal, maybe as empty bar with a title that tells that the civ is an ally or vassal respectively. That way it wouldn't look as if the index is broken or something. :)

Cammagno
May 03, 2008, 10:48 AM
+++
Really awesome. :D

Just a small suggestion: I think it would be better to show the threat index even when the civ is an ally or vassal, maybe as empty bar with a title that tells that the civ is an ally or vassal respectively. That way it wouldn't look as if the index is broken or something. :)

I support this. And it gives the info of them being ally or vassal witthout the need of other columns.

EmperorFool
May 03, 2008, 11:56 AM
Wow, Ruff, this looks really nice! Here are a couple suggestions from the screenshot:


Change "Strategic" label on top line to "Strategic Advantage" and change the labels below to "Theirs" and "Ours". I assumed the advantage showed their advantage, so this would make it totally clear I think.
Perhaps include a modifier to the TI for WE? +10% maybe (1.1)?

I also agree that this looks like something Firaxis should include. :goodjob:

Sam_Yeager
May 03, 2008, 01:53 PM
I notice the screenie in post #71 still reads 'Thread Index' :rolleyes: Time for a global find and replace? :D

EmperorFool
May 03, 2008, 02:00 PM
Two more nitpicks:


If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap.
One of my maps is big enough to force the combat experience bar so low that it partially covers the Units tab text.

·Imhotep·
May 03, 2008, 04:40 PM
Okay, I don't know what's actually wrong here - but with revision 708 I have no useable MA at all ! Installed BUG anew thrice to no avail...

http://img291.imageshack.us/img291/8145/civ4screenshot0000qm2.jpg

Solutions appreciated, BUG is running fine apart from that.

Imhotep

EmperorFool
May 03, 2008, 05:02 PM
Crap, I committed my half-done MA changes accidentally when I applied Amra's Sevopedia addition. I've fixed the problem. Sync up and try again, please. You should also now see Amra's addition.

I apologize for the partial commit. I deselected the wrong modified file. :(

ruff_hi
May 03, 2008, 05:45 PM
Just a small suggestion: I think it would be better to show the threat index even when the civ is an ally or vassal, maybe as empty bar with a title that tells that the civ is an ally or vassal respectively. That way it wouldn't look as if the index is broken or something. :)It shows for players that have a DP with you. I was going to add 'Vassal' and no progress bar for leaders that are someone's vassal. There are two extra columns that are added if vassals or DPs exist in the game ... one showing vassals and the other showing DPs.

Change "Strategic" label on top line to "Strategic Advantage" and change the labels below to "Theirs" and "Ours". I assumed the advantage showed their advantage, so this would make it totally clear I think.Good suggestion - was never really happy with what I had.
Perhaps include a modifier to the TI for WE? +10% maybe (1.1)?Not so sure on this because it is a little bit of double counting. They already have a higher threat index because of the negative attitude.

ruff_hi
May 03, 2008, 05:46 PM
If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap.I've seen that and haven't really developed a solution. The 'bringminimaptofront' command doesn't seem to work. Solution I have is exit F5 and restart - minimap comes up then. Not idea but it works.

ruff_hi
May 03, 2008, 05:48 PM
One of my maps is big enough to force the combat experience bar so low that it partially covers the Units tab text.
Stop playing with big maps. Ok, quite happy to move the stupid thing around. What do you think of a panal that is the background for the map, progress bar and the unitlist panal?

ruff_hi
May 03, 2008, 05:49 PM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
hide threat index if cannot see power - could include comment "n/a"?
strategic units on the main screen
hide strategic resource information if no tech and resource trading - see if I can include comment
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)
Add list of leaders that the current leader has a DP with
Add list of leaders that the current leader has vassalaged
Adjust Threat Index to include reduction value for DPs
Adjust Threat Index for leaders that are vassals (duplicate their masters or completely remove?)
master icon - not enough room
remove strategic units if player can build an upgrade of a unit
cycle thru cities so that all units possible are included
expose all text to XML for multi-language support
BUG: If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box <-- EmperorFool has stuck his hand up for this one - good luck!
glance screen
worst enemy icon (only when patch has been released)


Currently working on improving the strategic unit list for improved units and water units.

EmperorFool
May 03, 2008, 05:50 PM
Not so sure on this [modifier for Worst Enemy] because it is a little bit of double counting. They already have a higher threat index because of the negative attitude.

Good point. I don't know the AI mechanics at all. The only thing about WE I do know is that if you trade with a WE you get negative diplomacy modifiers, and that doesn't apply here really.

I do know that I've seen an AI give me a penalty for trading with their WE only to scan the Glance tab to find they were at Pleased or Friendly with every civ. So they were pleased with their worst enemy. Nice. This is right up there with being at war with an AI that is still pleased with you. :)

EmperorFool
May 03, 2008, 05:55 PM
What do you think of a panal that is the background for the map, progress bar and the unitlist panal?

That sounds fine to me. I'm quite happy to have it all on one panel like the FA, a single blue (or whatever) background behind everything.

Also, I continued the thing I started earlier -- showing GG-led units as another group in the list -- so I could get familiar with the original MA code, and have it working. I have the minimap showing up correctly all the time now with a minor related quirk. Once I get that done I'll commit.

To handle different groupings, I'd like to rewrite all the unit location code from scratch as I said earlier, and I won't be able to complete that today.

ruff_hi
May 03, 2008, 06:01 PM
I'm flicking the whole 'deployment' screen to you - get wild!

EmperorFool
May 03, 2008, 06:05 PM
Is it really necessary to copy the Glance tab to the MA? By enabling the hover for the leaderheads, you'd get the list of diplomatic modifers, and if you really want to you could add the attitude icons to the Sit Rep tab.

For the label "Will Declare On" how about "Will Declare War" or "Will Go To War"? Hmm, "Will Declare War On" would be great, but it makes the column so wide.

ruff_hi
May 03, 2008, 06:09 PM
I can see myself want to go sit-rep, glance and back and forth - thought it would be good to have it very handy. The sit-rep uses icongrid which doesn't seem to support all of the hover text that you might want. I looked into adding the attitude icons but, again, icongrid does some fairly draconian text formatting. I'm thinking of freeing that up with format parameters but that is certainly something for down the track.

What about "Declare?" or "Declare On?"

EmperorFool
May 03, 2008, 06:35 PM
True about IconGrid, though it does have the hovers for techs in the trade screen. How about at least getting the hovers for the units? :) Regarding the attitude icons, they are just characters in the font like the fist you already have.

This just popped into my head, though I don't think I'm sold on it. The fist is currently being used as "at war" in the scoreboard. Perhaps instead of using it again here for "mobilizing" (WHEOOH), we could use the flexed arm (power) or the movement (foot, as in mobilizing). Ick, I don't much like any of those. :) Just tossing out (bad) ideas.

I wanted to get "war" in the label since "declare" is ambiguous to me (you can declare peace). I was thinking "Will Attack", but then the AI will often DoW without actually attacking. :crazyeye:

ruff_hi
May 03, 2008, 06:44 PM
I did have attitude in there originally and icongrid made it look horrible.

The hover for units is 'WIDGET_TRAIN' which works ok for units that you can train but causes a crash for units that you cannot (ie roman preat). Is there another unit based hover that we could use? Also, I couldn't get the hover to come through correctly - kept saying that a phant was a stealth fighter (or something like that).

"Go to War?" or "War?"

·Imhotep·
May 03, 2008, 06:45 PM
You might have a problem late game. I tested revision 709 with my recent Emperor game. MA broken. Went back to a save from 275 BC, same game. MA absolutely fine. The save for investigation is attached. Oh, and can you win the game for me ? :D ;)

Imhotep

ruff_hi
May 03, 2008, 06:52 PM
You might have a problem late game. I tested revision 709 with my recent Emperor game. MA broken. Went back to a save from 275 BC, same game. MA absolutely fine. The save for investigation is attached. Oh, and can you win the game for me ? :D ;)Thanks for this game - I'll take a look at why the sit-rep isn't showing up. I cannot believe that you built your capital on coal - what were you thinking? :D

Edit: I put in some code to try and add columns for vassals and DefPacks but only if they are present. It seems my code for doing this is broken. I'll revisit and see what I can do.

EmperorFool
May 03, 2008, 06:55 PM
Try WIDGET_PEDIA_JUMP_TO_UNIT.

Stealth oliphants!!! "Wait till the boys back at the Shire hear about this!"

Dunno about the heading. It's probably fine as it is now.

·Imhotep·
May 03, 2008, 07:00 PM
@ruff:

My guess it has something to do with PAs - as I have one with Ramesses but hadn't one 275 BC of course. Yet 275 BC Monty was a vassal of Mehmed and the MA worked just fine...I have the save if you want it.

Imhotep

EmperorFool
May 03, 2008, 07:13 PM
Okay, I've committed what I have on the deployment screen. The redraw problems should be fixed, so please play around with clicking lots of things. I can now start on the new version.

Here are the two groupings I know of:


Combat type + Lead by GG
Location

Your Cities
Your Territory
Friendly Cities
Friendly Territory
Enemy Territory
Neutral Territory


For Location, do we need to separate Friendly into Team and non-Team? I doubt it, but just asking. And do we care about Cities vs. Territory for Friendly?

The determination of own/friendly/enemy should be made regardless of the unit's owner, right? Meaning selecting an AI will show you their units in your territory under "Your Territory/Cities", right? Can you think of a better word than "Your"? "Home"? "Own"? "Domestic"? Your civ's adjective, e.g. "Indian Cities"?

What other groupings can you think of?

Now that I think of it, for the Location grouping, will the secondary grouping still be unit type? If so, that means you'll see each unit type under each grouping. This will make the list much longer. For combat type, Archers only appear under the Archery group. With Location, it will appear under each group where there is at least one Archer. Should we group by combat type instead?

Certainly, it would be nice to have a secondary grouping dropdown as well, so you could select "Location"/"Combat Type" or "Location"/"Unit Type" for more detail. I suppose you could then select "Combat Type"/"Location". Is this much detail desired, and more importantly, truly useful?

I need more ideas for groupings as that will help me in designing the code and interface.

ruff_hi
May 03, 2008, 07:21 PM
EFool - there are a bunch earlier on in this thread from me and Imhotep. See the first page.

Re combat type - I'd leave it as is first time thru and see how it looks.

ruff_hi
May 03, 2008, 07:32 PM
You might have a problem late game. I tested revision 709 with my recent Emperor game. MA broken. Went back to a save from 275 BC, same game. MA absolutely fine. The save for investigation is attached. Oh, and can you win the game for me ? :D ;)

ImhotepTry revision 711. I also imported EmporerFools' deployment code into my version of BUGMA which probably means that I introduced some errors in it :D.

EmperorFool
May 03, 2008, 07:51 PM
I'd rather like to see an overview of units with the currently highest XP.

That's a sort order -- not a grouping. Can you think of a way to group units by XP, for example by level? Okay, Ruff suggested by XP and level as well.

promotion

Grouping by promotion could work, but it has some quirks. Do you show those with Combat 3 in the Combat 1 group as well since they have C1? Same for other promotions with multiple levels.

Listing based on health status, and if the unit can be upgraded.

These both seem like candidates for filtering as opposed to grouping or sorting by adding checkboxes ("Injured", "Upgradeable" and "Promotable"), though grouping would work as well by creating two groups for each, or even a % scale in the case of Health.

Is "Movable" desired for finding units that can still move? It will highlight all defenders, so it's probably useless.

Did I miss any others?

Certainly, a sort order when displaying individual units is a good idea. XP, level, health, strength (normal or actual).

I'm wondering now if we could start with one of the other community MAs for this tab? IIRC, there's a good one but the complaint is that it's slow to load. I could take a look at it and see if I can optimize it. Any recommendations for one with great features?

alerum68
May 03, 2008, 08:02 PM
Is there anyway we can give it a reduce size healther bar, similiar to Ruffs Thread Index?

EmperorFool
May 03, 2008, 09:13 PM
Is there anyway we can give it a reduce size healther bar, similiar to Ruffs Thread Index?

Can you please elaborate? Are you saying to shrink the GG bar? Or are you talking about grouping by health?

ruff_hi
May 03, 2008, 09:43 PM
well - unit combat type is a sort order too. I was thinking that the list box would show a list of numbers so that you can see how many units you have that are 15 XPs. I see your point re promotion - can they get added in twice. I hate having to search for medic units.

I mainly use F5 for finding units that are hiding and for getting a unit count. Level would be good so that you can see which unit is closest to unlocking the HE and Pentagon.

alerum68
May 03, 2008, 09:52 PM
Yes, shrink the GG bar, and use it as a health bar... or maybe take the health bar that hovers over units, and have it displayed there?

Maybe, instead of adding a sort order for all promotions, just add it for ones that you use often. Medic Units, City Attackers, Woodsman II... things like that.

ruff_hi
May 03, 2008, 09:54 PM
Stupid unit upgrades. I found this code

gc.getUnitInfo(k).getUpgradeUnitClass(iUnit)

... which is a boolean but I cannot figure out if it shows that k is an upgrade of iUnit or the other way around. Look at this list ...

Unit to test ... Maceman ... the first boolean is k then iUnit and the next is them reversed. From the civopedia ... mace upgrades to rifle or Grenadier (which in turn, upgrade to infantry, etc. I'm hoping to get a list of all units that a mace could become.

Lion False False
Bear False False
Panther False False
Wolf False False
Settler False False
Worker False False
Fast Worker False False
Scout False False
Explorer False False
Spy False False
Cereal Mills Executive False False
Sid's Sushi Executive False False
Std Ethanol Executive False False
CreateCon Executive False False
Mining Inc Executive False False
AlumCo Executive False False
Civ Jewels Executive False False
Jewish Missionary False False
Christian Missionary False False
Islamic Missionary False False
Hindu Missionary False False
Buddhist Missionary False False
Confucian Missionary False False
Taoist Missionary False False
Warrior False False
Quechua False False
Swordsman False False
Jaguar False False
Gallic Warrior False False
Praetorian False False
Axeman False True
Phalanx False True
Vulture False False
Dog Soldier False False
Maceman False False
Samurai False False
Berserker False False
Spearman False False
Impi False False
Holkan False False
Pikeman False False
Landsknecht False False
Musketman False False
Musketeer False False
Janissary False False
Oromo Warrior False False
Rifleman False False
Redcoat False False
Grenadier False False
Anti-Tank False False
Infantry True False
SAM Infantry False False
Mobile SAM False False
Marine False False
Navy SEAL False False
Paratrooper False False
Mechanized Infantry False False
Archer False False
Skirmisher False False
Bowman False False
Longbowman False False
Crossbowman False False
Cho-Ko-Nu False False
Chariot False False
War Chariot False False
Immortal False False
Horse Archer False False
Numidian Cavalry False False
Keshik False False
Knight False False
Camel Archer False False
Cataphract False False
Conquistador False False
Cuirassier False False
Cavalry False False
Cossack False False
War Elephant False False
Ballista Elephant False False
Tank False False
Panzer False False
Modern Armor False False
Gunship False False
Catapult False False
Hwacha False False
Trebuchet False False
Cannon False False
Machine Gun False False
Artillery False False
Mobile Artillery False False


The CvPediaUnit.py file in 'def placeUpgradesTo(self):' has 'gc.getUnitInfo(self.iUnit).getUpgradeUnitClass(k) ' and shows the k unit button on the iUnit screen. There is also some other code that just clears up the unique unit issues (I think).

EmperorFool
May 04, 2008, 04:47 AM
I'm wrestling with how to add sort/group options and keep the list usable at the same time. For example, if you have a lot of units and select "Promotion"/"Unit Type" you'll see each unit type listed below each promotion with at least one unit of that type having the promotion. This will mean a lot of scrolling to see the totals:


ALL UNITS (182)
NONE (33)
Warrior (2)
Archer (10)
Axeman (4)
Swordsman (1)
Spearman (3)
Chariot (6)
Galley (5)
Trireme (2)
COMBAT 1 (18)
Warrior (1)
Archer (1)
Axeman (3)
Swordsman (2)
Spearman (4)
Chariot (2)
Galley (1)
Trireme (4)
COMBAT 2 (5)
Warrior (1)
Spearman (1)
Chariot (2)
Trireme (1)
...

I limited that to the early years when you have only a few promotable unit types (workers, settlers, spies, etc. would not be shown in the promotion view). Imagine this list when you've got 20 or so types.

Perhaps just adding a "None" grouping would solve this. You could select "Promotion"/"None" and see just the list of promotions without the unit type breakdown below it.

For the filtering checkboxes -- injured :yuck:, promotable (a star), can move :move:, upgradeable :strength: -- I'll need DDS graphics instead of the font glyphs. Is anyone particularly adept at The Gimp or some other graphics program and can make DDS versions (or find if they exist already) of these characters? If so, could you do the same for :food:, :hammers:, and :commerce:?

ruff_hi
May 04, 2008, 06:04 AM
For the filtering checkboxes -- injured :yuck:, promotable (a star), can move :move:, upgradeable :strength: -- I'll need DDS graphics instead of the font glyphs. Is anyone particularly adept at The Gimp or some other graphics program and can make DDS versions (or find if they exist already) of these characters? If so, could you do the same for :food:, :hammers:, and :commerce:?I can do that. Any thing else that you need?

EmperorFool
May 04, 2008, 06:15 AM
If you could sketch out some layouts, that'd be great. Space will be a premium, so I'm thinking we could move the GG bar elsewhere (to the bottom panel maybe?) or make it smaller and then put the group/sort/filter options above the map as you suggested.


[-------- L E A D E R H E A D S ---------]

Group: [Menu1] [Menu2] [--- L I S T ---]
Sort: [Menu] [x Details]
[---- Filter Buttons ----]

[------- M A P --------]

I figure two levels of grouping should be okay, yes? I'm not sure about sort yet. It really only applies when you are viewing the individual unit details. A button for that needs to be created as the current one is a bit large: "+/- Show Unit Details".

I've got the code to store define and capture all the groupings for the ones we discussed:


Combat Type
Unit Type
Promotion
Location

I'm currently dealing with Promotion as it is the first one to require multiple values for a single unit. None of this is being displayed or has even been tested in Civ yet, so don't get too excited. ;)

·Imhotep·
May 04, 2008, 06:20 AM
NEAT WORK GUYS ! The MA now works perfect with my late game save, and the map is drawn correctly when switching between Deployment and Sit-Rep. One minor issue with Sit-Rep: If the human can build only an obsolete version of the unit the AI has (in my case I have Tanks and Fighters, he has Modern Armour and Jet Fighters) the obsolete version shouldn't be listed as strategig advantage... other than that: very cool, this is a masterpiece !

Imhotep

ruff_hi
May 04, 2008, 06:25 AM
One minor issue with Sit-Rep: If the human can build only an obsolete version of the unit the AI has (in my case I have Tanks and Fighters, he has Modern Armour and Jet Fighters) the obsolete version shouldn't be listed as strategig advantage... other than that: very cool, this is a masterpiece !That is a known issue that I am trying to fix. I am not sure the python code allows me to do it ... or, I am using the wrong code (this is much more likely) :D.

ruff_hi
May 04, 2008, 06:27 AM
A button for that needs to be created as the current one is a bit large: "+/- Show Unit Details".Isn't that button just text and so we can shorten it in python? Suggest same for sort option.

Re GG progress bar - what about shoving it up with 'Military Advisor' to get it out of the way? Not pretty but ...

ruff_hi
May 04, 2008, 06:28 AM
MA status ...

threat index - need to settle on the initial calculation routine and put it into play
hide threat index if cannot see power - could include comment "n/a"?
strategic units on the main screen
hide strategic resource information if no tech and resource trading - see if I can include comment
scrolling - looked at this last night, copied the code and it didn't work - will look again and then probably put it aside - done and committed (revision 645)
Add list of leaders that the current leader has a DP with
Add list of leaders that the current leader has vassalaged
Adjust Threat Index to include reduction value for DPs
Adjust Threat Index for leaders that are vassals (duplicate their masters or completely remove?)
master icon - not enough room
remove strategic units if player can build an upgrade of a unit - currently looking at this but the code I see doesn't work :hmn:
cycle thru cities so that all units possible are included
expose all text to XML for multi-language support
BUG: If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box <-- EmperorFool has stuck his hand up for this one - good luck!
glance screen
worst enemy icon (only when patch has been released)


Currently working on cycling thru all cities to pick up all units that can be built.

EmperorFool
May 04, 2008, 06:51 AM
I'm pretty sure I can write some code to help you detect obsolete units. It will set up an obsoleted-by table when the screen opens and then use the set of all units you and the AIs can build to remove obsolete ones.

Psuedocode:


screen.open:
build obsolete table
build list of units player can build

for each non-player civ:
build list of units civ can build
draw list of player advantages using civ-unit-list
draw list of civ advantages using player-unit-list

Give me a few minutes* and I'll post some real code. :)

* Actual results may vary. Ask your doctor if you experience bleeding gums or severe flatulence.

EmperorFool
May 04, 2008, 07:02 AM
Quick question: If you can build Musketman, should the screen show Musketeer as an advantage for French AIs? If so, I assume it should not show Musketman as an advantage for you; they can't each be better than the other.

Of course, some would argue that Swordsman is better than the Aztec replacment -- the one that builds without Iron but is weaker. In this case, both should be shown.

The simple solution is to treat civ-specific units as the regular kind. In the first example, neither Musketman nor Musketeer would be displayed.

Which of the three options do you prefer?

EmperorFool
May 04, 2008, 07:56 AM
Here's a first attempt. It considers Musketman and Musketeers to be unrelated. They will each display in the advantages in the case I outlined above. This handles cases where the civ-specific unit isn't better than the default unit in all cases. It's left up to the player to decide.

You'll need to alter the code that you use to generate the list of units that a civ can build. I'd like to introduce you to the handy set() class (http://docs.python.org/lib/types-set.html). It holds a collection of objects (in this case unit type IDs), but each value will only appear once no matter how many times you add it. They are great for comparing to each other (union, difference, subset, etc).

Here's some sample usage code to highlight the functions you'll likely need to use:


units = set() # create a new, empty set
units.add(5) # put 5 into the set
units.add(2) # put 2 into the set
units.add(5) # 5 already in set, nothing happens

if 5 in units:
print "5 is in the set"
if 1 not in units:
print "1 is not in the set"

other = set()
other.add(1)
other.add(2) # other == (1, 2)

print units & other # intersection --> (2)
print units | other # union --> (1, 2, 5)
print units - other # minus --> (5)
print units ^ other # items only in one set or the other --> (1, 5)
# equivalent to union - intersection

Now here's the code so far. Note: I have not tested this at all.


def buildObsoleteGraph(self):
NUM_UNITS = gc.getNumUnitInfos()

# Create graph of single-step upgrades (Swordsman to Maceman)
self.obsoleteUnits = {}
self.completeUnits = set()
for iUnitA in range(NUM_UNITS):
infoA = gc.getUnitInfo(iUnitA)
upgrades = set()
self.obsoleteUnits[iUnitA] = upgrades
for iUnitB in range(NUM_UNITS):
infoB = gc.getUnitInfo(iUnitB)
if infoA.getUpgradeUnitClass(infoB.getUnitClassType() ):
upgrades.add(iUnitB)

# Now add all transitive upgrades (Swordsman to Rifleman)
for iUnit in self.obsoleteUnits.iterkeys():
self.buildObsoleteClosure(iUnit)

def buildObsoleteClosure(self, iUnit):
upgrades = self.obsoleteUnits[iUnit]
if iUnit not in self.completeUnits:
nextUpgrades = set()
for iNextUnit in upgrades:
nextUpgrades |= self.buildObsoleteClosure(iNextUnit)
upgrades |= nextUpgrades
self.completeUnits.add(iUnit)
return upgrades

def isObsolete(self, iUnit, enemyUnits):
upgrades = self.obsoleteUnits[iUnit]
return len(upgrades & enemyUnits) > 0

ruff_hi
May 04, 2008, 08:05 AM
Quick question: If you can build Musketman, should the screen show Musketeer as an advantage for French AIs? If so, I assume it should not show Musketman as an advantage for you; they can't each be better than the other.I was going to treat UUs as totally different units. So if Rome can build preats and I can build swords, then that is a strategic advantage to both of us. Admittedly, not much of an advantage to me but the user will have to just work those out by himself.

EmperorFool
May 04, 2008, 08:14 AM
Great! That's exactly what the code that I posted does. It wouldn't be too hard to make them equivalent, if you change your mind.

I'm against making one better than the other simply because the decision is a) subjective and b) situational. Beserker is pretty much the same as Maceman on a Pangea; the Iron-less Swordsman is usually not an advantage; Praets always kick ass over Swordsman, etc.

ruff_hi
May 04, 2008, 08:47 AM
like the code - thx EF. I'm just going to run thru my logic so that you can get a laugh and correct me. BTW - set() sounds great! I have a unit that player A can build ... UnitA (think horse archer).
I also have set of units that player B can build.
Now, I want to display UnitA if that unit (or any of the units that UnitA upgrades to) is not in the set that B can build. So if the set of units that B can build contains a chopper, then no horse archer.

There are obviously a number of ways of doing this but here is how I was thinking of approaching it.

pseudo code...

AllPlayerAs_Units = getCanTrain(PlayerA)
AllPlayerBs_Units = getCanTrain(PlayerB)

for UnitA in AllPlayerAs_Units
UpgradeSet_UnitA = get_set_of_units_to_check(UnitA)
if len(UpgradeSet_UnitA & AllPlayerBs_Units) > 0:
add UnitA button

def getCanTrain(PlayerA)
I already have this

def get_set_of_units_to_check(UnitA)
I will be looking at your code to build this

EmperorFool
May 04, 2008, 08:54 AM
That looks great. Part of the code is done above for you:


for UnitA in AllPlayerAs_Units
UpgradeSet_UnitA = get_set_of_units_to_check(UnitA)
if len(UpgradeSet_UnitA & AllPlayerBs_Units) > 0:
add UnitA button

becomes


for UnitA in AllPlayerAs_Units
if not self.isObsolete(UnitA, AllPlayerBs_Units):
add UnitA button

ruff_hi
May 04, 2008, 09:50 AM
Here is my code ... basically EFools with some variable renaming so it wasn't as confusing for me


def PrintUpgrades(self):

if len(self.FutureUnitsByUnitClass) == 0:
self.buildFutureUnitsByUnitClass()

for u in (self.FutureUnitsByUnitClass):
sDummy = "Unit Upgrade (%s): " % (gc.getUnitInfo(u).getDescription())

upgrades = self.FutureUnitsByUnitClass[u]
for k in upgrades:
sDummy += " %s" % (gc.getUnitInfo(k).getDescription())

print sDummy
return



def buildFutureUnitsByUnitClass(self):
NUM_UNITS = gc.getNumUnitInfos()

# Create graph of single-step upgrades (Swordsman to Maceman)
self.FutureUnitsByUnitClass = {}
self.UnitsAlreadyMapped = set()
for iUnitA in range(NUM_UNITS):
infoA = gc.getUnitInfo(iUnitA)
upgrades = set()
self.FutureUnitsByUnitClass[iUnitA] = upgrades # <-- creates a link between these two items
for iUnitB in range(NUM_UNITS):
infoB = gc.getUnitInfo(iUnitB)
if infoA.getUpgradeUnitClass(infoB.getUnitClassType() ):
upgrades.add(iUnitB) # also adds iUnitB to FutureUnitsByUnitClass array

# Now add all transitive upgrades (Swordsman to Rifleman)
for iUnit in self.FutureUnitsByUnitClass.iterkeys():
self.buildFutureArray_Closure(iUnit) # just starting the recursive call

def buildFutureArray_Closure(self, iUnit):
upgrades = self.FutureUnitsByUnitClass[iUnit]
if iUnit not in self.UnitsAlreadyMapped:
nextUpgrades = set()
for iNextUnit in upgrades:
nextUpgrades |= self.buildFutureArray_Closure(iNextUnit) # note recursive call
upgrades |= nextUpgrades
self.UnitsAlreadyMapped.add(iUnit)
return upgrades


... and here are the results of that print ...



Unit Upgrade (Lion):
Unit Upgrade (Bear):
Unit Upgrade (Panther):
Unit Upgrade (Wolf):
Unit Upgrade (Settler):
Unit Upgrade (Worker):
Unit Upgrade (Fast Worker):
Unit Upgrade (Scout): Explorer
Unit Upgrade (Explorer):
Unit Upgrade (Spy):
Unit Upgrade (Cereal Mills Executive):
Unit Upgrade (Sid's Sushi Executive):
Unit Upgrade (Std Ethanol Executive):
Unit Upgrade (CreateCon Executive):
Unit Upgrade (Mining Inc Executive):
Unit Upgrade (AlumCo Executive):
Unit Upgrade (Civ Jewels Executive):
Unit Upgrade (Jewish Missionary):
Unit Upgrade (Christian Missionary):
Unit Upgrade (Islamic Missionary):
Unit Upgrade (Hindu Missionary):
Unit Upgrade (Buddhist Missionary):
Unit Upgrade (Confucian Missionary):
Unit Upgrade (Taoist Missionary):
Unit Upgrade (Warrior): Vulture Dog Soldier Maceman Samurai Berserker Spearman Impi Holkan Pikeman Landsknecht Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry Axeman Phalanx
Unit Upgrade (Quechua): Machine Gun Axeman Phalanx Vulture Dog Soldier Maceman Samurai Berserker Spearman Impi Holkan Pikeman Landsknecht Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Mechanized Infantry
Unit Upgrade (Swordsman): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Jaguar): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Gallic Warrior): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Praetorian): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Axeman): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Phalanx): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Vulture): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Dog Soldier): Maceman Samurai Berserker Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Maceman): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Samurai): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Berserker): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Spearman): Pikeman Landsknecht Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Impi): Pikeman Landsknecht Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Holkan): Pikeman Landsknecht Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Pikeman): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Landsknecht): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Musketman): Infantry SAM Infantry Mobile SAM Mechanized Infantry Rifleman Redcoat
Unit Upgrade (Musketeer): Infantry SAM Infantry Mobile SAM Mechanized Infantry Rifleman Redcoat
Unit Upgrade (Janissary): Infantry SAM Infantry Mobile SAM Mechanized Infantry Rifleman Redcoat
Unit Upgrade (Oromo Warrior): Infantry SAM Infantry Mobile SAM Mechanized Infantry Rifleman Redcoat
Unit Upgrade (Rifleman): Mechanized Infantry Infantry SAM Infantry Mobile SAM
Unit Upgrade (Redcoat): Mechanized Infantry Infantry SAM Infantry Mobile SAM
Unit Upgrade (Grenadier): Mechanized Infantry Infantry SAM Infantry Mobile SAM Machine Gun
Unit Upgrade (Anti-Tank): Mechanized Infantry
Unit Upgrade (Infantry): Mechanized Infantry SAM Infantry Mobile SAM
Unit Upgrade (SAM Infantry): Mobile SAM
Unit Upgrade (Mobile SAM):
Unit Upgrade (Marine):
Unit Upgrade (Navy SEAL):
Unit Upgrade (Paratrooper):
Unit Upgrade (Mechanized Infantry):
Unit Upgrade (Archer): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry Longbowman Crossbowman Cho-Ko-Nu
Unit Upgrade (Skirmisher): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry Longbowman Crossbowman Cho-Ko-Nu
Unit Upgrade (Bowman): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry Longbowman Crossbowman Cho-Ko-Nu
Unit Upgrade (Longbowman): Infantry SAM Infantry Mobile SAM Mechanized Infantry Rifleman Redcoat
Unit Upgrade (Crossbowman): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Cho-Ko-Nu): Rifleman Redcoat Grenadier Infantry SAM Infantry Mobile SAM Machine Gun Mechanized Infantry
Unit Upgrade (Chariot): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (War Chariot): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Immortal): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Horse Archer): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Numidian Cavalry): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Keshik): Knight Camel Archer Cataphract Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Knight): Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Camel Archer): Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Cataphract): Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Conquistador): Gunship Cavalry Cossack
Unit Upgrade (Cuirassier): Gunship Cavalry Cossack
Unit Upgrade (Cavalry): Gunship
Unit Upgrade (Cossack): Gunship
Unit Upgrade (War Elephant): Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Ballista Elephant): Conquistador Cuirassier Cavalry Cossack Gunship
Unit Upgrade (Tank): Modern Armor
Unit Upgrade (Panzer): Modern Armor
Unit Upgrade (Modern Armor):
Unit Upgrade (Gunship):
Unit Upgrade (Catapult): Mobile Artillery Cannon Artillery
Unit Upgrade (Hwacha): Mobile Artillery Cannon Artillery
Unit Upgrade (Trebuchet): Mobile Artillery Cannon Artillery
Unit Upgrade (Cannon): Mobile Artillery Artillery
Unit Upgrade (Machine Gun): Mechanized Infantry
Unit Upgrade (Artillery): Mobile Artillery
Unit Upgrade (Mobile Artillery):
Unit Upgrade (Work Boat):
Unit Upgrade (Galley): Transport Galleon East Indiaman
Unit Upgrade (Trireme): Frigate Destroyer Missile Cruiser Stealth Destroyer Attack Submarine Caravel Carrack
Unit Upgrade (Caravel): Frigate Destroyer Missile Cruiser Stealth Destroyer Attack Submarine
Unit Upgrade (Carrack): Frigate Destroyer Missile Cruiser Stealth Destroyer Attack Submarine
Unit Upgrade (Galleon): Transport
Unit Upgrade (East Indiaman): Transport
Unit Upgrade (Privateer): Stealth Destroyer Destroyer Missile Cruiser
Unit Upgrade (Frigate): Stealth Destroyer Destroyer Missile Cruiser
Unit Upgrade (Ship of the Line): Stealth Destroyer Destroyer Missile Cruiser
Unit Upgrade (Ironclad): Stealth Destroyer Destroyer Missile Cruiser
Unit Upgrade (Transport):
Unit Upgrade (Destroyer): Stealth Destroyer Missile Cruiser
Unit Upgrade (Battleship): Missile Cruiser
Unit Upgrade (Missile Cruiser):
Unit Upgrade (Stealth Destroyer):
Unit Upgrade (Submarine):
Unit Upgrade (Attack Submarine):
Unit Upgrade (Carrier):
Unit Upgrade (Airship): Fighter Jet Fighter
Unit Upgrade (Fighter): Jet Fighter
Unit Upgrade (Jet Fighter):
Unit Upgrade (Bomber): Stealth Bomber
Unit Upgrade (Stealth Bomber):
Unit Upgrade (Guided Missile):
Unit Upgrade (Tactical Nuke):
Unit Upgrade (ICBM):
Unit Upgrade (Great Prophet):
Unit Upgrade (Great Artist):
Unit Upgrade (Great Scientist):
Unit Upgrade (Great Merchant):
Unit Upgrade (Great Engineer):
Unit Upgrade (Great General):
Unit Upgrade (Great Spy):



Which all looks pretty dang good to me. I think this is good to go.

ruff_hi
May 04, 2008, 10:24 AM
MA status ...

hide threat index if cannot see power - could include comment "n/a"?
hide strategic resource information if no tech and resource trading - see if I can include comment
remove strategic units if player can build an upgrade of a unit - thx to EFool's great code for this
cycle thru cities so that all units possible are included
expose all text to XML for multi-language support
BUG: If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box <-- EmperorFool has stuck his hand up for this one - good luck!
glance screen
worst enemy icon (only when patch has been released)


Currently working on cycling thru all cities to pick up all units that can be built.

EmperorFool
May 04, 2008, 10:42 AM
I'm getting a Python error with the latest version -- trying to modify a dictionary while iterating over its items. I see the problem and will attempt a quick fix. I've attached the save that causes it.

ruff_hi
May 04, 2008, 10:54 AM
the other solution to that python error is not to fall behind in tech! Thx for fixing this EFool

EmperorFool
May 04, 2008, 10:59 AM
Fixed. I also added the cycling through all cities when checking whether or not a unit can be built.

One thing I see that may be incorrect, but I'm not sure yet, is that only the single AND prerequisite tech is checked. It ignores the other techs. This is at the point where it's removing enemy units you shouldn't know about yet due to limited tech.

I'd say look at the code that draws the unit buttons in the city screen. It will draw a disabled button, meaning you can't build it due to resource restrictions, but you do know how to.

ruff_hi
May 04, 2008, 11:45 AM
FixedThanks.

I also added the cycling through all cities when checking whether or not a unit can be built.I knew is was dead easy - just didn't have time to do it. Anyway, thanks.

One thing I see that may be incorrect, but I'm not sure yet, is that only the single AND prerequisite tech is checked. It ignores the other techs. This is at the point where it's removing enemy units you shouldn't know about yet due to limited tech.

I'd say look at the code that draws the unit buttons in the city screen. It will draw a disabled button, meaning you can't build it due to resource restrictions, but you do know how to.Good point. I'm not sure of the code regarding the other pre-reqs. Your suggestion is where I originally looked and that is covered by the canTrain() function. There are some parameters that control if you have the knowledge to train a unit (parameter 3 = true IIRC) and can train but are missing a resource or already have the max allowed (parameter 3 = false IIRC).

Thus I had to try and work out the tech thing manually.

ruff_hi
May 04, 2008, 11:47 AM
MA status ...

hide threat index if cannot see power - could include comment "n/a"?
hide strategic resource information if no tech and resource trading - see if I can include comment
remove strategic units if player can build an upgrade of a unit - thx to EFool's great code for this
cycle thru cities so that all units possible are included
expose all text to XML for multi-language support
BUG: If you open the MA with the Sit-Rep tab displayed, switching to the Units tab doesn't draw the minimap


MA status for future release ...


free up the main sort criteria (currently unit combat type) so that the user can select what it is - need drop down, refresh button and auto-refresh check box <-- EmperorFool has stuck his hand up for this one - good luck!
glance screen
worst enemy icon (only when patch has been released)


It seems that we are just working on tidy up bits. I should have the above all squared away by tomorrow and ready for a formal release.

Does anyone have a nice screenshot showing the sit-rep off?

ruff_hi
May 04, 2008, 12:04 PM
Just posted about the BUG MA in the mod component thread as well as the Civ4 mod items announcement thread - will get specifically mentioned on the front page :D.

ruff_hi
May 05, 2008, 09:19 AM
For the filtering checkboxes -- injured :yuck:, promotable (a star), can move :move:, upgradeable :strength: -- I'll need DDS graphics instead of the font glyphs. Is anyone particularly adept at The Gimp or some other graphics program and can make DDS versions (or find if they exist already) of these characters? If so, could you do the same for :food:, :hammers:, and :commerce:?On second thought - I bet these are already available (ie they show up in the city bar and on the main interface). I'll try and track them down for you.

EmperorFool
May 05, 2008, 10:28 AM
That would be great, thanks. For the Raw Yields changes to the city screen, the :traderoute: icon would also be helpful. :)

The deployment tab is coming along nicely. I completed the support code that will classify all units into any number of groupings. I have the four groupings listed above complete, except that promotions is only picking the first promotion. Shouldn't be too hard to make it do multiple.

The next step is getting that info into the window. One nice thing about the way I've coded it is that the list of units doesn't need to be reprocessed when you change groupings or filters; it will just redraw the list. Hopefully this will make the tab more usable.

EmperorFool
May 05, 2008, 12:18 PM
Group selection is working great, and it's no slower than the original code. It still needs to process all units when you switch the leader selection, but I could do some work to change even that later.

I now have it drawing the list, so you can see the breakdowns and counts. I put counts on both groupings. Thus you'll see 11 units in enemy territory, as well as that 3 are Archer, 2 are Swordsman, etc.

Next is the selection code so you can limit which ones display on the minimap.

@Ruff - Do you have a sketched up layout for the dropdowns and buttons? I'm getting close to being ready to hook up some UI elements. :)

ruff_hi
May 05, 2008, 12:40 PM
Look in 'C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Assets\XML\GameInfo\CIV4EmphasizeInfo.xml' for hammer, coin and food. These are pointers to the dds files that show the city manager buttons.

Still working on foot, unhealthy, arm and trade.

ruff_hi
May 05, 2008, 12:44 PM
@Ruff - Do you have a sketched up layout for the dropdowns and buttons? I'm getting close to being ready to hook up some UI elements. :)You posted something on the last page that looked ok to me ...


[-------- L E A D E R H E A D S ---------]

Group: [Menu1] [Menu2] [--- L I S T ---]
Sort: [Menu] [x Details]
[---- Filter Buttons ----]

[------- M A P --------]


Did we decide where you are putting the GG emergence bar?

EmperorFool
May 05, 2008, 01:03 PM
Did we decide where you are putting the GG emergence bar?

I'll start with the bottom panel, between SIT-REP and EXIT since there's a lot of space there. We'll see how that looks.

As for the DEPLOYMENT tab, we are now at feature parity with the original MA insofar as the unit list has all the original features: drawing, selecting, and showing unit details.

I am now ready to hook up UI elements to allow you to change the groupings, sort and filters. I still need to code sorting and filtering, of course, but the original version doesn't have these either.

But first a lunch break. :) I'll commit the current version so people can play around with it.

Edit: I've committed it with Location and Unit Type as the default groupings. If you want to change these, go to lines 1193-4 in CvBUGMilitaryAdvisor.py and change the group keys:


grouping1 = self.stats.getGrouping("loc")
grouping2 = self.stats.getGrouping("type")

Legal values are "loc", "type", "combat", and "promo". Remember, "promo" only shows the first promotion a unit has.

Cammagno
May 06, 2008, 01:19 PM
@Ruff:

Thanks for exposing to XML the text of MA, I've just translated it. :)
Can I ask you what "Def Packs" arel, so that I can translate that label accordingly? :blush:
Oh, and there is still a bit of text not in XML, that is the alert levels names.
Thaks again :)

EmperorFool
May 06, 2008, 01:26 PM
Can I ask you what "Def Packs" are?

Defensive Pact: if you get attacked, I automatically declare war on your attacker.

ruff_hi
May 06, 2008, 01:50 PM
Oh, and there is still a bit of text not in XML, that is the alert levels names.DUH! Totally missed those. I'll XML (verb: to expose something to XML :D) them later today.

Cammagno
May 06, 2008, 01:55 PM
Defensive Pact: if you get attacked, I automatically declare war on your attacker.

Oh, yes thanks, I know what a Defensive PacT is, it was with a Defensive PacK that I had problems! :DDD
Ok, it may seem strange to you, but for a foreign guy like me it's not so easy to understand that a mistype is there (even when probably to you it's evident) in particular if it creates another valid word :blush:

Anyway, I translated it, and I also changed that "k" into a "t" for other languages. Thanks :)

ruff_hi
May 06, 2008, 02:07 PM
Well, if you read anything (ANYTHING!) that I type, then typo's are a given. For reference: a defensive Pack is a group of guys that last year played for the Giants. Their job is to sack the Quarter Back and win the super bowl. (joke!)

EmperorFool
May 06, 2008, 02:07 PM
I know what a Defensive PacT is, it was with a Defensive PacK that I had problems! :DDD

Defensive Pack: When you have defensive pacts with more than one civ. ;)

Usage: "No way I'm attacking that six pack!"

Edit: Serves me right not reading the next page of replies. Ruff's joke is better! :lol:

Cammagno
May 06, 2008, 02:13 PM
Well, if you read anything (ANYTHING!) that I type, then typo's are a given. For reference: a defensive Pack is a group of guys that last year played for the Giants. Their job is to sack the Quarter Back and win the super bowl. (joke!)

:D
Sorry, but I'm Italian, so I have no frack idea what a quarterback or a superbowl are ;) Well, not entirely true, I know that they have something to do with american football :)