Requests for new components (and features)

:( It appears I need to tone down my enthusiasm a little bit. ;)

Please, don't do that! :D

I am surprised that you consider the units' xml attributes as classified information . . . BUG uses them to tell you the power ratios up to 4 decimals.

Technically, BUG doesn't use them. What BUG does use is the power demographics values--available in the stock game's interface in the power graph--to provide the ratio. Yes, the game shows only a graph line, but you could use a rule to measure the graphs and do the division yourself.

BUG shies away from is showing XML values if they aren't displayed elsewhere.
 
Do we give this hover information when you hover over enemy units in a city?

Give what information? If you mean show the city's chance of revolt, I say no. It's not available to you in-game (see below).

Is it available when you investigate a city using a spy?

I don't know, but even if it is you wouldn't be able to selectively remove units from the city to find the weak point, so it makes no sense to show it to the user. They should have to move a spy there and investigate the city to get it, and then only the chance of revolt--nothing about how many units are needed to keep it 100%.

Or perhaps I have completely misunderstood your first question.
 
Ok - thanks for the philosophical briefing - it's kind of hard for me to switch since I spent the last weeks digging through the deepest abysses of code/xml-attributes/mechanics and stuff ;).

The problem with displaying the exact chance of revolt from the city screen is that, as Dresden already mentioned, CvCity::getRevoltTestProbability() is not exposed to Python but required to calculate this number. Its current value of 10% could theoretically be decreased by a unit with a modded promotion which gives extra protection from revolts. We could further lower the amount of info revealed to a qualitative-only "revolt danger!" or use a hard coded 10%.

Are you actually still playing civ or do you spend all your time with graphs and screens ... ? ;)
There is no "Investigate City" active mission for spies anymore -- checking out AI's city screens (plus their hover text for revolts) is the most expensive passive mission and doesn't require any spies in the cities.

It is worth noting that friendly foreign units also contribute to the city's culture garrison so I'm not sure how to go about limiting the info to units / cities owned by the active player yet.
 
Ok so here is the new (not thoroughly tested) version:
Spoiler :
Code:
[SIZE="3"]		# culture garrison info	
		szGarrison = u""
		pPlot = pUnit.plot()
		pCity = pPlot.getPlotCity()
		if (pCity and not pCity.isNone()):
			eCulturalOwner = pPlot.calculateCulturalOwner()
			if (pCity.getOwner() != eCulturalOwner):
				iCityStrength = pCity.cultureStrength(eCulturalOwner)
				bAtWar = gc.getTeam(pUnit.getTeam()).isAtWar(gc.getPlayer(eCulturalOwner).getTeam())
				iGarrison = 1
				iBestRevoltProtection = 0
				for i in range(len(self.lPLEUnitList)):
					pLoopUnit = self.getInterfacePlotUnit(i)
					if ((pLoopUnit.getID() != pUnit.getID()) and (not pLoopUnit.IsSelected())):
						iGarrison += gc.getUnitInfo(pLoopUnit.getUnitType()).getCultureGarrisonValue()	
						if (pLoopUnit.getRevoltProtection() > iBestRevoltProtection):
							iBestRevoltProtection = pLoopUnit.getRevoltProtection()
				if (bAtWar):
					iGarrison *= 2
				if ((iCityStrength > iGarrison) and (iBestRevoltProtection < 100)):
					iRevoltTestProb = gc.getDefineINT("REVOLT_TEST_PROB")*(100-iBestRevoltProtection)/100
					szGarrison = u"%.2f" % ((1.0-float(iGarrison)/float(iCityStrength))*iRevoltTestProb)
					szGarrison = localText.getText("TXT_KEY_MISC_CHANCE_OF_REVOLT", (szGarrison, ))
					szGarrison = u"<font=2>" + u"\n" + localText.changeTextColor(szGarrison, gc.getInfoTypeForString("COLOR_RED")) + u"\n" + u"</font>"

				# build text
		szText 	= szUnitName + \
				szPromotion + \
				szStrengthMovement + \
				szLevel + \
				szExperience + \
				szCargo + \
				szCiv + \
				szFortifyBonus + \
				szEspionage + \
				szSpecialText + \
				szGarrison
[/SIZE]
The hover text gives the chance of revolt for the situation that all selected units plus the unit under the mouse pointer are moved outside the city. It is identical with the value from inside the city screen, only displayed if it is > 0 and works with modded extra RevoltProtection (NOW).
But it took me 1 hour to find out that CyUnit::getRevoltProtection() returns m_pUnit->getExtraHillsDefensePercent() :wallbash: !!!
Dresden, could you fix this bug too in your next version of the unofficial patch?

No color option yet, bed time now!
 

