Military Advisor

I like the new version! :goodjob: The resources tab is much less cluttered.
And thanks for answering my questions.

One more question though: Why do you list only "possible embargos" in the sit-rep? Wouldn't it be more important to list "actual" embargos here?
Probably, I missed it, but how do you determine whether there is a "possible embargo"?
 
Why do you list only "possible embargos" in the sit-rep? Wouldn't it be more important to list "actual" embargos here?

The game has no concept of an actual embargo in its data structures. You and the AIs can only ask one civ to stop trading (cancel all trade deals, including Open Borders) with another. Once you say yes, it's not like a DoW where you are now "at war" with another civ. This state looks no different than any other civ you aren't trading with.

The one thing we might be able to key off of is that civs you do this to will refuse to talk to you for a while, just like those you DoW on. But this only tells you who you have stopped trading with. Note that AIs will only ask you to stop trading with their Worst Enemy. It's not really a trade embargo, but it's called that in the Civ4 code.

How do you determine whether there is a "possible embargo"?

Open the diplomacy window with an AI and look at the civs under the "Stop Trading With" heading.

I'm thinking this column belongs more on the Strategic Advantages tab, but there's no room for it given that I want to add more columns to that tab already.
 
Sorry, I think I confused things here. I thought you meant the blockade of a coastal city with ships. Thanks for clarifying that.
 
