adjustable technology leak rate

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Posts: 36
Joined: Thu Feb 13, 2014 8:24 am
Location: Japan

adjustable technology leak rate

Postby fomalhaut » Tue Jul 10, 2018 6:39 am

I like technology leak but sometimes feel that it's too strong.
So I hope to be able to adjust the rate of it in game.ruleset.

User avatar
Posts: 80
Joined: Thu May 17, 2018 4:54 pm

Re: adjustable technology leak rate

Postby vodot » Fri Jul 13, 2018 8:52 pm

There is no option for this in 2.6 aside from setting Tech Leak to "Embassies" (The weakest of the three tech leak settings).

If you want to get nuts (LET'S GET NUTS!) then you can find the math itself in 'research.c' in the /common folder. I've copied it below:

Code: Select all

      int players = 0, players_with_tech_and_embassy = 0;

      players_iterate_alive(aplayer) {
        const struct research *aresearch = research_get(aplayer);

        if (aresearch == presearch
            || (A_FUTURE == tech
                ? aresearch->future_tech <= presearch->future_tech
                : TECH_KNOWN != research_invention_state(aresearch, tech))) {

        research_players_iterate(presearch, pplayer) {
          if (player_has_embassy(pplayer, aplayer)) {
        } research_players_iterate_end;
      } players_iterate_alive_end;

      fc_assert_ret_val(0 < players, base_cost);
      fc_assert(players >= players_with_tech_and_embassy);
      base_cost *= (double) (players - players_with_tech_and_embassy);
      base_cost /= (double) players;

To weaken the effect, just tweak the ratio at the end (the 'base_cost *=' bit). Note that by default, the game is reducing the cost by a straight percentage equal to the the ratio of (know_tech+have_embassy)/(all players)— e.g. if 4/10 players know the tech (and you have embassies with 3 of them), the cost of the tech will be reduced by 30%.

Put a 0.5* in there to (globally & permanently, in your copy of the game) cut the effect in half, for example. That would make the reduction only 15%, in the above example.
Last edited by vodot on Sat Jul 14, 2018 8:35 pm, edited 2 times in total.

User avatar
Posts: 473
Joined: Wed Jan 30, 2013 12:15 am

Re: adjustable technology leak rate

Postby JTN » Sat Jul 14, 2018 9:56 am

Raised hrm #764944.