Attachments

  • CvMainInterface.rar
    42.4 KB · Views: 67
Haven't looked at it real closely yet, but I have a couple comments on the discussion.

1) The revolt percentage is available to you in the normal game only if you can investigate the city. That means we need to limit anything shown on a unit hover to one of the following situations
  • It is your city
  • It is your teammate's city
  • You can run the passive espionage "investigate city" mission against that city
  • You are in debug mode
While I haven't looked into it, there is a CyPlot.isInvestigate() function that might simplify that determination.

As far as I'm concerned any unit currently stationed in a city that has a non-zero revolt percentage could show that info if the city meets one of the above criteria. It's somewhat odd that we are showing information not directly tied to the unit but without going the DLL route I don't see a way to easily relay this info to the user otherwise. Since this would also be useful for the CDA, perhaps we can make a City utility function that returns the revolt percentage if the city is investigable to the given team.

2) Also, only the actual current revolt percentage should be shown on a unit hover. Anything beyond that such as how the percentage would change if that unit (or that group of units) was removed is too spoilerish for BUG. Since you would actually have to move the units to get that information without BUG, you should have to actually move the units with BUG too.

3) I have no problem with "faking" getRevoltTestProbability if the end result is that the value we show is the exact same value as the user could get by opening up the city screen and checking themselves.

4) Dan, please stop finding stuff for me to fix in the Unofficial Patch. :lol:
 
The main issue here is how do we determine which message is important?

Well there are some pretty basic ones, like someone becoming a vassal or a declaration of war. Yes I know we get a sound effect when that happens, but with so many things scrolling on the log you sometimes have to dig around to find out who. Same thing with religions being founded.
 
Give what information? If you mean show the city's chance of revolt, I say no. It's not available to you in-game (see below).

It is for your own cities. You just need to go into your city screen and hover over your nationality bar. I'm just suggesting an easier way to do that so the information is a bit more readily accessable, rather than having to go into the city screen everytime you try and move a unit.
 
Do we give this hover information when you hover over enemy units in a city?

Me: If you mean show the city's chance of revolt, I say no. It's not available to you in-game (see below).

It is for your own cities.

If there are enemy units in your own cities, they aren't your cities any more. ;) I was replying only to the case of enemy cities, and there you'd need to be able to investigate the city somehow.
 
2) Also, only the actual current revolt percentage should be shown on a unit hover. Anything beyond that such as how the percentage would change if that unit (or that group of units) was removed is too spoilerish for BUG. Since you would actually have to move the units to get that information without BUG, you should have to actually move the units with BUG too.

The whip overflow calculation is exactly the same in my eyes. You can calculate the value yourself if you look in the XML or play the game enough to see the pattern. Otherwise you have to whip to see the overflow, but you can, and it's predictable. Yet we show the overflow without making you whip, and now thanks to you :p we show the overflow :gold:! :lol:
 
Well, err, I guess you got me there. :D In a lame attempt at defense, I should note that whip overflow mechanics are much more widely known in the community than city revolt mechanics. But I guess it is a double standard.

Speaking of overflow, I am breaking it with the next Unofficial Patch and now I have to fix BUG to do the proper calculations in either case. Any objection to a CityUtils that would handle overflow calculations and (if necessary) revolt percentages?
 
I should note that whip overflow mechanics are much more widely known in the community than city revolt mechanics.

Agreed, and I wouldn't say this case is black and white either. I guess why I would lean toward including it is that the player can get the information easily enough by moving their units one-by-one outside the city and then moving the last one back that's needed to keep it at the percentage they want. That's just annoying.

Sure, the units they move lose their fortification bonus, but if they're concerned about an imminent attack, they probably aren't attempting to minimax their revolt percentage in that city. As with most UG questions, I'll go with the group. ;)

Speaking of overflow, I am breaking it with the next Unofficial Patch and now I have to fix BUG to do the proper calculations in either case. Any objection to a CityUtils that would handle overflow calculations and (if necessary) revolt percentages?

Be my guest. We're building up a healthy amount of utility code now; I love it! BTW, what part of whipping will the new patch break?
 
If there are enemy units in your own cities, they aren't your cities any more. ;) I was replying only to the case of enemy cities, and there you'd need to be able to investigate the city somehow.

We're referring to two totally different things here. I'm talking about the revolt that can occur if you capture a city and their culture is still much higher than yours. Until you manage to get your own culture up to 50%, there's a chance that the city will go into revolt every so often. But if you put enough troops in there the probability goes down, or disappears altogether. The odds of this occuring are already shown in the city's nationality bar if you hover over it. And as your culture goes up, you need less troops in order to prevent a revolt. But that means moving a unit one tile off, opening up your city screen, then hovering over the nationality bar to see if moving that unit has caused the probability of a revolt occuring. If it hasn't, you rinse and repeat with the next unit. The whole process is a pain in the butt frankly so I'm simply suggesting adding another more convenient location to get the info that is aleardy available to you, though in a very impractical location.
 
