Corruption

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
User avatar
GriffonSpade
Elite
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Corruption

Postby GriffonSpade » Tue Jan 16, 2018 5:30 am

This wishlist revolves around two large problems with the current corruption system:
1) Output_Waste_By_Dist breaks without a government center
2) NoTradeSize and FullTradeSize server options depress early gameplay in pre-modern eras.

1) Output_Waste_By_Dist has no real method to cap it, and can scale indefinitely.*
The request is for an Output_Waste_Max effect value. This would place a cap on Waste, allowing prevention of situations where it might be /advantageous/ to remove government centers without breaking the game. (If you replace a By_Dist value with a large flat waste value when lacking a government center, the Waste_By_Dist will still eventually exceed it at extreme distances, making it worthwhile to remove all government centers in that case.)

Code: Select all

      if (gov_center == NULL) {
        waste_all = TRUE; /* no gov center - no income */
      } else {
        waste_level += waste_by_dist * min_dist;
        if (waste_by_rel_dist > 0) {
          /* Multiply by 50 as an "standard size" for which EFT_OUTPUT_WASTE_BY_DISTANCE
           * and EFT_OUTPUT_WASTE_BY_REL_DISTANCE would give same result. */
          waste_level += waste_by_rel_dist * 50 * min_dist
            / MAX(wld.map.xsize, wld.map.ysize);
        }
      }


Would instead be something like this (Note that I don't know where all the referenced waste_max would need to be included.):

Code: Select all

      if (gov_center == NULL) {
        if (waste_max == 0) {
          waste_all = TRUE; /* no gov center - no income */
        }
      } else {
        waste_level += waste_by_dist * min_dist;
        if (waste_by_rel_dist > 0) {
          /* Multiply by 50 as an "standard size" for which EFT_OUTPUT_WASTE_BY_DISTANCE
           * and EFT_OUTPUT_WASTE_BY_REL_DISTANCE would give same result. */
          waste_level += waste_by_rel_dist * 50 * min_dist
            / MAX(wld.map.xsize, wld.map.ysize);
        }
      }
      if (waste_max > 0 && waste_level > waste_max) {
        waste_level = waste_max;
      }


*(Well, except for the trunk's scale by distance feature with OUTPUT_WASTE_BY_REL_DISTANCE. Note that a default factor of 50 to give it the same scale as the non-relative distance also prevents ruleset editors from controlling the scaling too: We can multiply effect values by 50 times easily, but dividing values into fractions cannot be done.)

2) Using NoTradeSize and FullTradeSize are great in late-game, where it prevents smallpoxing. But at the beginnings of games it can very easily be game-breaking because they block gold and bulbs needed for upkeep of improvements, research, and possibly units. I've not really any good ideas other than simply adding an effect that can be toggled, ie allowing it to not apply to despotism and maybe monarchy.

cazfi
Elite
Posts: 1781
Joined: Tue Jan 29, 2013 6:54 pm

Re: Corruption

Postby cazfi » Tue Jan 16, 2018 6:17 am

GriffonSpade wrote:1) Output_Waste_By_Dist has no real method to cap it, and can scale indefinitely.*
The request is for an Output_Waste_Max effect value. This would place a cap on Waste, allowing prevention of situations where it might be /advantageous/ to remove government centers without breaking the game. (If you replace a By_Dist value with a large flat waste value when lacking a government center, the Waste_By_Dist will still eventually exceed it at extreme distances, making it worthwhile to remove all government centers in that case.)

I can't follow your logic. Flat value is not affected at all with the presence of the government center. Distance based waste hits full 100% when there's no government center (infinite distance)

User avatar
GriffonSpade
Elite
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Re: Corruption

Postby GriffonSpade » Tue Jan 16, 2018 9:02 am

cazfi wrote:
GriffonSpade wrote:1) Output_Waste_By_Dist has no real method to cap it, and can scale indefinitely.*
The request is for an Output_Waste_Max effect value. This would place a cap on Waste, allowing prevention of situations where it might be /advantageous/ to remove government centers without breaking the game. (If you replace a By_Dist value with a large flat waste value when lacking a government center, the Waste_By_Dist will still eventually exceed it at extreme distances, making it worthwhile to remove all government centers in that case.)

I can't follow your logic. Flat value is not affected at all with the presence of the government center. Distance based waste hits full 100% when there's no government center (infinite distance)


Please forgive me if my presentation is a big disjointed, the idea is still somewhat fresh. I think it is important to think of having a government center as a /bonus/ to understand it. However, the way it is currently set up results in any system using Output_Waste_By_Dist being unable to handle large ranges without breaking.

