Online Leaderboard
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Online Leaderboard
Hi everyone,
I have been creating a game for Android and I would like to implement a public leaderboard. I was wandering if anyone could offer any suggestions in how to go about this. The ideal one would be to be able to use google play services, as this could then also be used for iOS, however I don't think this is possible with Livecode. So is there an existing service which I could integrate, or alternatively is there a way in which I could set one up for my game. Preferably if I were to use the second option, could it be as simple as possible and also free to maintain.
I would only want to store a username and score so it doesn't need to be too complicated.
Thanks
Matthew
I have been creating a game for Android and I would like to implement a public leaderboard. I was wandering if anyone could offer any suggestions in how to go about this. The ideal one would be to be able to use google play services, as this could then also be used for iOS, however I don't think this is possible with Livecode. So is there an existing service which I could integrate, or alternatively is there a way in which I could set one up for my game. Preferably if I were to use the second option, could it be as simple as possible and also free to maintain.
I would only want to store a username and score so it doesn't need to be too complicated.
Thanks
Matthew
-
- Posts: 35
- Joined: Sun Sep 09, 2012 1:09 pm
Re: Online Leaderboard
Well unfortunately the Google Play Services isn't integrated with LiveCode so you can't use any of those free services. I was originally planning on releasing a library stack that would allow easy leaderboards, but that would usually eat up resources (still contemplating on that).
In terms of doing this yourself, a simply method that I use would be to use an SQL database that you manipulate with a web page/API setup.
In terms of doing this yourself, a simply method that I use would be to use an SQL database that you manipulate with a web page/API setup.
Re: Online Leaderboard
Would anyone be willing to provide some guidance on this, as although I am quite proficient in coding I am not confident with databases and webpages etc. Even just to maybe explain the structure of how I should run it, as I don't want to have to overcomplicate my app if it means having to download a lot of data each time a user wants to access it.
Thanks
Matthew
Thanks
Matthew
-
- Posts: 73
- Joined: Mon Nov 12, 2012 4:13 pm
Re: Online Leaderboard
My suggestion for an online leaderboard:
Two pages, submit_score and a leaderboard page. In your app create a post to submit_score with username and score, on the server-side you need to create atleast two other values date and ID (I would recommend PHP, it's pretty easy. If you are going to use PHP please use PDO). And to display the leaderboard make a webview (easier) or parse XML from a webpage and display in app.
Post to server: http://forums.runrev.com/viewtopic.php?f=49&t=10747
PDO: http://www.php.net/manual/en/pdo.connections.php
Two pages, submit_score and a leaderboard page. In your app create a post to submit_score with username and score, on the server-side you need to create atleast two other values date and ID (I would recommend PHP, it's pretty easy. If you are going to use PHP please use PDO). And to display the leaderboard make a webview (easier) or parse XML from a webpage and display in app.
Post to server: http://forums.runrev.com/viewtopic.php?f=49&t=10747
PDO: http://www.php.net/manual/en/pdo.connections.php
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Online Leaderboard
Hi Matthew,
I'm unclear if you want an updatable in-game leaderboard or a web page that people visit?
Assumption, you actually have a server to read from and write to, in-game results.
Around the openCard (not openStack as the internet library must be loaded first) you download a text file with current leaders
John 2599
Betsy 2030
Mat 7
at the end of a game compare the score with word 2
repeat for each line tLine in highScore
add 1 to i
if i >= 4 then exit repeat
if if myScore > word 2 of tLine then
put myName && myScore into line i of highScore
exit repeat
end if
end repeat
save the file blah blah
post the file to the server
http://forums.runrev.com/phpBB2/viewtop ... =8&t=19144
Yes, with thousands of users there can be collisions (download while someone is uploading), so maybe a mySQL would be better.
Simon
I'm unclear if you want an updatable in-game leaderboard or a web page that people visit?
Assumption, you actually have a server to read from and write to, in-game results.
Around the openCard (not openStack as the internet library must be loaded first) you download a text file with current leaders
John 2599
Betsy 2030
Mat 7
at the end of a game compare the score with word 2
repeat for each line tLine in highScore
add 1 to i
if i >= 4 then exit repeat
if if myScore > word 2 of tLine then
put myName && myScore into line i of highScore
exit repeat
end if
end repeat
save the file blah blah
post the file to the server
http://forums.runrev.com/phpBB2/viewtop ... =8&t=19144
Yes, with thousands of users there can be collisions (download while someone is uploading), so maybe a mySQL would be better.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Online Leaderboard
Thanks Simon, to clarify I want a leaderboard which can be updated which appears within the app.
Could you please provide some guidance on how I would do it with SQL, I know there are lessons on how to upload etc. but how would I insert the records, as if it was listed in the correct order on mySQL then surely I might have to sometimes move everything down by 1 row, how?
Thanks
Matthew
Could you please provide some guidance on how I would do it with SQL, I know there are lessons on how to upload etc. but how would I insert the records, as if it was listed in the correct order on mySQL then surely I might have to sometimes move everything down by 1 row, how?
Thanks
Matthew
Re: Online Leaderboard
Simon,
I have tested your suggestion just using a field rather than saving the results to a file, however I was hoping to be able to create a leaderboard which contained all entries, not just the top 3. Sorry if I caused confusion.
I have tested your suggestion just using a field rather than saving the results to a file, however I was hoping to be able to create a leaderboard which contained all entries, not just the top 3. Sorry if I caused confusion.
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Online Leaderboard
Hi Matthew,
Simon
Ahh yes, missed thinking of that.move everything down by 1 row, how?
Code: Select all
put myName && myScore & cr before line 3 of fld 1
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!