Feature #809470

DefenseMultiplier and DefenseDivider should be upgraded from crude integer multipliers to percent multipliers, similar to other mechanics.

Added by Lexxie L over 1 year ago. Updated about 1 year ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


The reason is simple. Using small integers for bonuses allows no finer gradation or tuning.

Consider a unit which defends at 8, and you want to give it small a bonus in a special context, The smallest bonus you could give it is a full 2x, raising it all the way up to an invincible 16. When we consider other defense bonuses in the game -- such as from terrain or veteran levels, many are lower than 2x and allow the ability to specify fine gradations.

Consider this has already been done in other areas, for example:

type = "Defend_Bonus" 
value = 200

Tuning the relative strengths of things to all work together in a ruleset is a very fine art. Often differences as small as 5% or 10% wildly alter game dynamics. The current crude integer multiplier system forces game designers to paint fine details with a huge roller paint brush. It has resulted in no ruleset in existence ever being able to tune out its imbalances. It has held us back and alienated finer talent from moving freeciv to much higher levels.


#1 Updated by S.C. L. over 1 year ago

I apparently can't mark this resolved myself, but it's done:
PR#16 on Github; also attached as a patch.

Current possible points of contention:
  • The help text for DefenseDivider and DefenseDividerPct might be confusing. Dividing defense is effectively equivalent to multiplying attack, so it could be rephrased like this, either as part of this or as a separate issue.
  • In the same vein, defense dividers could be properly replaced with attack multipliers. This would make the civ2 ruleset technically no longer accurate, but it would be more straightforward and reduce rounding in defense calculations, making combat marginally more precise. That would of course be a separate issue.
  • Alternatively, the defense multipliers and dividers could be united into one calculation. Since this patch changes the defense multiplier cache to store a percentage instead of an integer multiplier, this cache could actually include the defense divider. That way, other code (e.g. AI) could directly use that value without dealing with the details.

Any thoughts?

#2 Updated by S.C. L. over 1 year ago

Added a missing /100 in AI code that may have caused AI to vastly overvalue units with defense multipliers.

#3 Updated by Marko Lindqvist about 1 year ago

  • Target version set to 3.1.0

data/ruledit/comments.txt needs to be updated too.

#4 Updated by S.C. L. about 1 year ago

I knew I was forgetting something. Here we go.

#5 Updated by Marko Lindqvist about 1 year ago

Can we have this as a single patch?

#6 Updated by Marko Lindqvist about 1 year ago

Marko Lindqvist wrote:

Can we have this as a single patch?

Combined them myself.

#7 Updated by Marko Lindqvist about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF