Add basic Guest play support
just a very basic implementation that gets guest play working
- guest vs guest (no db saves)
- user vs guest (no db saves)
- user vs user
if game contains a guest we wont save to the database this is because the guest is not a valid db user we might make a default user for that and save so in case of user vs guest scenario we can show the user his history (if shown in the future)
this is meant to kick things off
please share your inputs on this @hkirat and others
resolves #106
@hkirat if both players are a guest no need to persist to db right ? it really serves no purpose can we have this merged and take up persisting in another pr ? this at-least gets guest play kick started
if any one user is guest can we just point that to a "Default precreated guest user" ? also please explain more on what we will perform saving the guests
share your thoughts
@hkirat if both players are a guest no need to persist to db right ? it really serves no purpose can we have this merged and take up persisting in another pr ? this at-least gets guest play kick started
if any one user is guest can we just point that to a "Default precreated guest user" ? also please explain more on what we will perform saving the guests
share your thoughts
I think it's mostly needed, because you want to recover the game, if the user get's disconnected by mistake/internet issue, or refreshes etc.
we also need to allow them to share their games and replay it
We can just add guests in the User table for now with type set to guest
@N4r35h let me know if u'd like to pursue this further, if not I'll merge some parts of this and finish the rest
@N4r35h let me know if u'd like to pursue this further, if not I'll merge some parts of this and finish the rest
@hkirat I would like to pursue this just a few confirmations
Even if both players are guest we want to store to db ? We will have a user entry for each guest ?
@hkirat now we save guests to the database and persist the games
We can just add guests in the
Usertable for now withtypeset toguest
have a look and if it looks good merge it in
guest sessions are done via a separate jwt in a cookie called guest so if a guest refreshes the page or for example looses internet connection for a few seconds he can still rejoin and play
let me know if this seperate cookie route would be ok or if we have to hack it into the passport.js way not sure if that would be possible maybe with some weird custom logic like a GuestAuthProvider idk
below is a recording that showcases the guest session persistence so they can rejoin the match
@hkirat made the requested changes please have a look now
@hkirat should be good to merge, resolved conflicts
@hkirat could you please take a look at this PR ?
@hkirat any bounty for this ?