Repository navigation
Conversation
…ss sessions Sessions that live inside the worldserver process (server-side bots, tools) have no gateway, so nothing publishes their logged-in/logged-out events or their zone/level updates: charserver keeps them out of /who, and guildserver/groupserver caches go stale for them. New exports let the worldserver publish on their behalf: - TC9CharacterLoggedIn / TC9CharacterLoggedOut publish gw.char.logged-in and gw.char.logged-out with the same envelope the gateway uses; the sidecar fills RealmID and uses its servers-registry ID as GatewayID so charserver purges the entries when this game server dies. - TC9CharacterZoneChanged / TC9CharacterLevelChanged feed a CharacterUpdatesBarrier that batches and merges per character (same semantics as the gateway CharactersUpdatesBarrier, same 1000-updates cap per event) and flushes gw.char.chars-updates every 5s. Callers must only use these for sessions WITHOUT a gateway connection, otherwise events are duplicated - documented on the declarations.
There was a problem hiding this comment.
🟡 Changes recommended
The new barrier introduces behavior that currently lacks unit test coverage and includes a small but concrete header-doc mismatch about emitted update keys.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a “vitals” update lane for in-process (no-gateway) characters by extending the existing character-updates batching approach so cross-server group consumers can render accurate party frames (level/health/power/position/death state) for those members.
Changes:
- Introduces
CharacterUpdatesBarrierto merge per-character updates and flush JSON batches periodically (including vitals fields). - Hooks the barrier into libsidecar initialization/shutdown and publishes
gw.char.chars-updatesusing the existing{v,t,p}envelope. - Extends the C API (
libsidecar.h) withTC9CharacterVitalsUpdated(and related in-process character update exports), and wires the new source into the build.
File summaries
| File | Description |
|---|---|
| game-server/libsidecar-cpp/src/events/updates-barrier.h | Declares the per-character updates barrier and vitals update API. |
| game-server/libsidecar-cpp/src/events/updates-barrier.cpp | Implements batching/merging, periodic flush, and 1000-update chunking. |
| game-server/libsidecar-cpp/src/api.cpp | Creates/starts/stops the barrier and exposes C exports to enqueue updates/vitals. |
| game-server/libsidecar-cpp/include/libsidecar.h | Adds new public C API declarations and contract comments for in-process sessions. |
| game-server/libsidecar-cpp/CMakeLists.txt | Adds the new barrier implementation to the library sources. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+76
to
+86
| void CharacterUpdatesBarrier::run() { | ||
| for (;;) { | ||
| { | ||
| std::unique_lock<std::mutex> lock(mutex_); | ||
| cv_.wait_for(lock, interval_, [this] { return !running_; }); | ||
| if (!running_) { | ||
| return; | ||
| } | ||
| } | ||
| flush(); | ||
| } |
Comment on lines
+24
to
+26
| // Receives the merged updates as a JSON array of | ||
| // shared/events.CharacterUpdate objects ("i"/"l"/"m"/"a"/"z" keys). | ||
| using FlushFn = std::function<void(nlohmann::json updates)>; |
This was referenced Aug 30, 2026
…st it Review follow-ups: Stop() returned early when the barrier was not running, so updates queued before Start or after a first Stop (e.g. a call racing shutdown, delivered by the destructor's Stop) were silently dropped - it now joins the thread only when needed and flushes unconditionally. Adds a gtest suite covering per-character merging, the 1000-updates batch split, and both stopped-flush paths.
The gateway builds SMSG_PARTY_MEMBER_STATS for cross-server group members from the character fields mirrored via gw.char.chars-updates. In-process sessions only pushed zone and level on change, so a group member hosted on another worldserver rendered as a skull with an empty bar (level 0, no health). TC9CharacterVitalsUpdated publishes the full snapshot - level, health, power type/current/max, position, death state - through the same updates barrier (merged per character, flushed with the h/hm/pt/p/pm/ x/y/d/g keys of shared/events.CharacterUpdate). Intended to be called periodically (e.g. every few seconds) for in-process characters that are in a group.
Review follow-up: the FlushFn comment listed only the i/l/m/a/z keys; UpdateVitals also emits h/hm/pt/p/pm/x/y/d/g.
3kynox
force-pushed
the
feat/libsidecar-cpp-vitals-lane
branch
from
August 30, 2026 17:00
868ee27 to
340cd86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #105 (the first commit here is #105; review the last commit only).
The gateway builds
SMSG_PARTY_MEMBER_STATSfor cross-server group members from the character fields mirrored viagw.char.chars-updates. With #105 alone, in-process sessions push only zone and level on change — so an in-process bot grouped with a player hosted on another worldserver renders as a skull with an empty bar (level 0, no health) in the party frames.TC9CharacterVitalsUpdatedpublishes the full snapshot — level, health, power type/current/max, position, death state — through the same updates barrier (merged per character, flushed with theh/hm/pt/p/pm/x/y/d/gkeys ofshared/events.CharacterUpdate). It's meant to be called periodically (I use a 10 s sweep over grouped bots on the worldserver side) — the barrier merges, so the cost per flush stays one entry per character.No proto or Go changes. Verified: standalone CMake build, 38/38 ctest; running in production — this is exactly the change that fixed the skull/empty-bar party frames on my cluster.