player is global when run locally
nquinlan opened this issue · 7 comments
Let me preface this with the fact that I am an absolute novice when it comes to DFINITY, the Internet Computer, and Motoko.
However, when I follow the installation instructions and open the frontend on my machine, it allows me to create a game, but when I load the frontend in an incognito tab or on a different device, I'm presented with a screen insinuating I'm the player who created the game. Example below:
$ dfx start --background
$ make install
- Load canister URL
- Create game, Player 1: Nick, Player 2: Rick
- Open incognito mode, load canister URL. I'm presented with the following screen.
This is different than the behavior I see when I open your online example application. What I am I doing wrong and/or what would I need to do to enable the multiplayer capability of the game?
$ dfx --version
dfx 0.6.14
Thanks for reporting the problem. I've yet to try the new SDK, but the example app I hosted myself was using version 0.6.4, which was several months old. Meanwhile I guess you can always open two browsers.
Thanks for your response! I really appreciate it on a demo app!
I don't think it's a browser issue. I've gone so far as to open the app on a different device and it still just assumes that I'm the original player.
In the meantime, I'll try it at SDK 0.6.4 and see what happens.
Thanks again. You rock! 👨🎤 😃
It worked with sdk@0.6.4. I made a PR to update the dfx.json
so that anyone trying to run the app locally gets a working version.
Just tried with dfx 0.6.21, Firefox web console says there is an exception when I try to load the game from a private window. But I have no problem playing as two players, one from firefox, and the other from microsoft edge.
Something like this:
Uncaught (in promise) DOMException: A mutation operation was attempted on a database that did not allow mutations. index.ts:91:8
<anonymous> index.ts:91
(Async: promise callback)
<anonymous> index.ts:84
Webpack 3
Also no problem playing as two players using just Microsoft Edge (which is essentially Chrome), one from a normal window, another from a private window.
The problem is fixed by creating identities stored in browser local storage.