foxssake / netfox

Addons for building multiplayer games with Godot
https://foxssake.github.io/netfox/
MIT License
341 stars 14 forks source link

Implement player id and session id #269

Open TheYellowArchitect opened 1 week ago

TheYellowArchitect commented 1 week ago

This is the implementation of #256 which also solves #242 and #238

player_id is used here for projectile IDs. Though I place this in draft because fire() should become fire(avatar_player_id) so as to generate the unique id via the new method. But there is a conflict. The fire() input must be invoked by other players via input (so it should be THEIR player id, not local player id) and currently it fires only locally (the bomb projectile is synced via state, not by invoking the input fire()).

In simpler words, it stays as draft because a slight input refactor to have fire input passed into _inputs #253 is more important than this PR.

Anyway, as for player_joined_at_tick, it's not included here as it would make this class bloated and would have to introduce race conditions.