Clients should not broadcast currentTime updates when they are not the player #14
Labels
area: game runtime
Improvements to the core game experience.
good first issue
You can do this as a way to learn about the code! ❤
status: blocked
Other work must be completed before this is tackled.
type: cleanup
Improving the structural quality of code or runtime smoothness/performance.
Following #9: right now,
useTimeSynchronization
always sends video time updates to the server, no matter what:karaokenite-react/src/pages/room/RoomEvents/useVideoControls/useTimeSynchronization.ts
Lines 16 to 20 in 6c26f5c
However, the server only cares about updates from
room.player
:karaokenite-react/src/server/events/karaoke.ts
Lines 42 to 48 in ae0b71a
It's a waste of bandwidth for the client to constantly be sending
currentTime
updates if they've received a notice of room data from the server that includes someone else's ID as the player. Since the server (once #13 is resolved) informs clients there is no more player when the player leaves, clients would start broadcasting their time again when needed.Proposal: a client should only broadcast its
currentTime
if its ID matches the room data'splayer
.Sub-proposal: once this and #13 are in, make the frequency of
currentTime
updates something like 100 instead of the current 500, to take advantage of the reduced spam sent to the server.(Blocked on #13 being resolved)
The text was updated successfully, but these errors were encountered: