mwpenny / gbplay

Internet-enabled GB/GBC multiplayer using original hardware
https://blog.gbplay.io
GNU Affero General Public License v3.0
19 stars 4 forks source link

Investigate recovering from mid-game disconnect #5

Open mwpenny opened 2 years ago

mwpenny commented 2 years ago

If a player disconnects for some reason, we currently kill the game session due to its stateful nature.

It's worth investigating the feasibility of suspending and resuming a session. For instance, some games allow the master GB to pause the game.

With this in mind, one idea is to send the bytes necessary for pausing and unpausing to each client on game start. Then, both clients could pause the game on disconnect and unpause on reconnect. We could combine this with auto wifi reconnect (#4).

This may be more trouble than it's worth and won't work in all situations (e.g., both GBs exchanging a large buffer). It also assumes that a disconnected player doesn't restart their game (although maybe the server could detect this). It could help a lot with turn based games though.

mwpenny commented 2 years ago

If we decide to not support this, we can use a similar approach to simply notify players that a disconnect has occurred by configuring each client on game start with the necessary bytes to trigger such a notification.