LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
291 stars 160 forks source link

[Feature request] Worth of annexation tooltip #5038

Closed tu-79 closed 2 years ago

tu-79 commented 5 years ago

1. Mod version (i.e Date - 4/23): Any

2. Mod list (if using Vox Populi only, leave blank):

3. Error description: Wish there were a tooltip viewing puppets or cities upon conquest that could inform us of the worthiness of annexing this city, in terms of equivalent science and culture. Something like: Science 22 (5 net) Culture 10 (-4 net)

Although it's easy to understand that each new city increases tech and cultural cost by x%, it's not trivial to calculate whether annexing is going to contribute, and it's even harder to remind how many cities are considered for the efficiency malus.

4. Steps to reproduce (optional):


Supporting information: Please note that you can attach .zip files by dragging-and-dropping them. If possible, zip up all supporting data and post that way.

  1. Log files (always attach your Logs folder, located at My Documents/My Games/Sid Meier's Civilization 5. Make sure you have enabled logging before experiencing an error! Go here to find out how: http://forums.civfanatics.com/showthread.php?t=487482):

  2. Save game (always attach a save that was made a turn before the error; located at My Documents/My Games/Sid Meier's Civilization 5/ModdedSaves):

  3. CvMiniDump.dmp file (attach if experiencing a game crash. Located at Program Files/Steam/steamapps/common/Sid Meier's Civilization V):

  4. Screenshots (optional):

TechpriestEnginseer commented 5 years ago
Something like:
Science 22 (5 net)
Culture 10 (-4 net)

What does this even mean? If the idea is vague, then the code will be vague and unsatisfactory. We cannot deliver on such a vague concept.

chicorbeef commented 5 years ago

I think that's a little too specific but a tooltip to whether costs will be increased or not would be nice. Like how taking 1 puppet actually increases costs.

LoneGazebo commented 5 years ago

I think everyone is aware that more cities = more malus.

tu-79 commented 5 years ago

I think everyone is aware that more cities = more malus.

Nope. I don't know when it is worth to annex my puppets. Another city increases the malus, but it also increases science and culture produced. I just want an easy way to check if by annexing this city I'm going to research faster or slower.

More specifically, I was thinking in this formula: NetCityScience = WhateverScienceThisCityCouldYield - ScienceLostByInefficiencyAfterAnnexation = (GlobalScience + CityScience) (1 - (1 + 0.07 NumAnnexedCities) / (1 + 0.07 * (NumAnnexedCities +1)))

And the same for culture.

tu-79 commented 5 years ago

Well, I can't edit my previous post, so I'll continue here. Right now there are two major uncertainties when deciding on annexation. First one is how unhappiness is going to change. You can say that the puppet penalty will go and it'll be replaced by common unhappiness, and you can take a look at any other of your cities that 'looks like' that one, to guess how much unhappiness it will produce after annexation, but you don't really know. Excess happiness, however, is not that important, so as long as I have spare happiness, I don't consider it a decisive factor.

The second uncertainty is whether the increased policy and tech cost can be offset by the science and culture provided by the city we are going to annex. While an exact answer cannot be given when there are things like empty specialist slots, we could say that the city manager does a fair job and work with the city's current yields.

The costs of research increases this way in standard, if I am not mistaken: Cost = BaseCost (1 + 0.07 NumCities), where NumCities is a bit exotic when we mix puppets and razed. Before annexation, our civ produces CivScience, the sum of all science in our cities (this does not account for instant yields). And we can know, approximately, how long it takes for the next tech: TurnsToCompleteTech = TechBaseCost (1 + 0.07 NumCities) / CivScience What I really need to know is if by annexing the city I will research faster or slower. I'll use the suffix 0 for current situation and suffix 1 for expected situation after annexation. So, TurnsToCompleteTech1 should be less than TurnsToCompleteTech0. Or: TurnsToCompleteTech0 - TurnsToCompleteTech1 > 0

TurnsToCompleteTech1 = TechBaseCost (1 + 0.07 (NumCities + 1)) / (CivScience + CityScience) where CityScience is the science yields of the city I consider for annexation.

Then, TechBaseCost (1 + 0.07 NumCities) / CivScience > TechBaseCost (1 + 0.07 (NumCities + 1)) / (CivScience + CityScience) ==> ==> (1 + 0.07 NumCities) / CivScience > (1 + 0.07 (NumCities + 1)) / (CivScience + CityScience) ==> CivScience (1 + 0.07 (NumCities + 1)) < (CivScience + CityScience) (1 + 0.07 NumCities) ==> 0.07 CivScience < CityScience (1 + 0.07 NumCities) ==> CityScience > 0.07 CivScience / (1 + 0.07 NumCities) which means that CityScience should be bigger than 0.07 CivScience / (1 + 0.07 NumCities) for this city to positively contribute towards research. Let's say we already have 10 cities, and that current CivScience is 200. This means the city we are going to annex has to produce at least 8.2 SPT, or it will drag our research. I have the impression you all think this is trivial. It is not.

While knowing when the threshold has been achieved is nice, it would be better to know how close we are to the point where it is worth to annex, science-wise. That's why I'd prefer to show the equivalent net science gain upon annexation. I'll leave the demo for the next post.

tu-79 commented 5 years ago

So, how can we know the net science gain upon annexation? Raw science yields are going to increase, as long as the city has more than 0 production, but since the cost of research is going to increase, this is as if the efficiency of the whole civ was affected. EqScience = Science / (1 + 0.07 NumCities) So, annexing one city, adds the equivalent science: EqCityScience = CityScience / (1 + 0.07 (NumCities + 1)) But, it also means reducing the equivalent Civ science efficiency, so: EqCivScienceLost = CivScience / (1 + 0.07 (NumCities + 1)) - CivScience / (1 + 0.07 NumCities) Then, NetEqScienceGain = CityScience / (1 + 0.07 (NumCities + 1)) - (CivScience / (1 + 0.07 (NumCities + 1)) - CivScience / (1 + 0.07 NumCities)) = = (CityScience - CivScience (1 - (1 + 0.07 (NumCities + 1)) / (1 + 0.07 NumCities))) / (1 + 0.07 * (NumCities + 1))

For the same case of the previous post, 10 cities, 200 global science, it turns out that having raw 8.2 science in the city nets 0 equivalent science. Annexing a city with 5 raw science per turn, would net -1.8 SPT, while annexing a city with 20 raw science would net 6.7 SPT. It would be lovely if this calculation, and its culture equivalent, were made by the UI in the city screen, so I can say how good it would be to annex said city.

tu-79 commented 5 years ago

Regarding happiness, a similar thing could be done with production and gold in the case that annexation results in happiness changing values in the range of -10 and 10, so we know if annexation will cause our empire to produce more or less gold, but since happiness is so voluble, this might not be an useful addition.

chicorbeef commented 5 years ago

I think everyone is aware that more cities = more malus.

Is it possible to show the existing malus when you puppet or annex a city? Because I remember puppeting a city once and getting the malus, something like this should make it clear how it works (puppet a city, puppet a city, then they'll be able to see how much the malus has grown...it will become clear that puppeting the first city does in fact give a malus.).

Also, tu79, a tooltip like that would be far from extensive, because there are just so many factors that can change the city's value that a conclusive tooltip wouldn't be of much worth. What policies you have and will get, UIs you can build, what Religion you spread there, what the city will build etc. I think it just can't be captured in a single tooltip effectively.

tu-79 commented 5 years ago

Also, tu79, a tooltip like that would be far from extensive, because there are just so many factors that can change the city's value that a conclusive tooltip wouldn't be of much worth. What policies you have and will get, UIs you can build, what Religion you spread there, what the city will build etc. I think it just can't be captured in a single tooltip effectively.

True. But right now we are in complete darkness. I expect this tooltip to be less useful in recently conquered cities than in puppets. In a recently conquered city, rebuilding might happen quite fast, or not, but at least we will have a starting point for making decisions. In long time puppeted cities, however, infrastucture is up to date, including your uniques, so the tooltip should be accurate.

tu-79 commented 5 years ago

Damn! I just realized that I didn't take the yields from being a puppet into account. Well, that's NetEqScienceGain = = (PuppetPenalty CityScience - (CivScience + (1 - PuppetPenalty) CityScience) (1 - (1 + 0.07 (NumCities + 1)) / (1 + 0.07 NumCities))) / (1 + 0.07 (NumCities + 1))

LoneGazebo commented 5 years ago

I'll be honest, I have no earthly idea how I'd cleanly integrate predictive valuation into a tooltip in a digestible way.

tu-79 commented 5 years ago

Too bad. Thanks for trying, though. Enginseer's commentary forced me to work a lot on this, and I think I have something I can use now, even if it's not integrated on the UI.

Anyways, I'll leave here the final algorithm for my own personal use. It didn't make sense to substract the part from the puppet that is already contributing to science. NetEqScienceGain = = (PuppetPenalty CityScience - CivScience (1 - (1 + 0.07 (NumCities + 1)) / (1 + 0.07 NumCities))) / (1 + 0.07 * (NumCities + 1))

LoneGazebo commented 5 years ago

You can leave it open, and I'll think on it. I just don't have any good ideas at the moment.

TechpriestEnginseer commented 5 years ago

I think we could expand the UI background and write down the formula down because I was initially thinking we let the (Annex City) and (Puppet City) option provide the formula, but then that would probably block some of the "civs are angry at you" messages.