Oliver-Akins / Phantom-Ink-Online

The online prototype for Resonym's game titled Phantom Ink.
http://phantominkgame.com/
6 stars 2 forks source link

Player Disconnections #20

Closed Oliver-Akins closed 3 years ago

Oliver-Akins commented 3 years ago

How do we want to handle player disconnections for this? There's a way I could allow re-joining based on the device, but it is something that I've never implemented before and could take a fair amount of trial and error before it would work, or another solution is to dissolve the game if they are a spirit or if there are no more mediums connected on that team.

Ultimately the game dissolving would most likely be the easiest course of action, but not per-say the best course of action in the long run if we want to be making this largely public, which from my understanding is not really the intent with this version of the site.

(cc: @Ramenhotep )

Ramenhotep commented 3 years ago

Yes public release isn't a priority with this prototype. My one issue is that we do plan to use this for streaming/to give to reviewers, and I would hate for a disconnect to ruin a game in the middle of a stream (especially something like an accidental 'back'

Would it be easier to do let anyone rejoin in the vacated role? I guess my question is: is the challenging part telling if the rejoining device is the same one, or allowing them to rejoin at all?

Oliver-Akins commented 3 years ago

Ah, okay, yeah, having it potentially dissolve a game for reviewers would not be very good. The hard part of allowing re-connecting is syncing the state of the game. There is a possible way to implement an endpoint to sync the gamestate to ensure that everything is as it should be, but I can definitely add that endpoint in which should make allowing re-connecting easier.

Oliver-Akins commented 3 years ago

Okay, the way I've decided would be the best to handle this is to allow any player to join mid-game, so long as they have the same name as the disconnected player, this will entail checking to see if the player's socket is still connected and if so forbidding joining the game as well as having a event listener for syncing game state to the client for whatever device they happen re-join on. (this will cover the case where someone may join the game initially on laptop A but it crashes so they re-join on laptop B)

I will note: This re-connecting capability will not be advertised on the site to prevent people from attempting to join random games with random names, reducing the strain on the server. It could be included in a "reviewer package", but having it listed on the site could potentially be drawing undue attention to spamming the websocket server.

Ramenhotep commented 3 years ago

I think that works great!