bugFreeciv - Bugs: bug #22058, tech_upkeep doesn't handle team...

Show feedback again

bug #22058: tech_upkeep doesn't handle team pooled research

Submitted by:  pepeto <pepeto>
Submitted on:  Tue May 20 18:11:56 2014  
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: pepeto <pepeto>Open/Closed: Closed
Release: Operating System: Any
Planned Release: 2.6.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Mon Oct 6 22:58:51 2014, comment #4:

(A different fix for the same issue was subsequently backported to S2_5 and S2_4 under patch #5099.)

Jacob Nevins <jtn>
Project Administrator
Fri Jul 25 07:34:36 2014, SVN revision 25720:

Improve tech_upkeep in case team pooled research is enabled. tech_upkeep is
now a per-player property and calculated only on server side.

With the help of Jacob Nevins

See gna bug #22058

(Browse SVN revision 25720)

pepeto <pepeto>
Project MemberIn charge of this item.
Wed Jul 23 14:59:46 2014, comment #2:

First version of the fix attached:

  • tech upkeep is no more a part of the research structure, every player should have its own ;
  • at server side, tech upkeep is calculated every time we need it ;
  • at client side, tech upkeep is just read from what server sends ;
  • improvement of the calculation:
    • Tech_Cost_Factor is checked for the whole team, and divided my the members number ;
    • AI cost reduction taken in account ;
    • future techs are not counted twice when tech_cost_style==0 ;
    • the tech upkeep style modifiers are taken account after dividing by the number of team members.

Applying this patch requires network capability update.

(file #21521)

pepeto <pepeto>
Project MemberIn charge of this item.
Wed Jun 18 23:05:46 2014, comment #1:

Looked at this in the context of bug #22158.

So player_research_update() is called for every player and calculates tech_upkeep, which is stored in the possibly-shared research structure but was calculated using player-specific information -- effects (Tech_Cost_Factor / Tech_Upkeep_Free) and, since bug #19589, number of cities.

tech_upkeep isn't actually paid until end_phase(). It's paid once per player, each time deducting from the shared research, using the stored tech_upkeep kept in the shared research structure.

I think the net effect is that some random team member's tech upkeep gets subtracted multiple times from the shared research, if they're not all the same (due to effects or "Cities" upkeep style).

I was also surprised that tech_upkeep is apparently recalculated on the client for display, rather than maintained on the server and sent to the client.

It feels like tech_upkeep should become a per-player property, being that player's individual contribution to research slowness. That way we can have individual players with the wrong government or whatever leading to effects holding the team back.

Jacob Nevins <jtn>
Project Administrator
Tue May 20 18:11:56 2014, original submission:

The functions seems to only take one player pointer and use get_player_bonus(). I think the bonus should be cumulative for all players sharing the same research.

pepeto <pepeto>
Project MemberIn charge of this item.


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #21521:  player_tech_upkeep.patch added by pepeto (13kB - text/x-patch)


Depends on the following items: None found

   bug dependencies, patch dependencies.


Carbon-Copy List
  • -unavailable- added by jtn (Posted a comment)
  • -unavailable- added by pepeto (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Jul 25 07:34:48 2014pepetoStatusReady For Test=>Fixed
    Wed Jul 23 14:59:46 2014pepetoAttached File-=>Added player_tech_upkeep.patch, #21521
      StatusNone=>Ready For Test
      Assigned toNone=>pepeto
      Planned Release=>2.6.0
    Wed Jun 18 23:11:37 2014jtnDependencies-=>bugs #22158 is dependent
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup