Skip to content

Options: CivilizationIV.ini's settings on the OpenCiv4 tab (autosaves, tech splash, messages, field of view, frame cap) - #120

Closed
MortenLyhr wants to merge 10 commits into
bssth:masterfrom
MortenLyhr:fix/ini-options
Closed

MortenLyhr wants to merge 10 commits into
bssth:masterfrom
MortenLyhr:fix/ini-options

Conversation

@MortenLyhr

@MortenLyhr MortenLyhr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #87 (fix/options-screen), which brings the OpenCiv4 tab and the option saving in profile.ini: this branch holds its commits, so merge #87 first (or this merges both). The four commits from 527cb5f to 2d8e815 are new.

The original reads some settings only from CivilizationIV.ini; its Options screen can't set them. OpenCiv4 has no such ini. This adds the ones that matter on a Mac to the Options screen's OpenCiv4 tab, under "From CivilizationIV.ini". Their defaults are the ini's, and they are kept in profile.ini like the tab's other options.

The OpenCiv4 tab

What it changes

Option ini setting Default What it does
No tech splash screens NoTechSplash off noTechSplash() answers yes, so the game core shows no splash screen for a new tech.
No event messages on the screen NoEventMessages off The messages aren't shown at the top of the map. They still go into the turn log, and their sounds play.
Autosave every N turns (0: never) AutoSaveInterval 4 The game's first turn is saved as AutoSave_Initial_BC-4000, then every Nth turn's start as AutoSave_<year> (BC-3920), in Saves\single\auto, as seen in the original. (An AD year is written the same way, AD-1250; not seen.)
Keep N autosaves MaxAutoSaves 5 When one more AutoSave_<year> is written, the oldest goes. AutoSave_Initial_… doesn't count and stays, as in the original.
OpenCiv4's autosaves (OpenCiv4's own) off OpenCiv4's way until now: My Games\openciv4\Saves\auto, each game its own files, kept in turn, every 25th turn kept for good. With every 1 turn and keep 10 it is exactly the old behaviour.
Field of view (0: the game's, 42) FIELD_OF_VIEW 0 A non-zero value replaces GlobalDefines.xml's FIELD_OF_VIEW: set as each game starts, and at once when changed. BUG's slider on the map still changes it afterwards, as in the original.
At most N frames a second (0: no limit) SetMaxFrameRate 0 MapWindow waits after presenting a frame until that frame's share of the second has passed.

Behaviour change: by default, autosaves now follow the original (every 4 turns, 5 kept, in the original's folder with its names). Before, OpenCiv4 saved every turn into its own folder. The "OpenCiv4's autosaves" check box, with every 1 turn and keep 10, gives the old way back.

  • The autosave rules are in a new AutoSaves.h.
  • The number boxes take digits only, at most four, and keep a value as it is typed: oc4screens now calls editTyped hooks after keys go into an edit box.

The ini's other settings are already in game (Language, Full-screen Mode, Bandwidth, the No Sound boxes, voice). Some are covered by OpenCiv4's own options or command line (edge scrolling, --mod, --seed, --turns, --log-dir). The rest don't apply (Direct3D, Bink, Pitboss, GameSpy, Windows input).

How it was checked

  • ctest passes: 16/16 (macOS, Release), with two new tests:
    • ini_options (oc4options.py with a stand-in host): the defaults reach the host, check boxes and typed numbers go into profile.ini at once and come back after a restart, letters are dropped, and an empty box is 0. The field of view replaces the XML's only once a game has started, and 0 brings the XML's back.
    • auto_saves (AutoSaves.h): when an autosave is due, the original's names for BC and AD years, OpenCiv4's names, and which old autosaves are deleted (only the oldest AutoSave_<year> files: never the initial one or other saves).
  • Game results unchanged: --turns 100 --map Fractal --size STANDARD --seed 7 gives the same checksum as before on all 100 turns, ending at D7D43800.
  • In OpenCiv4:
    • At most 20 frames a second gave 101 frames in 5.0 s, against 506 a second without a limit.
    • Field of view 60 shows a wider view.
    • The first autosave is Saves/single/auto/AutoSave_Initial_BC-4000.CivBeyondSwordSave.
  • Against the original (Wine, plain game, with the ini set):
    • NoEventMessages: a message added by script didn't show on the map.
    • NoTechSplash: a tech found at the turn's end gave no splash screen, though the civic popup still came. OpenCiv4 behaves the same.
    • FIELD_OF_VIEW=60 widens the view in both (not compared pixel for pixel: this branch doesn't have Camera: tilt, field of view and view centre as measured in the original #62's camera).
    • The first autosave has the same name and folder.
  • Against the original (Wine, plain game, 2026-11-22), AutoSaveInterval = 2, MaxAutoSaves = 3, Saves\single\auto listed at the start of each of 16 turns: a save at turns 2, 4, 6, … named AutoSave_ + the year (AutoSave_BC-3920); from the 4th on, the oldest goes in the same turn; AutoSave_Initial_BC-4000 is never counted or deleted. Listing: autosaves-listing.txt.
  • Original saves still load: not affected (nothing in the saves changes).
Wine, NoEventMessages=1: no message at the top Wine, NoTechSplash=1: no splash, the civic popup still comes

Field of view 60, Wine | OpenCiv4:
Field of view 60

Source of the autosave rule (re-checked 2026-11-22)

This PR first based the later autosaves on strings read from Civ4BeyondSword.exe. That breaks CONTRIBUTING's rule, so the rule was watched instead in the running game under Wine (above). One part differed: OpenCiv4 counted the initial save among the kept ones and would have deleted it; the original keeps it. Commit a864bdef fixes that and its test. Only BC years were seen, so the AD name is marked as our guess. Interval 0 = no autosaves is from the ini's own comment ("0 means no autosave").

🤖 Generated with Claude Code

MortenLyhr and others added 10 commits November 20, 2026 13:50
… OpenCiv4's own options on their own tab

The original keeps the player options in its player profile and sends them to the
active player at the start of every game, new or loaded (CvGame::sendPlayerOptions);
OpenCiv4 used the XML's defaults for a new game and the save's own after a load, and
never wrote them to profile.ini. Now Utility holds the profile's (profile.ini player.N),
a choice sent from the options screen goes into it and is written at once.

The options screen's check boxes get the theme's GFC_Control_StandardCheckBox_Style, as
the custom game screen's; W A S D, idle turns and edge scrolling move to an OpenCiv4 tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rges cleanly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abs, GFC's box layout

Measured on the original's options screen (Wine, BUG + BULL): the standard window's title bar
with the title at the left, tabs as wide as their words from the left (the theme's tab skins,
the chosen one lighter, a baseline under them), 31 px rows (GFC's default control height),
16 px text, a box's children as wide as they need with the rest to those that expand (the
two columns of player options) or to the spacers (Language at the panel's foot), Restore
Defaults and Exit centred under the panel. Empty panels take no room. CyGTabCtrl's
setActiveTab/getActiveTab work, so a script can open a tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owed

Before the player options were kept as choices, the options screen wrote
every player option it had shown, and it showed those the profile did not
have as off. Such a profile has Wait at End of Turn off (and advisor
pop-ups, Sid's tips) though the player never chose it; with Wait at End of
Turn off the game core ends each turn by itself once a unit has moved, so
turns seemed to end on their own.

The profile now has a version (2). One without it gets, once, the XML's
default for the options that are on by default and off there; every other
choice stays, and from then on off is the player's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No tech splash (NoTechSplash), no event messages on the screen (NoEventMessages),
autosave every N turns and keep M (AutoSaveInterval 4, MaxAutoSaves 5: the original's
names and folder, Saves\single\auto) or OpenCiv4's own autosaves, field of view
(FIELD_OF_VIEW, 0: GlobalDefines.xml's), a frame cap (SetMaxFrameRate). Kept in
profile.ini; number boxes take digits only and are kept as typed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fore)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reens have none)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rt getGameTurnYear)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MortenLyhr

MortenLyhr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Included in bundle 4/6, #148, merged there with its own commits and with its conflicts with the other open PRs resolved (the bundle PR lists them). Closing in favour of #148.

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.

1 participant