The Military Advisor is having a problem figuring out the strategic advantages of my naval units. Here is a screenshot (thumbnail links to full-size) showing that I can in fact build triremes, galleys, and caravels (there's one of each building respectively in the 3 coastal cities)


But the MA shows those as advantages for everyone else:


And according to the log, it's because the MA doesn't think I can build them:
Code:
14 SCREEN TURNED ON

23:39:33 DEBUG: Lonely Cyrus =========
23:39:33 DEBUG:   Warrior
23:39:33 DEBUG:   Swordsman
23:39:33 DEBUG:   Axeman
23:39:33 DEBUG:   Maceman
23:39:33 DEBUG:   Spearman
23:39:33 DEBUG:   Pikeman
23:39:33 DEBUG:   Musketman -> doesn't know Gunpowder
23:39:33 DEBUG:   Archer
23:39:33 DEBUG:   Longbowman
23:39:33 DEBUG:   Crossbowman
23:39:33 DEBUG:   Immortal
23:39:33 DEBUG:   Horse Archer
23:39:33 DEBUG:   Knight
23:39:33 DEBUG:   War Elephant -> no city can train unit
23:39:33 DEBUG:   Catapult
23:39:33 DEBUG:   Trebuchet
23:39:33 DEBUG:   Galley -> no city can train unit
23:39:33 DEBUG:   Trireme -> no city can train unit
23:39:33 DEBUG:   Caravel -> no city can train unit
23:39:33 DEBUG:   Galleon -> doesn't know Astronomy
23:39:33 DEBUG: ----------------------- fillStratAdvGrid start

The save's 3.17 and I can post the rest of the log if necessary
 

Attachments

  • MA bug.CivBeyondSwordSave
    240 KB · Views: 153
There's very little involved in checking if a city can build a water unit. Can you please take a look at PlayerUtil.isSaltWaterPort(). It's pretty straight-forward, but I'm still using 3.13 and can't test it myself. :(

Clearly the function works for other players, but not you.
 
OK, when it was checking me, the eAskingTeam variable was always -1 because the askingTeamOrID parameter passed to the function is not an ID. Instead it's the value "True":
Code:
00:28:38 DEBUG: Calling isSaltWaterPort(city=Persepolis, askingTeamOrID=True
While when checking on other players, the passed value is the correct "0":
Code:
00:28:39 DEBUG: Calling isSaltWaterPort(city=Moscow, askingTeamOrID=0

Is that enough for you to track it down or should I keep searching to see how askingTeamOrID is getting set to True?
 
Further isolation: it all comes down to this call in UnitUtil.py (line 324):
Code:
		# cities
		if cities and not canAnyCityBuildUnit(eUnit, cities, True):
That's passing the True in the wrong spot:
Code:
def canAnyCityBuildUnit(eUnit, cities=None, askingTeamOrID=-1, checkBonuses=True):

So I think adding a -1 as a third parameter will fix it. It seems to when I tried it, but I'm not really familiar with the UnitUtil functions and don't want to commit it without running it by somebody first. ;)
 
That looks right; I'll take a look at it now. It should pass in 0, though since it's checking your cities, all the tiles around your cities will be revealed to you, and thus -1 will have the same effect.
 
Well, it doesn't break it for me, so if it fixes it for you, great. Strange that it works for me and not for you. Team #1 (True) must not have seen the map around your cities yet.

This did make me aware of another problem: it's not treating access to water as a resource. If you can build boats but cannot see a coastal city for a rival, it should show in your Possible column, not Known, because they might have an unseen coastal city. I probably don't address that before the release, however, as it would change the APIs for some of the functions.
 
There's a real good chance team 1 hasn't seen me in that game. It was a Lonely Hearts Club game (isolated start) and because nobody much likes me I haven't done much map trading (if any) and Optics is still fairly new so I haven't had any visitors.
 
Just some minor cosmetic issues:



Is it possible to make the columns for "Wars" a bit wider? Maybe the same size the as the similar columns at the strategic advantages tab?

Would be great if the label for defensive pacts could be fitted into two lines instead of one, like the worst enemy label. Then we could get rid of the abbreviation in all languages. :D

The space at the left and right: Is this necessary or could the lines be extended to make use of the whole blue box? Same for the strategic advantages tab.
 
We don't actually specify the size of any columns. We tell it to use its preferred spacing. I would guess that we can specify out own but need to check.

We can definitely split the other labels.
 
Random thought: Should the "Possible Wars" and "Trade Embargo" columns be changed to show the AIs that are willing to agree to the column's item against the row's AI?

For example, currently the row for Mansa Musa shows Alexander in the "Possible Wars" column if MM will DoW on Alexander. This change would instead show all the AIs willing to DoW against MM.

I more often want to know all the AIs that will DoW/Embargo against a single AI rather than all the AIs a single AI will DoW/Embargo. The reason is that I have a target AI in mind and want to see which AIs I can bribe into my plans.

Even though this makes perfect sense to me, I can see that it could be confusing. Thoughts?
 
I found this today while looking for something else. This is something to consider for the BUG MA. Maybe we have this as another option unit the list of units ... group by plot (and show city name when the plot is a city, else show the x and y) and sorted by the number of units (large to small) - helpful when looking for that lost army.
 
The approach I take is very naive, unfortunately. Here's what I do:

  • If you are connected to their trade network, I check if they have access to at least 1 of the resource. This ignores the source of that resource (not that I can find that out anyway), whether it be from their own territory or a trade with another civ.
  • If you are not connected, I assume they have no resources. Every unit that requires at least one resource gets put into the "Needs Resource" column.
The problems with being trickier include

  • If you see a Swordsman, maybe it was a gift from another civ.
  • If you see an Iron mine with a road, maybe it's not hooked up to their trade network.
  • If you saw an Iron mine that is now in the fog of war, maybe it's been pillaged since you last saw it.
Ideally the player would be able to select the resources that they believe each rival has and have the screen use that information to determine which units are available.

I have a question after years of playing, which concerns the bold comment above regarding checking to see if a resource is available. The unaltered gameplay mantra that BUG follows usually dictates that no information is exposed that can't be determined from the vanilla game. Is it possible in vanilla to check whether a civ has access to a single resource? When I open diplomacy, I only see the resources that the AIs have two or more of.

I have an example where the strategic advantage tab of the military advisor shows 4 civs in the game with horse (I don't have horse atm). Two of the civs I can account for: one has two horse available for trade, so it shows in the regular diplomacy screen. The other I confirmed on the map itself via exploring. The other two civs I've just found on the map. No mention of horse in diplomacy. If I were playing vanilla, how would I know they have horse?

I'm probably missing something here, since I'm a bit rusty coming back to Civ4 after a considerable break.
 
The Strategic Adviser is broken for me but I'm playing with my own mod merged with this. Does this adviser support new units or should I just disable it.

The problem is with the Strategic Deployment tab. It works early in the game but after a while nothing is displayed and I can't even get back to the other two tabs.
 
Top Bottom