- Home /
Remote database for leaderboard
Hi!
I am trying to implement a leaderboard for my game in Unity. I found a tutorial on youtube that explains how to do that if you have a server that is hosting a database, using the WWW class to GET or POST to certain scripts on the server.
My problem is that I can't really host that server 24/7, so I found a couple of services that offer free databases. One of them is https://mlab.com/ for mongoDB and i also found one with mySql. My question is how can I implement those things since there is no server kind of (hope i explained correctly).
Also, is there another way to do a leaderboard to see all players' scores? (with login an stuff). Maybe what I am trying to do is a lot more complicated than what I need.
Is there another way, with logins? I would think that logins are the only way to do it anyways (as you'd need to save user scores onto a server, and the only way to match scores with the proper user would be to use some form of identification). If you plan on using s$$anonymous$$m, you could definitely try S$$anonymous$$mWorks to grab a user's STEA$$anonymous$$_ID (as a login), and upload them to the S$$anonymous$$m Cloud, where you can use servers. I've personally never worked with servers (although I will soon), but hopefully this could lead you to the right direction.
Answer by Tobychappell · Jun 30, 2018 at 08:30 PM
This is aimed at (with login an stuff)
I know this may not be the answer and probably over the top, if this is relevant, but one very important step in doing this is planning how to be GDPR compliant before writing a single line of code when creating a logging in system that may store identifiable information about someone. If it isn't going to store any identifiable information then I reckon you're okay if not then there are some things to consider :
Will they be logging in with an email account?
How will you protect the data transfer from client to server that contains sensitive information?
What if they forget their password?
How will they be able to prove they own that account?
How will you monitor the database for any breaches?
If your database gets breached, how will you notify all users?
How will they be able to access the Privacy Policy?
How will they be notified if the Privacy Policy gets updated?
That's just off the top of my head, there are people that know loads more about this than I do.
Yeah, i thought about all that stuff, but I am a beginner, and I am just doing this as a project. I know that there are a ton of security breaches such as sql injections or even somebody creating one million accounts just because he can. What i did for now only asks for a username and a password, and then registers the account.
Also, another option that I thought about is registering the highscores like in an old arcade machine. When the player dies, just ask for a name (not unique stuff) and register it in a table. Also, the table can have a limited number of entries, so it's less vulnerable to going to extreme dimensions.
Ah right cool, wasn't trying to scare you off, just didn't want you getting bitten.
Your arcade option sounds good.
Are you familiar/experienced with connecting to a database?
Answer by CardboardComputers · Jun 30, 2018 at 09:11 PM
Hello!
If you can't host your own server, you'll have to find someone to do it for you. As far as I know, that generally means you'll have to rent a server, since most people don't let you run their machines 24/7 for free.
However, for testing/development purposes, I would recommend you download something like WAMP or XAMPP onto your local machine (in fact, for most of the development, I would recommend not using a release server). These packages come with a webserver host, a PHP environment, and at least one database environment; in both of the above it's some form of SQL. Once you set all that up on your local machine, you can send requests (preferably POST for security reasons) to your PHP server to read/write your database.
If you're keeping a database, you probably don't really need to limit the size, especially if you're just keeping a score and a name.
I will say, I don't think there's a better way than a remote database to keep a persistent and consistent leaderboard.
In any case, you absolutely need a server of some kind in order to do database-related stuff, even if it's just on your local machine; again, if you can't keep one running and you need the database to stay running, consider renting a server for the release version. If you can find a free service, of course, that works too.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
SocketException: No connection could be made because the target machine actively refused it. 0 Answers
[UNET] Only spawn certain server objects on local client? 0 Answers
Server always online ~ powered by website? 1 Answer
Switching weapons in PhotonNetwork 1 Answer