Skip to content

headless: -single_pass_demographics, demographic totals in one serial pass over the pops (off by default) - #2326

Open
ruggsea wants to merge 4 commits into
schombert:mainfrom
ruggsea:single-pass-demographics
Open

ruggsea wants to merge 4 commits into
schombert:mainfrom
ruggsea:single-pass-demographics

Conversation

@ruggsea

@ruggsea ruggsea commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Builds on #2320 (it uses its argument loop), so it is easier to review after that one.

-single_pass_demographics 1 adds up all of the day's demographic keys in one serial pass over the pops, instead of one parallel pass per key. It is off by default. It is only quicker when the game runs on one thread (-threads 1, for reproducible headless runs); with more threads the per-key parallel version is better, as you said.

Measured on one core, vanilla, seed 10001, 3 years, 2 runs each: 30.6 s without, 27.3-27.4 s with. nations.csv, prices.csv and provinces.csv from -dump are byte-identical with and without.

-years N (with -headless) runs N game years with no speed cap and exits; -seed N fixes
the game seed; -threads N caps the worker threads (-threads 1 makes runs reproducible);
-dump DIR writes monthly nations/prices/provinces CSVs. Nothing changes without the flags.
network::init picks the first non-player nation by rank for the local player and
create_mp_player marks it is_player_controlled. Headless only cleared
local_player_nation, so that nation (ENG in 1836 vanilla, RUS in GFM) kept the
player flag: its armies never went on guard, assign_targets never found them,
and the AI never declared a war for it.
…and_save_file instead of an environment variable

This branch has not been deployed

No deployments
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