Skip to content

Jnorberg party join request#44

Open
jnorberg-zynga wants to merge 6 commits intoheroiclabs:masterfrom
jnorberg-zynga:jnorberg_party_join_request
Open

Jnorberg party join request#44
jnorberg-zynga wants to merge 6 commits intoheroiclabs:masterfrom
jnorberg-zynga:jnorberg_party_join_request

Conversation

@jnorberg-zynga
Copy link
Copy Markdown
Contributor

This change expects a new Member in "type Environment struct":

PartyJoinRequestDuration   time.Duration `json:"party_join_request_duration"`

Since that would be a change outside the "nakama-unreal", I'm not sure this would be acceptable

@novabyte novabyte requested a review from zyro December 15, 2020 10:24
}

// Everyone else must be approved by the party leader (in a timely manner)
s.joinRequests[presence.GetUserId()] = time.Now().Add(p.config.JoinRequestDuration)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Avoid using time where possible. Express the expiry as a tick number, something like tick + p.config.JoinRequestDuration / time.Second * TickRate (I think, double-check the logic) to get the tick number in the future when the request should expire.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, removed all time.now() from this file

SendResponse(partyMsg, ResponseCodeInternalError, []runtime.Presence{message}, logger, dispatcher)
continue
}
if _, err := nk.StreamUserJoin(6, matchIdComponents[0], "", matchIdComponents[1], presence.GetUserId(), presence.GetSessionId(), false, false, ""); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removing the call to StreamUserJoin is a problem I think. This is (or was?) how pending join requests are placed into the match when accepted. Am I missing something with this change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you now expecting the user to join again once they're on the approved list?

Copy link
Copy Markdown
Contributor Author

@jnorberg-zynga jnorberg-zynga Jan 11, 2021

Choose a reason for hiding this comment

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

Yes, indeed. In my test the "StreamUserJoin" did not work. The "MatchJoinAttempt" or "JoinMatch" was not called. The approach here works fine. It does require the client to listen to and auto-respond to the "Approve" message.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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