2048-multiplayer icon indicating copy to clipboard operation
2048-multiplayer copied to clipboard

Play with a friend feature

Open guillaumepotier opened this issue 10 years ago • 3 comments

Hi @EmilS,

First of all, thanks for your great 2048 multiplayer version! I'm using it a lot and having much fun with colleagues :)

I'm implementing a "Play with a friend" feature, much needed for us (currently, we savagely refresh browsers to try to find against each others..) on your code. Here is my first commit. Here, basically, what I have done:

  • Now users connect to sockJS on dom loaded, they trigger different events:
    • 'register' -> register their user-friendly 4 digits hash on the server, under their io connexion
    • 'play-friend' -> send a 4 digits hash of a friend, to launch a game against him
    • 'find-opponent' -> find a random opponent waiting too, the current feature
  • I reordered some code parts into function to be able to mutualize them in random mode or find friend mode.
  • I showed the stats all time, I find it quite fun. I distinguish now players on plateform, and waiters that await for a random match

This is working for me right now.

Now, what I'd like if possible:

  • your feedback on that (the principle)
  • eventually clone my work and test it, and have your feedback
  • if you like it, what should be done on this branch before you merge it

Best :)

guillaumepotier avatar Apr 24 '14 13:04 guillaumepotier

Wow this is awesome! I'll take a look at it when I get home tonight :smiley:

es avatar Apr 24 '14 14:04 es

Great,

In the meantime, this is what I think it is still needed on this branch, feel free tonight to add your checkboxes ;)

  • [ ] handle not found hash in the client (currently, there is no warning or whatsoever for the user)
  • [x] better UI for new vex modals (nice lib btw)
  • [x] variabilized sockjs url and game time in a distant config file
  • [ ] maybe some needed code refacto on both server and client
  • [x] use supervisor to run server
  • [x] remove indistinct letters from hash generation ? (eg: l and i, O and 0, ..)
  • [ ] handle hash conflict (rare, especially if hash has a faire length, but might occur ^^)

Best

guillaumepotier avatar Apr 24 '14 14:04 guillaumepotier

Hi there,

I suppose you did not had time to have a look yet at my implementation. This is still a mess, but I think I have yet something quite functional here: http://guillaumepotier.github.io/2048-multiplayer/

Best

guillaumepotier avatar Apr 26 '14 16:04 guillaumepotier