Skip to content

City commerce #864

Description

@stavrosfa

There is something weird going on with how we calculate commerce.

For example, if we have 5 corrupt gold, we both add it and subtract it from our total income.

The same is true for beakers and happiness.

Check the Inflows() and Outflows(), they both take these values into account
https://github.com/C7-Game/Prototype/blob/9e90b4df5d32097814c6da1379057e4e79265434/C7Engine/C7GameData/Player.cs#L24

I don't really know how commerce should work in game (embarrassing, I know, but it's only been 20 or so years 😅), so I am not sure what changes to make.

Activity

  1. ethhics commented on May 15, 2026

    @ethhics

    If I'm reading it correctly, this is having to do with the ledger calculations for the domestic advisor?

    If so, then note that the domestic advisor has a "From cities" category. We don't know, from the available variables, how much gold comes from cities. But, we do know that every city turns its gold exclusively into taxes, beakers, happiness, and corruption. So if you sum those together, they yield the total city gold.

    So yes they're double-counted, but it's an artifact of accounting more than anything. The inflow from those sources gets passed directly into outflows as they are really expenses at the end of the day.

  2. Billytifft commented on Sep 21, 2026

    @Billytifft
    Contributor

    Closing as working-as-intended.

    Corruption, science and entertainment being in both Inflows() and Outflows() is deliberate and matches Civ3 on the Domestic Advisor screen:

    • Income shows gross city commerce (the full figure, including the part ultimately lost to corruption).
    • Science, entertainment and corruption are listed as outflows as well.
    • These duplicated terms cancel out in Netflows() (e.g. in a probe save: income 19 = corruption 6 + science 9 + entertainment 2 + taxes 2; outflows have the same 6+9+2 plus maintenance, giving a correct net gold-per-turn), so the treasury math was never wrong.

    We verified this against screenshots of the same save in Civ3 and OpenCiv3 (currently identical). No code change needed; the ledger semantics can be locked in with regression tests when the advisor is further developed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    game corecore game logichelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions