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

Party presence event is not received by client when party is created #193

Closed
jonbonazza opened this issue Dec 31, 2023 · 3 comments
Closed

Comments

@jonbonazza
Copy link

jonbonazza commented Dec 31, 2023

On the nakama runtime logs, I see the following after creating a party from a Godot client:

emergence-nakama-nakama-1  | {"level":"debug","ts":"2023-12-31T10:13:29.554Z","caller":"server/tracker.go:907","msg":"Processing presence event","joins":1,"leaves":0}

I have a the received_party_presence signal connected on the client but it is never called.

This is using the lastestGodot 4 client on the Godot asset lib (running on Windows 11), and nakama version 3.20.0 running in a docker container.

@novabyte
Copy link
Member

novabyte commented Jan 8, 2024

@jonbonazza When you call the socket function for creating a party can you print what the contents of the structure you get back looks like?

@jonbonazza
Copy link
Author

@jonbonazza When you call the socket function for creating a party can you print what the contents of the structure you get back looks like?

Okay so finally had some more time to look at this, it looks like I get a NakamaRTAPI.Party struct and it does indeed have the leader and current party presences (which in my case, just has the one member). So I guess my questions then are:

  1. Do I not get a presence event with the leader on party create? I only get that info in the response? This is fine if it's the case, just wanted to make sure I understand it correctly.
  2. In the Party struct, presences is an array of UserPresence objects. Is there ever a situation where this array will have more than one item in it in the case of party creation? I'm assuming this is just an array because the class is reused in other places as well in during party creation, this array will always have exactly one entry, is that correct?

@novabyte
Copy link
Member

Do I not get a presence event with the leader on party create? I only get that info in the response? This is fine if it's the case, just wanted to make sure I understand it correctly.

@jonbonazza When one of the realtime features of Nakama is used they all share the same structural pattern of an initial state is returned (in the case of Parties its NakamaRTAPI.Party) and deltas (joins and leaves) which will be received from the event listeners (i.e. received_party_presence signal). Together it provides the most compact way to keep track of presences in that gameplay feature. When a Party is created the leader receives the initial state but will not also receive a signal on received_party_presence.

Is there ever a situation where this array will have more than one item in it in the case of party creation? I'm assuming this is just an array because the class is reused in other places as well in during party creation, this array will always have exactly one entry, is that correct?

The system is designed to batch presence changes so its possible (though in the case of Party creation - it would be a very small window of time) that the party is created and another player finds it to join (if its an open party) before the party creator then receives their NakamaRTAPI.Party struct response. In this case it would be practically unlikely to occur but the design must account for it anyway to avoid potential race conditions.

Can we move the follow on questions to a forum thread? 🙏

Hope this helps.

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

No branches or pull requests

2 participants