Skip to content

Conversation

@zack-the-coding-actuary
Copy link
Contributor

This one was a bit of a doozy! Lots of updates going on. Created a new struct under Player.cs that can handle all the different revenue and expense sources to put directly into the domestic advisor screen, as well as refactoring the end-turn gold reconciliation just a touch so we're not doubling calculations.

Additionally, this update should be compatible with Wall Street's interest income as well as GPT deals with other players (once implemented).

I know I messed with a lot here so lmk if any changes should be made or rolled back. Thanks!

New Player.cs struct to handle empire-wide gold inflows/outflows, to be implemented with domestic advisor
Wired up all sources of incoming and outgoing GPT to Player object and domestic advisor screen. Set up compatibility with multi turn deals when implemented. Set up interest mechanic. See TODO in City.cs line 625.
Copy link
Contributor

@TomWerner TomWerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! I haven't playtested this yet but just a couple initial comments.

Interest mechanic is now attached to buildings and pulled from ImportCiv3, not a player object boolean flag. Updated interest constants to exist in Rules.cs. Updated save .json files for Wall Street to include treasury interest flag, but I'm not sure where that's read in?

Note that unit tests asserting save .jsons match developer json fail now.

Fixed misc small hygiene tweaks as well.
@zack-the-coding-actuary
Copy link
Contributor Author

@TomWerner @stavrosfa I THINK I covered all your comments with this last commit, but let me know if I missed anything or if you spot any other problems. Thanks!

Needed to update the rules as well as the Wall Street flag! Should be good now.
@stavrosfa
Copy link
Contributor

@esbudylin I think you are the Lua expert here, should the flags for the building be added here too?

private static void MapFlagsToLuaFunctions(SaveBuilding building) {

and

https://github.com/C7-Game/Prototype/blob/6419b0f069b4d5a5c945fad6ecc64e5afb6331c4/C7/Lua/rules/civ3/buildings.lua

@esbudylin
Copy link
Contributor

I think you are the Lua expert here, should the flags for the building be added here too?

No, I don't think so. As far as I can see, this PR doesn't actually implement any behavior for this flag, so changes on the Lua side aren't needed.


result.unitSupport = TotalUnitsAllowedUnitsAndSupportCost().Item3;

if (interestBuildings > 0) result.interest = interestBuildings * Math.Min((int)(gold * rules.TreasuryInterestRate), rules.MaxInterest);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@esbudylin That's what cought my eye, and saw some similarities with the lua files

Copy link
Contributor

@TomWerner TomWerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thanks for the PR! Just a couple of notes.

I checked a couple of saves in civ3 vs openciv3 and the commerce numbers didn't line up exactly.

In one early game civ it looks like we aren't calculating the capital city's income properly, so that's unrelated to this PR (probably something related to despotism penalty/being on a river/civ trait/etc).

In a late game save I turned the sliders to zero and still saw negative numbers for happiness and science - I wonder if we're incorrectly counting the gold from specialists (entertainers/scientists) in our per-city accumulation. Might be worth checking.

Either way I think this PR is good to go, feel free to leave a TODO on the happiness/science thing and merge if you want. The corruption numbers matched up perfectly which was cool!

Comment on lines 73498 to 73502
"maxRankOfWorkableTiles": 2,
"maxRankOfBarbarianCampTiles": 2,
"defaultDealDuration": 20
"defaultDealDuration": 20,
"treasuryInterestRate": 0.05,
"maxInterest": 50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's some sort of weird whitespace change here, could you fix that?

"startUnitType2": "Worker",
"scoutUnitType": "Scout",
"maxRankOfWorkableTiles": 2,
"maxRankOfWorkableTiles": 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@esbudylin esbudylin merged commit 85e0809 into C7-Game:Development Jan 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants