-
-
Notifications
You must be signed in to change notification settings - Fork 16
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 Singleton (NetworkCommonData
) to store important immutable variables (player_id, session_id)
#256
Comments
Ok so If I read you right, the proposed fields are:
I'll consider these given the way netfox is structured:
The other two addons are not important in this discussion atm. Player IDThis is pretty much game specific - some games need it, some don't. For example, Forest Brawl doesn't need it either, even though it has a score board. I wouldn't include it in core, as it would introduce another concept that is barely different from what Godot already provides. If we want to refer to specific peers, Godot has the peer ID's for those. In some form, it might make sense to be included in Session IDThis is extremely game specific. And even then, the server can generate a random ID and share that with peers as they join. Of course, I understand that it would be best if netfox just had everything out of the box :) But atm I don't see a session ID needed frequently enough to warrant it being implemented. With that said, I'm happy to include it if there's considerable need from the community.
In that case, the replay system can manage the session ID :) Not sure what you mean with save files though. Joined at
I imagine the replay system as its own, separate thing, that extracts all the data it needs from netfox's other APIs. However, I'll check your state diff PR to see how it relies on this data. Until then, consider this being considered :) AvatarAgain, game-specific. Some games have avatars, some have lots of units moving around, some have things with shared control, etc. Similarly to Session ID, definitely wouldn't include in core, maybe in extras if there's need for it. Another example for it being game specific, is that games may handle player concepts differently. For example in the game I'm currently building, I started off with an Avatar(-adjacent) concept, but eventually I'll move to Players who join games, and who have avatars. So the local avatar is not very useful, the local player is. And for that I'd prefer my own system. This is not to say that nobody would prefer a system provided with netfox.extras, just that I have an example :) Anyway, I'm open to people commenting on this, whether this is something they'd find useful or not. |
Yes, this isn't meant to be in the same level as Avatar, yes, you are right, that's why it's just 1 line in the OP 😅 To synopsize, basically the PR #269 to be implemented in Netfox.extras (assuming the ID thingy is settled) |
Closing this issue for now, I don't see enough demand to add these in addition to the justifications in my previous comment. Same for #269. One addition to Player ID - I think clients can also determine this just by checking |
Once a player joins, he has access to
multiplayer.get_peers()
to get the peer ids.However, almost every online game requires
player ids
at some point. Most commonly in videogames, there is a player table, with their IDs to the left (think pressing Tab in FPS, or RTS lobbies before starting a scenario/map)The usage of a player id should be included with netfox, and stored in a singleton, let's name it
NetworkCommonData
It currently has:
player_id
is also useful in serialization and deserialization, as it's only 1 byte (may I say, half a byte, since 0-16 is the common)compared to sending
peer_id
(4 bytes, u_32)A good practical example is also sharing IDs. See #242 and its solution which requires having the player id.
session_id
is useful for the server, to store replays, or save files. Personally for the replay manager I have made, I use this to store replays in the following pathuser://gamenamefolder/Session_ID/replaydata.replay
and I plan to implement a similar system to netfox, and session id is required.
The variable
player_joined_at_tick: int
is required for the replay system, and for implementing state diffs. So our above singleton now looks like this, in its final form:This singleton's values are filled before/after
NetworkTime.is_initial_sync_done()
The text was updated successfully, but these errors were encountered: