Skip to content
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

PlayerConnect/Disconnect & related Go SDK functions #1519

Merged

Conversation

markmandel
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup
/kind documentation

/kind feature

/kind hotfix

What this PR does / Why we need it:

Includes implementations and unit tests for PlayerConnect, PlayerDisconnect, GetPlayerCount, IsPlayerConnected and GetConnectedPlayers.

Conformance tests will come in the next PR.

Which issue(s) this PR fixes:

Work on #1507

Special notes for your reviewer:

@markmandel markmandel added kind/feature New features for Agones area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc labels May 6, 2020
sdks/go/alpha.go Outdated
}

// PlayerDisconnect Decreases the SDK’s stored player count by one, and removes the playerID from status.players.id
//
Copy link
Collaborator

Choose a reason for hiding this comment

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

Extra line could be removed

Suggested change
//

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch.

sdks/go/alpha.go Outdated
// This is always accurate, even if the value hasn’t been updated to the GameServer status yet.
func (a *Alpha) IsPlayerConnected(id string) (bool, error) {
ok, err := a.client.IsPlayerConnected(context.Background(), &alpha.PlayerID{PlayerID: id})
return ok.Bool, errors.Wrap(err, "could not get if played is connection")
Copy link
Collaborator

@aLekSer aLekSer May 6, 2020

Choose a reason for hiding this comment

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

Suggested change
return ok.Bool, errors.Wrap(err, "could not get if played is connection")
return ok.Bool, errors.Wrap(err, "could not get if the player is connected")

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah! much better!

@@ -36,26 +36,66 @@ func TestAlphaGetAndSetPlayerCapacity(t *testing.T) {
capacity, err := a.GetPlayerCapacity()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there should be FeaturePlayerTracking enabled for this test:

err := runtime.ParseFeatures(string(runtime.FeaturePlayerTracking) + "=true")
				assert.NoError(t, err)

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to disagree. This is testing against a mock, of which there is only very light logic, that's also not controlled by a feature flag.

There is no need for feature flags at the SDK level either, since this is all controlled by the backing SDK Server.

So I don't see any reason to have this here? Unless I'm missing something.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the explanation. Agree with you.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 7ca3e4e8-08fb-481c-aa65-dbaa86cff148

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1519/head:pr_1519 && git checkout pr_1519
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-11bd744

Includes implementations and unit tests for PlayerConnect,
PlayerDisconnect, GetPlayerCount, IsPlayerConnected and
GetConnectedPlayers.

Conformance tests will come in the next PR.

Work on googleforgames#1507
@markmandel markmandel force-pushed the feature/player-tracking-sdk branch from 11bd744 to ca56940 Compare May 6, 2020 22:50
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: b51b45e5-4230-49f9-9c76-9286fb4dd7cb

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: f6c4f92a-74ff-42e4-a4ce-6548cb3e7725

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1519/head:pr_1519 && git checkout pr_1519
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-ca56940

Copy link
Collaborator

@aLekSer aLekSer left a comment

Choose a reason for hiding this comment

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

Fixed my nits thanks.

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aLekSer, markmandel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 3c064849-ae00-4119-a813-38c3c6f9ba87

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 77334584-3c45-404f-8096-15c428bd1f39

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1519/head:pr_1519 && git checkout pr_1519
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-2288e2a

@markmandel markmandel merged commit d2dc3ed into googleforgames:master May 7, 2020
@markmandel markmandel added this to the 1.6.0 milestone May 7, 2020
@markmandel markmandel deleted the feature/player-tracking-sdk branch May 7, 2020 18:41
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
)

Includes implementations and unit tests for PlayerConnect,
PlayerDisconnect, GetPlayerCount, IsPlayerConnected and
GetConnectedPlayers.

Conformance tests will come in the next PR.

Work on googleforgames#1507

Co-authored-by: Alexander Apalikov <alexander.apalikov@globant.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc kind/feature New features for Agones size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants