Skip to content

Count and list players across every region of a shard group - #103

Merged
valzargaming merged 1 commit into
mainfrom
claude/project-thread-oejt7q
Nov 15, 2026
Merged

valzargaming merged 1 commit into
mainfrom
claude/project-thread-oejt7q

Conversation

@valzargaming

Copy link
Copy Markdown
Member

Requested by Val · project thread

Summary

The Persistence embed in the player-count channel (#pers-N) only counted the world the bot is configured for (North America), so players on Gaia, Europe, Asia and the other earth regions were missing from both the count and the list.

  • New server option region_group: the absolute path of the Civ13 shard group file (for example D:/Civ13Regions/earth.json). Every region in it (<root>/<id>) other than the server's own world gets a passive heartbeat under its group name. The list follows the file (re-read when it changes), so a new region shows up without a bot restart. shards still works and can be combined.
  • New RegionRoster: one group-wide roster from the heartbeats. Each ckey counts once. A traveller still listed by the region they left goes under the region they moved to; one listed by no region stays counted under Between regions for 30 s (the game writes serverdata every 10 s, the bot samples every 15 s), so trips never drop the count. When every world is down nobody is listed.
  • The status embed and current-round embed show Online Players (N) with one line per region (**Gaia** (2): alice, bob), also when the bot's own world is down but other regions run. Over 1024 characters it falls back to per-region counts. The player-count channel name uses the same roster.
  • PortableProfile validates region_group (existing absolute file).

Tests

  • php tests/local/heartbeat-roster.php (new): grouping, double-listed travellers, between-regions grace and expiry, all-down, escaping, oversize fallback.
  • php tests/local/heartbeat-integration.php: group file watched by name, bad ids ignored, both embeds list players by region, removed region unwatched.
  • php tests/local/heartbeat.php, heartbeat-playercount.php, tests/windows/portable.php, plus play-link, core-gameserver-fixes, server-compatibility, controls, shard-region, run, lifecycle-consumers, restart-command all pass (PHP 8.3).

Not verified: the live bot on the host. Taking effect needs the bot updated and "region_group": "D:/Civ13Regions/earth.json" added to the test1714 server in the local profile.


Generated by Claude Code

region_group points a server at a Civ13 shard group file; every other
region is watched under its group name and follows the file. The status
and current-round embeds show one Online Players field grouped by region,
each ckey once; travellers listed twice go to their new region and ones
listed nowhere stay counted for 30 s under Between regions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WTP2QKpudxeZ6grywgxcm
Copilot AI balanced review requested due to automatic review settings November 15, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@valzargaming
valzargaming merged commit ddd18c8 into main Nov 15, 2026
54 checks passed
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Copy link
Copy Markdown
Member Author

2026-11-15: merged at eea2c7b (squash ddd18c8) after local checks on PHP 8.3: heartbeat-roster, heartbeat-integration, heartbeat, heartbeat-playercount, windows/portable, play-link, core-gameserver-fixes, server-compatibility, controls, shard-region, run, lifecycle-consumers and restart-command all pass. CI on the merged head is being watched. Not verified on the live bot: it takes effect once the bot is updated and region_group is set in the local profile.


Generated by Claude Code

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