feat(proxy): expose network-wide player counts per backend server#15
Draft
hbrombeer wants to merge 1 commit into
Draft
feat(proxy): expose network-wide player counts per backend server#15hbrombeer wants to merge 1 commit into
hbrombeer wants to merge 1 commit into
Conversation
A proxy can only count the players connected to itself, so with two proxies in front of one lobby each of them reports half of it. ProxyService now answers for the whole network, via the registered PlayerSessionQuery. Returns null when the network cannot be asked, rather than falling back to this proxy's own numbers: a local count is indistinguishable from a network count once it is rendered, and silently showing the wrong one is the bug being fixed.
This was referenced Jul 14, 2026
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.
Why
ProxyServiceis the seam every plugin uses to reason about players on other proxies — resolve a name, send a message, transfer them. The one thing it could not do was count them, so/agonesfell back to Velocity'splayersConnected, which is proxy-local by definition and reported "1 player" in a lobby holding two.What
PlayerSessionQuery.countPlayersByServer()— implemented by plugin-player, backed by service-player's session table.ProxyService.getNetworkPlayerCounts()— what consumers call.NetworkPlayerCounts(byServer, total). A server nobody is on is absent rather than zero;totalincludes players not yet on a backend server, so it can exceed the sum.Returns null, not a local fallback. Every other
ProxyServicemethod degrades to a local answer when noPlayerSessionQueryis registered, and that is right for them — a local player is a correct answer to "where is this player". It is wrong for a count: a proxy-local number looks exactly like a network number once rendered, and quietly showing it is the bug. Callers should say the figure is proxy-local instead.Merge order
2 of 5. Depends on nothing; blocks the consumer.
library-grpc-contracts-player0.4.0plugin-proxy-api(0.2.0)service-player— implement the RPCplugin-player— implementcountPlayersByServer()plugin-agones—/agonesreads the network numbersVerified
./gradlew buildgreen. Published locally asgg.grounds:plugin-proxy-api:0.2.0and compiled plugin-player and plugin-agones against it.