How does the treasury actually work?

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

How does the treasury actually work?

Post by Corbeau »

I thought I understood how the treasury works, but then stuff happened and now I'm not so sure anymore.

So, can someone clarify those three options?
; Method of paying unit and improvement gold upkeep
; 0 - The player`s total gold must be non-negative after paying upkeep
; costs associated with each city. If for any city the player`s gold
; is negative, random buildings in the city are sold off. If the gold
; is still negative, then supported units with gold upkeep are
; disbanded.
; 1 - In the first step, the player`s total gold must be non-negative after
; paying upkeep for all buildings within a city. If for any city the
; player`s gold is negative, random buildings in the city are sold off.
; In the second step, gold upkeep for all units is paid in a lump sum.
; If the player does not have enough gold, random units with gold upkeep
; are disbanded.
; 2 - Gold upkeep for all buildings and units is paid in a lump sum after
; all cities have been processed. If the player does not have enough
; gold, alternatively a random buildings from a random cities is sold
; and a random units with gold upkeep is disbanded till the treasury is
; balanced.
If I understand it correctly, the first two do city by city calculation, while the last one does the whole upkeep before calculating income. But none does income first and the upkeep, right?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How does the treasury actually work?

Post by Ignatus »

Whatever method, city (selected in a randomized order) gold gain is added to the treasure, then its gold upkeep is paid from it. Then for per-city or mixed style the treasure is checked to going in debt. For nation or mixed uk the check and the sellings are done after all cities are processed. So it always happens after the gains.
User avatar
Corbeau
Elite
Posts: 1291
Joined: Mon Jan 13, 2014 11:13 pm

Re: How does the treasury actually work?

Post by Corbeau »

Ok, so if I had around 40 gold in treasury and income per turn was +40, AND I had a building sold "because no money", I was EXTREMELY unlucky?
--
* Freeciv LongTurn, a community of one-turn-per-day players and developers
* LongTurn Blog - information nexus with stuff and stuff and stuff
* Longturn Discord server; real-time chatting, discussing, quarrelling, trolling, gaslighting...
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How does the treasury actually work?

Post by Ignatus »

Yes, and you had a city with -41 balance or worse.
louis94
Hardened
Posts: 270
Joined: Thu Apr 25, 2013 10:17 pm
Location: Belgium

Re: How does the treasury actually work?

Post by louis94 »

Ignatus wrote:Yes, and you had a city with -41 balance or worse.
Or the balance went negative after processing the first N cities. It's not so unlikely in the common case where most of the income is coming from the capital.
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How does the treasury actually work?

Post by Ignatus »

May happen in Mixed style: too many upkept units may be not compensated. After full ballance you are never in minus since disbanded/sold things give their upkeep back.
chippo
Posts: 13
Joined: Wed Jan 08, 2020 10:48 am

Re: How does the treasury actually work?

Post by chippo »

Corbeau wrote:Ok, so if I had around 40 gold in treasury and income per turn was +40, AND I had a building sold "because no money", I was EXTREMELY unlucky?
I had a similar problem today, 'cept in my case I had 63 in treasury and +125. So I carefully started authoring an email and collecting the savegame file, noting version nos, etc. While replaying it and checking my spelling, I was astounded to see that during the replay I didn't lose a building.

The situation was quite unusual. I had several cities with net gold approximately -20, and several with net gold approximately +50 and then a host of cities with net gold in single digits, mostly less than zero. I have a feeling that when I originally saw the building being sold, the program was processing my cities in a different order to when, after the re-load no building was sold off.

I've hit Turn Done when my Gold Situation was 0/+6 and no building was sold off. I've hit Turn Done when my GS was ~100/~+300 and lost a building.

I suspect that a change to the order that the cities are processed in, would resolve this. Just do them in the order of the Gold in the G/L/S display, or even simpler, just do the ones with positive gold before doing cities with negative gold.
nef
Elite
Posts: 324
Joined: Mon Jun 25, 2018 5:01 pm

Re: How does the treasury actually work?

Post by nef »

I believe option 0 (as quoted by Corbeau from the ruleset documentation) is the way that Civ I (and probably II) does it. I don't like it but that's the way it was.
Post Reply