Skip to content

Victory status, towards victory conditions - #983

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

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

Conversation

@ajhalme

@ajhalme ajhalme commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Add support for winning the game. This PR adds victory conditions and some scaffolding to support victory condition 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 (--> future PR)
  • 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 (previous PR)
  • 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 (previous PR)

The game now ends when the turn limit is hit. There's a basic UI popup that notifies about game termination and allows you to terminate the game, or to continue without extra score accumulation, with the game effectively in "game over" state.

Per turn score calculation looks pretty good, per turn culture calc is not quite there, per turn power is unimplemented. (We have some info on the power formula, but we might pursue a custom alternative instead).

@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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The original condition is no cities and no settlers (or more accurately, units with the build city action). All units are wiped on defeat, as well as any remaining cities if defeated under elimination rules, which obviously is a separate case.

Comment thread C7/UIElements/NewGame/PlayerSetup.cs Outdated
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.

This was referenced Aug 31, 2026
# Conflicts:
#	C7Engine/C7GameData/GameData.cs
#	C7Engine/C7GameData/Player.cs
#	C7Engine/C7GameData/Save/SaveGame.cs
@ajhalme

ajhalme commented Sep 20, 2026

Copy link
Copy Markdown
Contributor Author

I've patched up this PR: the game is now winnable.

I've simplified things a bit, so that "Turn Limit" is the only supported victory type. The player with the highest score at the end of the last turn wins. End of the game is marked only with a simple popup on the UI side, for now.

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.

3 participants