Project

General

Profile

Actions

Bug #1267

open

civ2civ3 ruleset - help for units is misleading

Added by Dean Brown 7 months ago. Updated 4 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Rulesets
Target version:
Start date:
03/26/2025
Due date:
% Done:

0%

Estimated time:

Description

In the help for Government -> Federation it says -

"Each city can support up to 2 units for free; further units each cost 2 gold per turn."

but effects.ruleset has -

[effect_upkeep_free_units_federation]
type = "Unit_Upkeep_Free_Per_City"
value = 4
reqs = { "type", "name", "range", "quiet"
"Gov", "Federation", "Player", TRUE
"OutputType", "Gold", "Local", FALSE
}

Same problem for Fundamentalism.
Easy to fix, but which one is correct?


Files

1267.patch (51.5 KB) 1267.patch Dean Brown, 10/22/2025 07:04 AM
1267_Main.patch (47.9 KB) 1267_Main.patch Dean Brown, 10/25/2025 06:16 AM
1267_S3_3.patch (47.9 KB) 1267_S3_3.patch Dean Brown, 10/25/2025 06:16 AM
33test.sav.xz (24.1 KB) 33test.sav.xz Dean Brown, 10/27/2025 06:19 AM
Actions #1

Updated by Marko Lindqvist 7 months ago

Not sure, but this might be correct as it is. Each unit has upkeep of 2, so (free) upkeep of 2 units is 2x2=4 gold.

README.civ2civ3 likely has more to say about this.

Actions #2

Updated by Dean Brown 7 months ago

  • File patch1267.diff added

Did a deep dive into this and you are correct, the Upkeep_Factor is sometimes 2. Hard to understand the Upkeep_Factor reqs the way they are written.

But I did find a problem with the help displayed for units - most of them say
"Basic upkeep: 1 Food, 1 Shield, 1 Gold"
which is wrong, or at least very misleading. The actual upkeep is, depending on government, either "1 Shield", "1 Gold", or "2 Gold". I made an improvement by using the Shield2Gold_Factor effect, and, in units.ruleset, the ShieldToGold unit flag plus appropriate changes. With these changes the unit help says "1 Food, 1 Shield" and there's an auto generated help text saying "The 1 shield unit upkeep becomes 1 gold under Despotism and Monarchy, and 2 gold under Fundamentalism, Federation and Democracy.". Unfortunately you can't attach a "helptxt" to a predefined unit flag so I had to make a pseudo duplicate unit flag "ShieldToGold". And that new helptxt string would need translations.

Also wish I could edit the bug title.

Patch for 3.1

Actions #3

Updated by Dean Brown 3 months ago

  • Subject changed from civ2civ3 ruleset - mismatch between gov help and effect Unit_Upkeep_Free_Per_City to civ2civ3 ruleset - help for units is misleading

Edited the bug subject, renamed patch file.

Actions #4

Updated by Dean Brown 3 months ago

  • File deleted (patch1267.diff)
Actions #5

Updated by Dean Brown 3 months ago

  • File 1267.patch added
Actions #6

Updated by Dean Brown 3 months ago

  • File deleted (1267.patch)
Actions #7

Updated by Dean Brown 3 months ago

  • File 1267_Main.patch added
  • File 1267_S3_3.patch added
  • File 1267.patch added

better 1267.patch file, and added patches for other branches.

Actions #8

Updated by Marko Lindqvist 3 months ago

This would be an improvement to the help display, yes, but a lot of testing needs to be done to see how badly it hurts the AI.

Actions #9

Updated by Marko Lindqvist about 2 months ago

Marko Lindqvist wrote in #note-8:

... but a lot of testing needs to be done to see how badly it hurts the AI.

Which is not happening yet, but only when I'm back to full steam at freeciv development. I begun my summer break much later than I should have, so am also going to end it late.

Actions #10

Updated by Marko Lindqvist 9 days ago

  • Target version set to 3.2.2
Actions #11

Updated by Marko Lindqvist 9 days ago

Currently these patches change civ2civ3 ruleset only. In most cases when civ2civ3 ruleset is changed, similar change is needed for sandbox ruleset too. Isn't it the case here, or is it missing?

Actions #12

Updated by Marko Lindqvist 9 days ago

Marko Lindqvist wrote in #note-8:

... but a lot of testing needs to be done to see how badly it hurts the AI.

Turns out it doesn't even change the autogame with my regression test game, so there's no need for painful AI performance comparison testing.

Actions #13

Updated by Dean Brown 9 days ago

  • File deleted (1267.patch)
Actions #14

Updated by Dean Brown 9 days ago

Yes sandbox should also get changed. Replaced patch for S3_1 & S3_2. I still need to update patches for S3_3 and Main.

Re. AI testing - occurred to me, does the AI know about the Shield2Gold_Factor effect type? If not, then an improvement is possible. I assume AI already knows about unit upkeeps uk_shield, uk_gold, etc.

Actions #15

Updated by Dean Brown 6 days ago

  • File deleted (1267_Main.patch)
Actions #16

Updated by Dean Brown 6 days ago

  • File deleted (1267_S3_3.patch)

Updated by Dean Brown 6 days ago

S3_3 and Main are different because of the change from Shield2Gold_Factor to Shield2Gold_Pct, and flag ShieldToGold changed to a user unit type flag.

Actions #18

Updated by Marko Lindqvist 6 days ago

S3_3 & Main: There's only one 100% Shield2Gold_Pct effect, though some government types are supposed to have 200%.

Actions #19

Updated by Dean Brown 4 days ago

My testing shows what I think are the correct results, at least it matches what the S3_2 version does. The Shield2Gold_Pct effect must be multiplied by the cumulative "Upkeep_Factor" effects. When I tried adding a second 100% Shield2Gold_Pct effect for, e.g. Democracy or Federation, I saw 4 gold/unit result.

Actions #20

Updated by Marko Lindqvist 4 days ago

Ok, so the Upkeep_Factor is defined differently between branches? I just saw in these patches that S3_2 patch introduces two effects while the S3_3/main introduce only one.

Actions #21

Updated by Dean Brown 4 days ago

Upkeep_Factor is the same in all branches, and my patches don't change it. It looks to me like the interaction between Shield2Gold_Pct and Upkeep_Factor is different in newer branches than the interaction between Shield2Gold_Factor and Upkeep_Factor in 3_2.

Actions #22

Updated by Marko Lindqvist 4 days ago

Sounds like we've unearthed a bug somewhere.

Actions #23

Updated by Marko Lindqvist 4 days ago

S3_2 README.effects:

Shield2Gold_Factor
Factor in percent for the conversion of unit shield upkeep to gold upkeep.
A value of 200 would transfer 1 shield upkeep to 2 gold upkeep. The range
of this effect must be player or world. Note that only units with the
"Shield2Gold" flag will be affected by this.

So it's percentage even in S3_2 (despite the name). Your patch sets values to just 1 or 2.

Actions #24

Updated by Dean Brown 4 days ago

Yes could be a bug if the intent was to make Shield2Gold_Pct work the same as Shield2Gold_Factor, which I would expect. If that gets changed then my patch would need to change also.

In case it's useful - here's the 3_3 savegame file I'm using for testing.

Actions #25

Updated by Marko Lindqvist 4 days ago

Dean Brown wrote in #note-24:

Yes could be a bug if the intent was to make Shield2Gold_Pct work the same as Shield2Gold_Factor, which I would expect.

The only thing that #1350 did was renaming the effect to match the fact that it is (has always been) a percentage one.

Actions

Also available in: Atom PDF