Agreed, and I wouldn't say this case is black and white either. I guess why I would lean toward including it is that the player can get the information easily enough by moving their units one-by-one outside the city and then moving the last one back that's needed to keep it at the percentage they want. That's just annoying.

Sure, the units they move lose their fortification bonus, but if they're concerned about an imminent attack, they probably aren't attempting to minimax their revolt percentage in that city. As with most UG questions, I'll go with the group. ;)
Given the hypocrisy of my previous position I'm willing to soften my stance and give the "base revolt % plus what moving this unit will do" thing a shot.

continued... said:
Be my guest. We're building up a healthy amount of utility code now; I love it! BTW, what part of whipping will the new patch break?
The new patch will change the overflow gold calculation by ignoring any non-generic production modifiers. The idea is to lower the exploitability factor so that (in most cases) you can't generate more gold via overflow than you would get by simply building wealth. And while looking into how to make BUG calculate the proper overflow for both cases, I found that the old overflow calculation has a bug (my fault :blush:) in its determination of max overflow which should be fixed.
 
We're referring to two totally different things here.

We're actually talking about the same thing, and I like your suggestion (show percentage chance of revolt in unit hover after recalculating the chance assuming all selected units move out of the city.

I think what Ruff had asked about was showing the same thing when hovering over enemy units in enemy cities to see chance enemy city would revolt. I said this was only okay if you can investigate the city, but even then it seemed kinda spoilerish since you cannot find that information yourself. In other words, you can't move enemy units out of their cities to see the changes in percent.
 
I think what Ruff had asked about was showing the same thing when hovering over <snip> enemy cities
Actually - it was a test. Of course it is spoiler information :D.
Spoiler :
unless you can actually get that info in-game via a spy or such
 
Been playing around a bit more -- how do you like these things?



A) The score ratio in the graphs' legends (I like to see the hard numbers more than using my mind-ruler).
B) Number of a player's cities in scoreboard (quick indicator about REX success / runaway civs / boxed in status).
C) Hammers left till next whip threshold (actually I'm not that much interested in the exact number of overflow hammers - those shall only be optimal, therefore I don't want to go over the next hurrypop threshold). I just used the INTERFACE_CITY_PRODUCTION_WHIP string again here and put the current production modifier (125 for forge) in the brackets. So in order to avoid missing the optimal whip opportunity I shall whip right now or reduce the hammers for the current turn to 4 (2 pop * 1.25 = 75 whip hammers, 80 left at the moment).

~~~~~~~~~~~~

@Dresden concerning the chance of revolt info:
CyPlot.isInvestigate() appears to check whether there is a unit with bInvestigate=1 in the plot (there aren't any such units in the unmodded game, spies in earlier versions?). The method we would need instead is CvCity::canBeSelected - but that isn't exposed to Python either. So can you fake it in your CityUtil.py? Would it be possible to calculate the city's chance of revolt there too, possibly using a passed list of unit IDs (the ones to move out of the city) to exclude from the garrison and revolt protection calculation? I'm not familiar with this xxxUtil.py stuff :(.
 
B) Number of a player's cities in scoreboard (quick indicator about REX success / runaway civs / boxed in status).

Ooh, I like that one. I'm constantly going into the diplo screen to count how many cities everyone has to see how I'm doing. It would be great if that info was available on the main screen instead.
 
What I need in the BUG mod is the reminders to be reworked so they may be linked to the real events in the game.
For example now I am using lots of privateers but the AI still don't have the chemistry. I shoudl like to get a special message when some of the civ got it (for example when it is removed in from "wanted" list).
Now the alerts show if a civ is ready to trade some tech but no alert shows when a civ gets a tech but don't want to trade it.
 
I don't see a good way to tie this to Reminders, but Civ4lerts could certainly be extended with new alerts for

Montezuma has acquired Chemistry but won't trade it

and

Montezuma has acquired Chemistry but can't trade it

and changing the "will trade" alert to differentiate between being acquired and simply changing their mind.

Montezuma has acquired Chemistry and will trade it
 
What about adding a small column for "is researching" on the EFA Tech tab that shows the icon and number of turns if you have enough espionage points and is either blank or uses the ? placeholder if you don't have enough EP. I think it'd be handy since the EFA blocks the scoreboard where we display the same thing and my short-term memory is awful. :p

Maybe we could use the :science: icon as a heading and put it just after the leader icon? Perhaps to save space the number of turns could even be below the tech icon, but I don't know if IconGrid will do that.
 
Top Bottom