Page 1 of 2

Experimenting with Tech Upkeep

Posted: Tue Jul 18, 2017 1:23 pm
by Corbeau
Settings:

[research]
; Method of paying tech upkeep
; "None" - no upkeep
; "Basic" - upkeep is calculated as:
; <Cost of technology> / tech_upkeep_divider - tech_upkeep_free
; "Cities" - upkeep is calculated like "Basic", but multiplied by number of cities
tech_upkeep_style = "Cities"
(Note: I think <Cost of technology> is the cost of ALL techs currently in posession)

; upkeep cost is divided by this value
tech_upkeep_divider = 2000

; basic free tech upkeep
[effect_upkeep_tech_free]
type = "Tech_Upkeep_Free"
value = 3
(I'm not sure what this means)





Result:

Currently researching: Railroad
No. of cities: 12
No. of Libraries: 11
No. of Universities: 0
Cost of current tech: 1402
Bulbs produced per turn: 468
Needed for upkeep: 87
Bulbs used per turn: 381

Re: Experimenting with Tech Upkeep

Posted: Tue Jul 18, 2017 1:36 pm
by cazfi
Corbeau wrote:; basic free tech upkeep
[effect_upkeep_tech_free]
type = "Tech_Upkeep_Free"
value = 3
(I'm not sure what this means)
From doc/README.effects:

Code: Select all

Tech_Upkeep_Free
    If this value is greater than 0, the tech upkeep is reduced by this value.
    For tech upkeep style "Basic" this is total reduction, for tech upkeep
    style "Cities" this reduction is applied to every city.

Re: Experimenting with Tech Upkeep

Posted: Tue Jul 18, 2017 1:52 pm
by Corbeau
So that's actually the number of bulbs? If the value was "0", in the above example (12 cities), upkeep would be 36 more?

I thought that it was something like that, but missed the "applied to every city" part and when I saw the numbr "3", it was absurd.

Anyway, thanks.

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 8:40 am
by Corbeau
After some experimentation, it is safe to say that either something is wrong with the formula or I am not getting something right.

I have set

type = "Tech_Upkeep_Free"
value = 0


in order to get less interference.

So, the formula without this should be:

(<Cost of technology> / tech_upkeep_divider) * No.of cities

Values I have:

Cost of technology: 2200 (I was literally adding up costs as I went along)
Divider: 2000
Cities: 13


Upkeep for these values should be 15, but it is 30. Furthermore, as I was keeping track the whole time, upkeep was persistently x1.5 to x2 of what it should have been, based on this formula. Literally, when I discovered techs that cost, for example, 80 and 111 (with 13 cities), upkeep jumped by 2.

So, does anyone know what EXACTLY "<Cost of technology>" is, because I don't think it means what I think it means.

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 9:34 am
by JTN
It would be useful to know details of your experimental setup:
  • What branch/version of code?
  • What ruleset were you starting with?
  • Do you have team_pooled_research enabled?
  • If so, were you on a team? With any AIs? Of what skill level?
One thing I notice in comparing player_tech_upkeep() to base_total_bulbs_required() is that tech leakage isn't taken into account for tech upkeep (nor can it be, I think) -- the game doesn't remember what you actually paid for research, it looks at what techs you now have and recreates a calculation. Could that be significant in your case?

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 10:17 am
by Corbeau
JTN wrote:It would be useful to know details of your experimental setup:
  • What branch/version of code?
2.5.7
[*]What ruleset were you starting with?
Standard multiplayer. only changes: movement rates and taht one Tech_Upkeep_Free number.
[*]Do you have team_pooled_research enabled?
[*]If so, were you on a team? With any AIs? Of what skill level?[/list]
Pooled research was on, but this is most classic single player, almost no contact with other civs, didn't do any diplomacy.
One thing I notice in comparing player_tech_upkeep() to base_total_bulbs_required() is that tech leakage isn't taken into account for tech upkeep (nor can it be, I think) -- the game doesn't remember what you actually paid for research, it looks at what techs you now have and recreates a calculation. Could that be significant in your case?
I also tried to check if tech leakage is on, but didn't find the option. However, I don't think so because as I was checking tech costs, they were persistent within classes, depending on the number of requirements.

If it helps, tech cost was resolved like this:

; 1 - Cost of technology is:
; MAX((1+parents) * (researchcost/2) * sqrt(1+parents), researchcost)
; where num_parents == number of requirement for tech, counted
; recursively.

So, do you know how exactly the tech-upkeep function calculates the cos? If it uses a method independent of the ruleset, this could be it, ony need to find which method it is.

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 8:29 pm
by JTN
Well, I know in the sense that I have access to the source code and know where to look, but I only quickly skimmed it this morning; I've not been through it line-by-line. It wouldn't surprise me to find a bug, though.

Links to the relevant bits for S2_5 in case someone beats me to it: base_total_bulbs_required(), player_tech_upkeep().

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 9:56 pm
by Corbeau
Ok, had a look, can't decode it, someone with more expertise required :)

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 10:13 pm
by cazfi
Do you have "Tech_Cost_Factor" effects? In the functions jtn linked there seems to be some inconsistency in its handling. player_tech_upkeep() assumes that factor is 1 by default (without any additional effects), base_total_bulbs_required() handles it without adding 1 to the given effects.

Re: Experimenting with Tech Upkeep

Posted: Wed Jul 19, 2017 10:43 pm
by Corbeau
If you are asking me, I'm afraid I don't understand the question.