- Home /
Simple online high score
Hi there! I'm teaching myself Unity, and just figured out how to get a high score saved under Player Preferences. However, I notice that when being played in a webplayer, the high score stays local to each machine-- therefore I can't challenge people to beat my high score.
Here's the current state of the game.
Is there a simple way to 'host' a high score online? (right now the files are hosted through my personal website). I've seen people talk about doing stuff with SQL databases, but that seems needlessly complicated. Or maybe it isn't? Thanks in advance!
Answer by Sildaekar · Mar 10, 2014 at 07:17 PM
The easiest way to do it:
Create a simple MySQL database that contains fields for:
The User
Their score
The time the score was logged
Then create a simple PHP file that retrieves input from a GET parameter, use those parameters to check the database for the user (or create him/her) then update the score and the time.
Done! :D
But keep in mind this is very simple method of doing so, and it would be best to add some sort of authentication method to tighten security and keep people from cheating.
EDIT:
There are other ways to go about it (ex. flat files, access database, etc etc) but this is probably the easiest method as you could simple make a call to the webpage (using WWW) like http://localhost/updatescores.php?user=SomeRan0mGuY≻ore=9999&time=031020141419
haha it doesn't sound simple but I'll give it a try. Thanks!
No problem
If this answered your question please don't forget to mark it as correct. :)
hey so this probably seems incredibly basic, but I can't figure out where the web address of my SQL database is (I'm using php$$anonymous$$yAd$$anonymous$$ through iPage. Where do I find this? Thanks.
Answer by mole1984 · May 06, 2016 at 03:47 PM
Look at this tutorial. Its free and simple https://www.youtube.com/watch?v=UvKLmQ6VAtg