Comment

Comment by tom32i

Thanks!

Reconnection relies on two mechanisms:

Server side — Secured client identification: When you connect to the game, the server forges and sends you a unique secure token. If you lose connection, your client and player data on the server aren't removed but just "parked" into an offline list of clients. Your player is left without a pilot for a moment. As soon as you reconnect with a valid token, the server is able to restore your client and plug you back into your player's controls. You're back in the game!

Client side — Ubiquitous game data: For reconnection to work on the player's end, I also need every client arriving in the middle of a game to get the exact same state as a client that connected from the start. This means sending every connecting client all the meaningful data about the current game: state, player positions, speed, size, ongoing bonus positions and timings, etc. I designed the game with this requirement from the very start: each new feature must follow this pattern, and the client must support building the game's world on the fly from this data.

parent tom32i 4 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton