Create "login" screen and save user data

I’m looking for a way to make a sort of login screen. Doesn’t need to be complicated, just something that on the first time loading the game it asks for a name and when the user plays again says something like “Welcome back [insert name]”. I’d also like to implement a sort of daily or timed bonus thing, where the user can only claim the bonus once every few hours, and with every consecutive login/claim the bonus gets better. I was looking at what @will was saying in this post: Is it possible to make it to where the player can save and load his game progress?. It seems like a good approach, but I thought I’d get some extra opinions before settling on anything.

You should implement it using HTML tags over the canvas of PlayCanvas, as PlayCanvas doesn’t have an input box to type text.
You can start from these examples:

you could ask the devs that made , they implemented FB and twitter api login to save user data

welp that game is having issues right now I think is the correct link :wink:

1 Like

Neither of them work? :face_with_raised_eyebrow:
I can’t even get to it from the explore section on the homepage. works fine for me. Do you have a browser extension blocking it? Try the https version

I just get this:

I disabled adblock, and my firewall shouldn’t be blocking it.

1 Like

How bizarre. Not sure what is up with that then :thinking:

Yeah, I think the US server is down. The EU one is OK, I believe. When we get some time, we’ll bring it back up. Sorry for the inconvenience.

Ah, that would make sense.

will there be a GitHub repository on the PlayCanvas organization for

No, we don’t have any plans to open source the game.

1 Like

o ok, it would be intresting if it was open source

Is this still down? I still can’t connect to it so I’m assuming it is.

wow its still down

Yup, still nothing. Anyone got any other examples for making some sort of login/user data storage?

If you only wanna do simple things like keeping track of a Username or points you could simply use Cookies for that.

Cookies can be easily “hacked” tho, but if you don’t mind, it would be the easiest route.

Simple tings, ye, but I would rather avoid cookies. I don’t want any sort of complicated login system, like a facebook/twitter thing, or anything that would need an email at the moment. The best approach I’ve seen is probably how @will has it in accelerally using local storage, but I haven’t been able to get it working in my project.

Oh I didn’t know about localstorage lol.

What problems have you been having? The code to use localstorage seems pretty simple! :slight_smile:

This is how he calls the local storage:

if (localStorage) {
        var storedBestDistance = localStorage.getItem('accelerally-best-distance');
        if (storedBestDistance !== null) {
        this.bestDistance = parseFloat(storedBestDistance);

The part I’m having trouble with is more so understanding it. The local storage item 'accelerally-best-distance' is he creating here as well as looking for it, or does he make it somewhere else?