1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

RFC: Reshaping the research penalty

Discussion in 'Rhye's and Fall Modmods' started by JediClemente, Aug 9, 2010.

  1. JediClemente

    JediClemente Prince

    Joined:
    Jan 21, 2004
    Messages:
    446
    Location:
    Madrid, Spain
    Have you ever, having more than 10 cities, conquered another city (not always to keep it; maybe for enforcing capitulation and giving it back) and seen your research cost increase dramatically?

    While a 3 or 4-cities Netherlands is 5 techs ahead of you, and increasing?

    This is what I refer to as the "static" part of the research penalty system: it doesn't matter if some or a lot of your cities give out a poor research. A war of conquest, even not to keep the cities a few turns later, having more than 13 cities, is a nightmare.

    Spoiler :
    Looking at the actual code, let's make an example, because you may not notice completely during the game: it's worse for the human player than for the AI.

    For 10 cities, you'd get your actual base cost for the tech (although other parameters affect it: namely the era, having certain techs already, or being in the last turns of the game).

    For 11 cities: 8% extra cost for the human player, 5% for the AI.

    For 13 cities: 24% extra cost for the human player, 15% for the AI.

    For 18 cities: 64% extra cost for the human player, 40% for the AI.

    As I remarked earlier, the problem isn't penalizing the higher number of cities, but doing so regardless of the nature of the cities; they may be unproductive.

    And remember the more cities, the higher maintenance costs and civic upkeep = less money = less science.


    My idea: the penalty should depend on your research rate: the higher it gets, the more the research cost should be increased.

    To begin with, the penalty will be calculated for having a research rate higher than 5 times (iMargin parameter) the base research on the capital.

    The modifier (iMultiplier) will be 5 for the AI and 8 for the human player, as before. This is the extra % cost for techs.

    Hm? :confused:

    Code:
    int iNumCities = GET_PLAYER((PlayerTypes)getID()).getNumCities();
    int iMultiplier = 5;
    if (GET_PLAYER((PlayerTypes)getID()).isHuman())
    	iMultiplier = 8;
    
    int iMargin = 5;
    int iResearchRate;
    int iCapitalBaseResearch;
    
    if (getID() < NUM_MAJOR_PLAYERS)
    	if(iNumCities > 10){
    		iCapitalBaseResearch = GET_PLAYER((PlayerTypes)getID()).getCapitalCity()->getBaseCommerceRate(COMMERCE_RESEARCH);
    		iResearchRate = GET_PLAYER((PlayerTypes)getID()).calculateResearchRate(eTech);
    			if( iResearchRate > iMargin * iCapitalBaseResearch){
    				iCost *= 100 + iMultiplier*( iResearchRate / (iMargin * iCapitalBaseResearch) );
    				iCost /= 100;
    				}
    		}
    This means having as research rate for the total of your cities more than 2 times "5 * base research in capital", but less than 3 times that, will add an extra 16% to the current tech cost.

    This penalty depends on having a lot of developed cities. Also, having Bureaucracy as civic won't affect, as it's the base research considered (or so I think, anyway, may be mistaken :crazyeye: ).

    With the idea introduced, it's a question of finding the optimal value for the iMargin parameter.

    And that means testing. So if any voluntaries can put the edited DLL on the Assets folder (after making a backup of the older one!) of RFC and run some games (esp. American games, to see the tech level of all civs by 1775), it'd be great. :goodjob:

    I also attach the edited CvTeam.cpp (the function is CvTeam::getResearchCost(TechTypes eTech)).

    Edit1: the new DLL crashes the game. So I take it out until figuring out why.
    Edit2: solved. Also, now the "more than 10 cities" is again taken into account, but just previously to apply the penalty, and doesn't influence it.
     

    Attached Files:

  2. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    The problem is, one can pretty much screw himself by focusing his capital on research (which is what I do often). That's not fair or balanced either, I think. The original bonus is a bit high though, that is true.
     
  3. JediClemente

    JediClemente Prince

    Joined:
    Jan 21, 2004
    Messages:
    446
    Location:
    Madrid, Spain
    On the contrary, the problem now would be to have cities other than the capital with a lot of research.

    I think Rhye intended the penalty to prevent huge empires from having a lot of science, and unbalancing the game.

    Having a lot of cities can give you a lot more science, but not always will (in fact, increasing your empire in a city more by founding or conquest will only produce a scientific advantage, if so, several turns later). This was the point I was trying to make.

    I need some way to measure the tech rate to increase the cost progressively. It doesn't have to be in comparison to the capital. But then what?
     
  4. Wessel V1

    Wessel V1 Emperor

    Joined:
    Sep 10, 2007
    Messages:
    1,417
    Location:
    Nijmegen
    Quite a while ago I had another idea to 'fix' this problem:

    Nothing happens up till 10 cities. Then the trouble starts.

    The 11th city, in research order, will not have it's full output anymore, but only 90%. So, if your 11th city has a base research output of 90 (after the modifiers), it will only produce 81 beakers per turn.
    The 12th city, in research order, gets a similar penalty, but increased. It will produce 90% * 90% = 81% of it's original output. So if the city had 80 beakers (lower than 90 of course), it will produce 64.8 = 65 beakers per turn.
    So, in more mathematic form, the nth city produces (base * 0.90 ^ (n - 10)) from it's original output. That means, that a 20th city will only make a very small impact on research, hardly making any difference. This way, it doesn't hurt science to expand your empire, but it won't benefit to it either. 90% Is of course an estimate, probably 85% or 80% would be a more reasonable value.
     
  5. LuKo

    LuKo The Royal Guard

    Joined:
    Aug 28, 2006
    Messages:
    1,501
    Location:
    Poland
    I think that Wessel's solution is very good (I think 90% is good unless tests prove that it isn't). But I know nothing about .dll and I'm afraid it can be hard to do.
     
  6. JediClemente

    JediClemente Prince

    Joined:
    Jan 21, 2004
    Messages:
    446
    Location:
    Madrid, Spain
    That is an interesting idea.

    But too complicated, isn't it?

    It's always easier to increase the tech cost than to reduce a city's research output. Also have in mind this has to be computed each turn, for each civ.

    That's why Rhye had a very simple mechanism, same for my first idea.

    For this we'd have to sort all cities in order of research, and apply the reduction for each one beyond the 10th.

    I was also thinking about adding the whole research from the cities in the core area and comparing it to the total research. If it representes less than, say, 60%, apply penalties.
     
  7. LuKo

    LuKo The Royal Guard

    Joined:
    Aug 28, 2006
    Messages:
    1,501
    Location:
    Poland
    Still, I don't think it's as good as Wessel's plan. The perfect solution would be easy and efficient system, but as for now I prefer efficient over easy (I think that changing just a bit the system is not worth amount of work needed to compile).
     
  8. JediClemente

    JediClemente Prince

    Joined:
    Jan 21, 2004
    Messages:
    446
    Location:
    Madrid, Spain
    I don't quite understand. Compiling the SDK is a piece of cake once you've done it before.

    The other day I recompiled to remove the "barbs can raze holy cities" nonsense. It involved changing a line of code.

    It doesn't matter if the change is big or little. If it adds functionality, at least I'm interested.
     
  9. Davinci07

    Davinci07 Chieftain

    Joined:
    Jul 15, 2010
    Messages:
    26
    Thank you so much this will help- the Russians very much
     

Share This Page