That is to say, Output_Waste_By_Dist /with/ a government center versus an increased Output_Waste /without/ a government center. At a certain range away from a center, the Output_Waste_By_Dist will still eventually become worse. Using Output_Waste_By_Dist /without/ a government center is completely broken, as it will always be all waste no matter what.
Note that Output_Waste and Output_Waste_By_Dist don't appear to be capped themselves: Only the end waste value after Output_Waste_Pct is applied is capped by MinMaxing it between 0 and effective trade resource(total_eft). Meaning 190% waste should be reduced to 95% by a Courthouse's 50 Output_Waste_Pct, correct?

So a system where, say, base Output_Waste is 25 with Output_Waste_By_Dist as 1. Without a government center, this breaks and becomes all waste, so instead we'll apply a penalty of 50 to Output_Waste, bringing it to 75.

This works fine at low ranges:

No gov center: 75 waste.
gov center:
range 0: 25 waste
range 25: 50 waste
range 50: 75 waste

but beyond this point it breaks:

range 51: 76 waste
range 75: 100 waste
range 100: 125 waste
...
range 200: 225 waste
etc.

However, if an Output_Waste_Max is implemented, the maximum could be set to 75, never allowing it to increase further. Essentially, it allows one to declare that government centers no longer have an effect on corruption beyond a certain range, or perhaps rather a certain level of waste is the 'base waste' that is reduced by being close enough to a government center's influence.

...And having waste just continue to increase until you can't even decrease it is just frustrating, both from a design and gameplay point of view.

User avatar
dunnoob
Elite
Posts: 327
Joined: Mon Dec 23, 2013 3:13 am
Location: Hamburg
Contact:

Re: Corruption

Postby dunnoob » Thu Jan 18, 2018 9:58 am

cazfi wrote:Distance based waste hits full 100% when there's no government center (infinite distance)
Looking in the code I don't see how this works, but if all *_by_distance effects have a Palace as requirement, and a Palace is the only way to get a gov_center at all, then this works for me in the radius rulesets, where a Palace must be built to get a capital with many advantages under Despotism/Monarchy, to get a gov_center, or to get anything better than Despotism, because this ruleset demands it; savepalace FALSE is its only locked setting.

Example for 2.4, an experimental backport of the mostly stable radius ruleset for 2.5:

Code: Select all

; DEL [effect_corruption_despotism1]
; NEW [effect_corruption_distance_1]
;    Renamed to match the following [effect_corruption_2].  In this
;    ruleset corruption by distance requires a Palace, because the
;    corruption without gov_center would consume all trade points.
; DEL [effect_corruption_anarchy1]
; DEL [effect_corruption_monarchy1]
; DEL [effect_corruption_republic1]
; NEW [effect_corruption_distance_2]
;    Same effect for 3 governments, excluding 3 = 6 - 3 governments.
...
[effect_corruption_distance_1]
name    = "Output_Waste_By_Distance"
value   = 4
reqs    =
 { "type",      "name",                 "range"
   "Gov",       "Despotism",            "Player"
   "OutputType", "Trade",               "Local"
   "Building",  "Palace",               "Player"
 }                      ; by distance requires a Capital

[effect_corruption_distance_2]
name    = "Output_Waste_By_Distance"
value   = 2
reqs    =
 { "type",      "name",                 "range"
   "OutputType", "Trade",               "Local"
   "Building",  "Palace",               "Player"
 }
nreqs   =
 { "type",      "name",                 "range"
   "Gov",       "Despotism",            "Player"
   "Gov",       "Communism",            "Player"
   "Gov",       "Democracy",            "Player"
 }                      ; Anarchy, Monarchy, or Republic
 

User avatar
Corbeau
Elite
Posts: 1093
Joined: Mon Jan 13, 2014 11:13 pm

Re: Corruption

Postby Corbeau » Thu Jan 18, 2018 4:16 pm

Hm, if an existing palace is a requirement for all waste effects to... take effect, does it mean that, if there is no palace, there is no waste-by-distance at all?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers, contains forum: http://longturn.net
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
* What Is Longturn?

User avatar
GriffonSpade
Elite
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Re: Corruption

Postby GriffonSpade » Thu Jan 18, 2018 9:57 pm

dunnoob wrote:
cazfi wrote:Distance based waste hits full 100% when there's no government center (infinite distance)
Looking in the code I don't see how this works


It's done in my first code snippet (Though, that's Trunk version). It just has a sanity check before checking the minimum distance to a government center that if you don't have a government center, sets all your trade to corruption rather than trying to calculate your corruption. It also bypasses any Output_Waste_Pct effects, even if they are 100+% (Remove all corruption; this never occurs without a government center in supplied rulesets).

Corbeau wrote:Hm, if an existing palace is a requirement for all waste effects to... take effect, does it mean that, if there is no palace, there is no waste-by-distance at all?


Just note that's /all existing/ effects. If you make one that doesn't include a government center in its effect requirements, it will do as stated just above.