Skip to content

Victory status, towards victory conditions - #983

Open
ajhalme wants to merge 19 commits into
C7-Game:Developmentfrom
ajhalme:victory-status
Open

Victory status, towards victory conditions#983
ajhalme wants to merge 19 commits into
C7-Game:Developmentfrom
ajhalme:victory-status

Conversation

@ajhalme

@ajhalme ajhalme commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Adds victory conditions and various scaffolding needed for their evaluation.

  • Extend ruleset with victory conditions
  • Add Civ3Checkbox UI element (started from a clone of the Civ3MenuButton)
  • Extend Victory Status view with a display grid on which we can draw victory status rows
  • Render "registered" victory conditions in the VS view, depending on game mode
  • Add New Game Player Set widget for selecting games rules, add a couple of victory condition selectors as a demo
  • Add age multiplier to culture-per-turn calc (sketch)
  • Model victory conditions in OOP style as implementations of an IVictory interface
  • Extend SaveGame with victory conditions and score history, load from save
  • Wire score history maintenance into main game loop
  • Add a victory status calculator and sketch out some victory calculations
  • Add some util fuctions for victory calcs in Tile, TileKnowledge, City, GameData, Player, TerrainType, Building

Victory conditions can be evaluated (and are, for VictoryStatusView), but the game cannot be won yet. Full game loop wiring and the mechanics of winning the game need more thought.

Per turn score calculation looks pretty good, per turn culture calc is not quite there, per turn power is unimplemented. (Per turn power formula is not known to the modding community, AFAICT).

Checkboxes from C7-Game/Assets#14

@ajhalme
ajhalme marked this pull request as ready for review August 20, 2026 22:53
@ajhalme

ajhalme commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

This victory conditions PR is now open for reviews. See first post for changes.

Plan is to implement victory conditions and related scaffolding here, and then take on actual game winning wiring in a separate effort.

@stavrosfa stavrosfa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, without being able to win/lose, it looks ok. I have left some comments.

I would also rather in the future that we split such big PRs into smaller, more managable chunks, so that they can be evaluated better and be easier to revisit in the future.

// "Power is an amalgam of cities, gold, culture, advances, resources, military strength,
// nuclear weapons, and wonder."
// Exact formula is unknown, so we repeat the previous value.
// TODO: Figure out power formula

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would add a TODO here to make this formula/score calculations moddable (where it makes sense)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added TODO

}
}

private static bool IsDefeated(SavePlayer player, QueryCiv3.Sav.LEAD leader) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this really that simple in the base game, or should we add a few TODOs here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a TODO.

Probably good enough for now. No cities means civ is almost certainly dead, except for the very beginning of the game - hence the unit counter. I think civs that are killed in the original do have their remaining units wiped, so this should be reasonably correct for Civ3 save files.

Comment thread C7/UIElements/NewGame/PlayerSetup.cs Outdated
dominationVictory.Toggled += (state) => { victoryConditions.AllowDominationVictory = state; };
rulesContainer.AddChild(dominationVictory);

var placeholder1 = new Civ3Checkbox() { Text = "Placeholder" };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure what's going on here. Why the placeholder?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Godot wants to fill a GirdContainer by row. Couldn't immediately figure out how to make it fill by column. The placeholder makes it so the first and third elements go in the first column.

I've removed the placeholder: having just the two win conditions on the same row is fine for now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did a quick search, it seems that indeed Godot doesn't offer that out of the box, it's only been 2+ years since there was a proposal/PR for this, so fingers crossed, we might be getting this in this decade 😆

As for our thing, it's fine, I just wasn't sure what the purpose was.

Comment thread C7/UIElements/GameViews/VictoryStatusView.cs
@ajhalme

ajhalme commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, not happy with how much stuff there is in this one. I think I'll slice off some of the util stuff and UI bits in separate PRs.

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.

2 participants