bstnfrmry/hanabi

re-opening /[gameID] link opens as another player?

indraneel opened this issue · 2 comments

Hi all, great project! Really been a lot of fun to play during this pandemic.

Ran into this issue and wanted to check to see if it was resolvable (and it totally might be user error):

When running a game, we'll sometimes run into an issue where one player refreshes or closes/reopens the tab (we are trying to play asynchronously during the workday, so this tends to happen), and when the game loads, they are suddenly playing as another player.

Skimming through these files https://github.com/bstnfrmry/hanabi/blob/master/src/pages/%5BgameId%5D/index.tsx#L14 https://github.com/bstnfrmry/hanabi/blob/master/src/lib/session.ts I'm not sure how session IDs get loaded, but I guess I'm wondering if it's technically possible to select a player on game-reentry instead of being forced into a player ID?

I'm happy to help contribute, but wanted to see if this was even a possibility from somebody who understands the architecture better than I do.

Love the game and will keep playing it regardless.

Hey! Thanks for reporting the issue.

So theoretically, when opening your first game, you get assigned a unique player ID which is stored in the session. This ID will be reused between game, allowing you to rejoin a game you closed (since the game URL doesn't change and doesn't contain your player ID).

What could have gone wrong:

  • If you change browsers (or devices), you'll lose your player ID and get assigned a new one upon rejoining the game. I guess if you're playing async, you might sometimes switch between your computed and phone, which might trigger the issue.
  • The session might expire. I'm not 100% sure how long it lasts but I'll look into it. We haven't made a lot of asynchronous tests.

In any case, your solution might work! For instance, when joining a game that's full, if your playerId is not one for the game players, the game might prompt you to join as one of the players (or simply spectate).

Feel free to give it a go if you'd like. Otherwise I'll see what I can do in the upcoming weeks.

And thanks again for the feedback, it's always much appreciated 😊

Hi all! Really love this game, and literally play it every week with my team.

It's always been a little buggy, but that was always fine because the game still worked and we know this is a free side project - we still love it!

This issue ^^ happened from time to time, but it was fine because if you reloaded a few times or opened in a private tab you could eventually get back to your own player.

Lately however, it will treat you as an observer (?) I think because you see both sets of cards, and can't play any longer. No matter how many times I try to reload, use new browser, incognito mode (in Chrome), private window (in Firefox) - I'm stuck without the ability to play.

Today, I just reloaded the tab (because sometimes it doesn't show the other persons move right away), and now I can't play the game anymore. It's happening so frequently that it's getting hard to play a game from start to finish. Any fix to this coming any time soon?

Posting here because I think the same solution would fix this as well (choose to play as a player or spectate if coming in with a new playerID to an existing game).