Skip to content

Instantly share code, notes, and snippets.

View Reco1I's full-sized avatar

Gerónimo Ferruccio Reco1I

View GitHub Profile
@Rian8337
Rian8337 / multiplayer-server-socket.io-events.md
Last active July 18, 2023 06:04
Multiplayer Server Socket.io Events

Back-to-back client-to-server events

Some events should only be sent if the player is the host. The server will resend these events with the same name back to all clients. That's when the UI should be updated to reflect room state.

beatmapChanged

Emit when the host changes the beatmap, accepts a beatmap structure with artist, creator, md5, and version (not sure if this is possible to do in the client, if not please let me know). the structure is optional, if omitted the room will turn into a "changing beatmap" state.

hostChanged

Emit when the host of the room was changed, accepts the new host's uid as a string (because 64-bit integer is not possible to represent in javascript lol).

playerKicked

Emit when the host kicks a player, accepts the uid of the player who was kicked.

playerModsChanged