-
Notifications
You must be signed in to change notification settings - Fork 820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Player Tracking for each GameServer #1033
Comments
I also do have a concern for etcd, it could potentially be a lot depending on the design. A Kubernetes event each time a player join ? |
Yeah agreed - was chatting with some people the other day, talking through this, The basic idea we ended up thinking, which I think would work better long term (there are some implementation design decisions to work out too) are:
To track players - have a CRD configurable webhook that has player data sent to it on connection / disconnection. Something like the gameserver name, connect/disconnect and the token that is passed through. Then we can build a separate system(s) for storing and tracking connections, and/or respond to events as needed as well. In theory the sidecar would need to send the webhook request (I think),, but that's doable (and an implementation detail). This requires a full write up, but I think it sounds like a reasonable approach at first pass. WDYT? |
Design ideasThe following is implementation design for both the configuration, status and game server SDK. Feedback is much appreciated. Configuration & StatusapiVersion: "agones.dev/v1"
kind: GameServer
metadata:
generateName: "simple-udp-"
spec:
# new configuration
alpha:
players:
initialCapacity: 10 # sets the initial player capacity. Defaults to 0.
webhook: # http(s) webhook to send player dis/connection events
service:
name: player-tracking-service
namespace: default
path: player
ports:
- name: default
portPolicy: Dynamic
containerPort: 7654
template:
spec:
containers:
- name: simple-udp
image: gcr.io/agones-images/udp-server:0.17
status:
alpha:
# tracks players
players:
count: 6 # current number of players. Only updated one per second, so eventually consistent.
capacity: 10 # current capacity. Set by "initialCapacity" and can be changed by the SDK
SDK FunctionalitySDK.Alpha.PlayerConnect(playerID)This increases the SDK’s stored player count by one, and passes the playerID to the system such that it can fire the webhook with a connection event to any configured receivers.
Will throw an error if the player count is equal to or greater than the capacity. SDK.Alpha.PlayerDisconnect(playerID) : boolDecreases the SDK’s stored player count by one, and passes the playerID to the system such that it can fire the webhook with a disconnection event to any configured receivers.
Does nothing, and returns false if the playerID was not previously added. Returns true otherwise. SDK.Alpha.SetPlayerCapacity(int capacity)Update the SDK.Alpha.GetPlayerCapacity() : intRetrieves the current capacity. This is always accurate, even if the value hasn’t been updated to the GameServer status yet. SDK.Alpha.GetPlayerCount() : intRetrieves the current player count. This is always accurate, even if the value hasn’t been updated to the GameServer status yet. |
I have some questions regarding
Should we wait for webhook response that this player is able to connect? Who would be judging the player if he is able or not able to connect to the session? Would playerID be stored on GS SDK side or separately?
|
Hi Mark -
Could this metric be utilized for autoscaling? I'm wondering for the relay
server use case, in which multiple relay server processes would run inside
a single GameServer container and we need a test for "fullness" for
autoscaling up and down.
…--Rob
On Wed, Jan 22, 2020 at 9:48 AM Alexander Apalikov ***@***.***> wrote:
I have some questions regarding PlayerConnect:
SDK.Alpha.PlayerConnect(playerID)
This increases the SDK’s stored player count by one, and passes the
playerID to the system such that it can fire the webhook with a connection
event to any configured receivers.
Should we wait for webhook response that this player is able to connect?
Who would be judging the player if he is able or not able to connect to the
session?
Would playerID be stored on GS SDK side or separately?
Then we can build a separate system(s) for storing and tracking
connections, and/or respond to events as needed as well.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1033?email_source=notifications&email_token=AAQ3CQNVZWLHOLJX6CIFJC3Q7BMCFA5CNFSM4ITUPHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJTZ5HI#issuecomment-577216157>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3CQJ6KFG5VBITVL5CFWLQ7BMCFANCNFSM4ITUPHOA>
.
--
* • **Robert Martin*
* • *Chief Architect
*• *Google Cloud for Games
• [email protected]
• m: 470-449-2926
|
@aLekSer good questions!
Personally, I don't think so. This could potentially make things very slow in the game server binary. I feel like this should be an async operation that happens behind the scenes.
This is up to the game server binary to make this decision. So it's game / transport layer specific.
In this design, we don't store the playerID at all (except transiently in memory as it gets passed to the system that sends the webhook request). playerID management is up to the game author to track and manage. This is the main impetus for the webhook, to make this easier. While it could be useful to store playerIDs in a CRD, it seems like a performance concern for etcd. Maybe something to explore down the line if we find we have bandwidth in etcd performance.
Like this? #1034 😄 would that work for what you were thinking? |
Yeah something like that looks pretty good. For placement purposes is
there an easy way to pull the most (or least) full game server by player
count, other than iterating through all the game servers in the cluster?
…On Wed, Jan 22, 2020 at 12:37 PM Mark Mandel ***@***.***> wrote:
@aLekSer <https://github.com/aLekSer> good questions!
Should we wait for webhook response that this player is able to connect?
Personally, I don't think so. This could potentially make things very slow
in the game server binary. I feel like this should be an async operation
that happens behind the scenes.
Who would be judging the player if he is able or not able to connect to
the session?
This is up to the game server binary to make this decision. So it's game /
transport layer specific.
Would playerID be stored on GS SDK side or separately?
In this design, we don't store the playerID at all (except transiently in
memory as it gets passed to the system that sends the webhook request).
playerID management is up to the game author to track and manage. This is
the main impetus for the webhook, to make this easier.
While it could be useful to store playerIDs in a CRD, it seems like a
performance concern for etcd. Maybe something to explore down the line if
we find we have bandwidth in etcd performance.
@cloudrobx <https://github.com/cloudrobx>
Could this metric be utilized for autoscaling? I'm wondering for the relay
server use case, in which multiple relay server processes would run inside
a single GameServer container and we need a test for "fullness" for
autoscaling up and down.
Like this? #1034 <#1034> 😄
would that work for what you were thinking?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1033?email_source=notifications&email_token=AAQ3CQJF3ULGCG7PHJILVV3Q7B735A5CNFSM4ITUPHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJUOOIY#issuecomment-577300259>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3CQIRGINELI5QQFPG77DQ7B735ANCNFSM4ITUPHOA>
.
--
* • **Robert Martin*
* • *Chief Architect
* • *Google Cloud for Games
• [email protected]
• m: 470-449-2926
|
See: #1239 for current initial thoughts. |
For relays / high density would probably also want the ability to find the
most empty or most full server as well. Since you're essentially adding
another layer of bin-packing.
…On Thu, Jan 23, 2020 at 7:59 PM Mark Mandel ***@***.***> wrote:
Yeah something like that looks pretty good. For placement purposes is
there an easy way to pull the most (or least) full game server by player
count, other than iterating through all the game servers in the cluster?
See: #1239 <#1239> for
current initial thoughts.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1033?email_source=notifications&email_token=AAQ3CQPRB6P7554DM3VDJ7DQ7I4ONA5CNFSM4ITUPHOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJZMURI#issuecomment-577948229>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ3CQOJ6WZGSWJX5AQY3NTQ7I4ONANCNFSM4ITUPHOA>
.
--
* • **Robert Martin*
* • *Chief Architect
* • *Google Cloud for Games
• [email protected]
• m: 470-449-2926
|
This sounds like the current "Distributed" vs "Packed" strategies we already have in place. Also probably a topic to discuss more on #1239 rather than here, since this ticket isn't covering allocation - just player count tracking. |
Made a small tweak to SDK. Renamed |
Implementation of the alpha functions for player tracking in the proto definition. This includes a interface and non-working stub for the Go gRPC clients as well. Copyright notices where updated to 2020 on the other languages as they were regenerated during the process. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Implementation of the alpha functions for player tracking in the proto definition. This includes a interface and non-working stub for the Go gRPC clients as well. Copyright notices where updated to 2020 on the other languages as they were regenerated during the process. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Implementation of the alpha functions for player tracking in the proto definition. This includes a interface and non-working stub for the Go gRPC clients as well. Copyright notices where updated to 2020 on the other languages as they were regenerated during the process. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033
Hey Mark! Thanks for the heads up, would be great to be able to contribute again! :) Gave the issue a read, I see these have already been updated to the relevant proto files, so all that's needed is the relevant language implementation, yeah? If my understanding is correct, consider it done (hopefully in a timely manner)! 👌 |
That's a good point - you will need to edit the gen.sh scripts such that they generate the code for the alpha.proto, and then yes -- implement the SDK over the top 👍 Thanks! |
Working on Node.js now |
Implementation of the alpha functions for player tracking in the proto definition. This includes a interface and non-working stub for the Go gRPC clients as well. Copyright notices where updated to 2020 on the other languages as they were regenerated during the process. Work on googleforgames#1033
* CRD implementation of alpha player tracking Update to CRD implementation, and pkg/api/gameserver.go and default value implementation. Work on googleforgames#1033 * Including feature flag locking. Required to allow tests to pass with race checking enabled.
This PR doesn't complete this functionality, but was enough to warrant review. It does two things: 1. The refactoring to move alpha and beta SDK Server implementations into the same file as the main SDK Server, as being able to reuse the current logic made sense on review. 2. Initial Implementation of SDK GetPlayerCapacity & SetPlayerCapacity methods with unit tests. E2E tests can be implemented once googleforgames#1397 is resolved. Next steps will be to implement the local SDK functionality, and conformance tests for Go for these two functions. Work on googleforgames#1033
Local SDK implementations of SetPlayerCapacity and GetPlayerCapacity, including conformance tests for the Go SDK. Work on googleforgames#1033
This updates the GameServer CRD based on the [updated design](googleforgames#1033 (comment)) for Player Tracking.
This includes changes to make PlayerID consistent in casing. Code generation will come in the next PR to make things easier to review. Work on googleforgames#1033
* Regenerate gRPC code. * Code Gen and Stubs for updated Player Tracking This PR is an update to the code generated from the Player Tracking proto updates, and the accompanying method stubs so that everything compiles and passes tests. Feature implementation work to come next! Work on googleforgames#1033
Looks like I missed this on initial implementation. Work on googleforgames#1033 Co-authored-by: Alexander Apalikov <[email protected]>
When converting from CRD->gRPC model, add the Player Tracking IDs Work on googleforgames#1033 Co-authored-by: Alexander Apalikov <[email protected]>
Implementation and unit tests for Player Tracking for the local sdk server. Conformance tests will come after this. Work on googleforgames#1033
Implementation of the SDK gRPC Server, with accompanying unit tests. Work on googleforgames#1033
This PR is only the structure to store aggregate values for player tracking data across Fleets and GameServerSets. Later PRs will implement the logic. Work on googleforgames#1033
Fix on a small capitalisation issue on JSON output of the GameServer CRD changes. Work on googleforgames#1033 Co-authored-by: pooneh-m <[email protected]>
Cleanup proto IDs field to conform to naming convention. Work on googleforgames#1033
Fix this up so it also conforms to naming conventions. Work on googleforgames#1033
Reference for the general Player Tracking SDK API. This included some slight reorganising, to make it less cluttered as we add more functionality. To come, is a full player tracking guide, and updates to the GameServer reference. Work on googleforgames#1033
Implementation of aggregation of Player Tracking values at the Fleet and GameServerSet levels. Includes both unit and e2e tests. Work on googleforgames#1033 Co-authored-by: Robert Bailey <[email protected]>
Includes the guide for player tracking, explaining how the SDK commands can be used for player user journeys. Included is also updates to the GameServer references. Also included a small fix in the comments wherein we were still referencing the webhook from the previous design. Work on googleforgames#1033
Reference for player tracking API for the REST interface for the SDK. Also regrouped as how we now have it in the Client SDK guide. Work on googleforgames#1033
Includes the guide for player tracking, explaining how the SDK commands can be used for player user journeys. Included is also updates to the GameServer references. Also included a small fix in the comments wherein we were still referencing the webhook from the previous design. Work on googleforgames#1033
I'm going to suggest we close this ticket, since this has been released to alpha, and there is (mostly?) supported in the SDKs - and I think we can then track each of those as seperate tickets as needed. Also #1677 is going to break all the things (will likely aim to tackle in the next release), so we can track the ongoing work there as well. Sound good? |
Closing as per the last comment (1.5 years ago). |
Is your feature request related to a problem? Please describe.
It would be very useful to track player connection and disconnection against a specific
GameServer
.This would allow us to do several things:
id
ortoken
on connection)Describe the solution you'd like
(Full design TBD)
GameServer
CRD Events for player connections and disconnectionsGameServer
CRD Status values that track player counts and capacity. Maybe should also have a list of current connected players?Describe alternatives you've considered
Have a separate system for player tracking - but based on feedback, this is a feature that almost all users should find useful, so it feels like part of Agones, and also allows some useful functionality down the road -- such as autoscaling by player count, or automating backfill operations by searching for non-full game servers.
Additional context
I do have concerns that we are adding more API QPS with this, so we should track performance with these changes.
The text was updated successfully, but these errors were encountered: