Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Simplest way to setup a leaderboard?

Author
Message
Oddyseous
2
Years of Service
User Offline
Joined: 31st Aug 2021
Location:
Posted: 1st Sep 2021 06:48
Hello i'm new to AppGameKit and i've been editing a one of the sample projects, was hoping to work on getting a working leaderboard next, what would be the easiest way to do this?
ruckertheron
7
Years of Service
User Offline
Joined: 12th Nov 2016
Location:
Posted: 1st Sep 2021 11:01
Are you trying to do this locally? or on the internet?
TamBam
12
Years of Service
User Offline
Joined: 29th Nov 2011
Location: India
Posted: 1st Sep 2021 11:07 Edited at: 1st Sep 2021 11:08
@oddyseous this is my YouTube video ( Hindi Language ) on High score https://youtu.be/GsaD5mwtNW0 local Pc/Android
hosch
Developer
2
Years of Service
User Offline
Joined: 25th May 2021
Location:
Posted: 1st Sep 2021 12:57 Edited at: 1st Sep 2021 13:17
I've recently set up a leaderboard for ORBITER. If you want to do everything yourself, there is no "easy way". You will need to learn PHP at least and SQL most certainly.

You will need:
- a php script to handle communication with your database
- a server to host your php script
- a server to host your SQL database

If you only want to save something like "name:score:name:score" in a text file and retrieve this information to further process in AppGameKit, you won't need SQL, but PHP. This would be the easiest thinkable setup, but is only viable for a small playerbase.

An alternative and most likely the simplest way would be to integrate the Game Center functionality , which comes with a default leaderboard. The downside to this is that your players would need to register for that.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2021 14:27
This is from an old project, the php should work off the bat

db install sql (I think this was the right one


config.php


add_score.php


get_score.php


And the AppGameKit functions,, these will not work off the bat you will need to create your own but this should give you some starter points






Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 1st Sep 2021 15:37 Edited at: 1st Sep 2021 15:38
this might be the simplest* online leaderboard: http://dreamlo.com/.

i found it recently but haven't tried from within AppGameKit yet (mainly because i would want to use it with an HTML export and the HTTP commands there don't seem up for it? if anyone gets it going under HTML, please advise?!).

*simple but not secure, if that matters to you.
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2021 16:37
You could create an account with me
https://purpletoken.com/register.php

Automatically handles tracking the top 20 scores, which you can view from your online account. Up to 4 leaderboards are supported per game (in case you want to keep devices like PC and mobile separate). It uses HTTPS to keep things secure.


@Virtual Nomad, if you want to use dreamlo then my code below might be of some help.

Example code
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 1st Sep 2021 18:55
Awesome stuff there Phaelax, I will certainly be looking into that, does this work from itch.io? I cant seem to get any sql stuff working from something hosted on itch, I had 4 apps connecting to a sql server, windows=fine, android=fine, html on local wampp server=fine, html on itch=fail, I think maybe itch blocks outgoing connections?

Quote: " found it recently but haven't tried from within AppGameKit yet "


HTTP does work in HTML I have had it running but your going to run into issues with MySQL access rights, local connections work just fine but remote connections (from free webhosts) are blocked so your going to need a dedicated sql server with remote access rights, any mid level hosting package should suffice, but if your game is hosted on the same server them it *should* work
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
hosch
Developer
2
Years of Service
User Offline
Joined: 25th May 2021
Location:
Posted: 1st Sep 2021 22:44 Edited at: 2nd Sep 2021 02:05
PartTimeCoder wrote: "HTTP does work in HTML"

Don't the docs say, HTML5 can't use http functionality? I didn't try it myself because of that. Edit: only true for SendHTTPRequest.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2021 22:55 Edited at: 1st Sep 2021 23:18
Quote: " but your going to run into issues with MySQL access rights, local connections work just fine but remote connections (from free webhosts) are blocked"


That shouldn't be an issue for my site. You're not remotely accessing the database, you're accessing a php script which connects locally to the database to retrieve results. Anything that allows an https connection should be able to use my site. It's essentially just a REST API. Though geared towards AppGameKit, I may add options on how the data is returned (xml, json, csv).


I made a demo (using my example code above) exported to html5. Press <space> to submit a new random score. Press <return> to retrieve the scores. So to answer the question, yes http commands work from HTML apps.
https://purpletoken.com/agk/thingy.html
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
hosch
Developer
2
Years of Service
User Offline
Joined: 25th May 2021
Location:
Posted: 2nd Sep 2021 02:04
Yes, you are right. This is only true for SendHTTPRequest for example and for obvious reasons.

Need to give PurpleToken a try for my next project then
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Sep 2021 03:10 Edited at: 2nd Sep 2021 03:11
thanks for the info and i will continue research. i really want things like THIS to work in HTML exports and when hosted on itch.io.

from that DNS lookup code, i use SendHTTPRequestASync() vs SendHTTPRequest(). could that be the issue?

i'm very unfamiliar with what and why things work/won't work but i have access to a semi-private API that works fine on WIN and Android for me but i like the idea of allowing others to retrieve the data without having to install anything...
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2021 03:59
@Phaelax, try your system from itch.io...

What you have is pretty much what I setup myself and used a remote access MySql, like I said it worked everywhere but itch.io, I am pretty sure they block outgoing connections, I'd like to be wrong, please prove me wrong
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Sep 2021 04:10
Quote: "it worked everywhere but itch.io"

could THIS be why? or, is that a cookie-only thing?
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2021 04:46
LOL, I bookmarked that thread last night with a plan to add highscores to my game but doubt I'll have time.

I'd say that only applies to cookies, I had a free server years ago that blocked outgoing connections to prevent you from adding 3rd party ads on your site, at a guess I'd say itch.io is doing something much the same, probably a security consideration, who knows, all I know is my project could communicate with the mysql server everywhere but itch, I gave up in the end the project is still sat in drafts, since then the shared vars were added but remember reading there was still issues on itch and found that thread last night ... have yet to try it though.
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 2nd Sep 2021 06:17 Edited at: 2nd Sep 2021 06:20
i thought conjured had html stuff going on itch.io for last year's lowrez jam but seeing his final post in the thread, i'm not so sure.

now i just remembered that there's a (less-visible but legit) way to play itch.io games outside of an iframe and/or without AWS IIRC. i'll look at that.
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2021 12:41
Quote: "but seeing his final post in the thread, i'm not so sure."


That explains it, oh well I guess itch is good for a showcase but if we want full access and control we need our own server ... GoDaddy it is then lol
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Sep 2021 15:35
I tried itch.io, but I can't get the application to even load. I get 403 responses on the resources.

"Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object."
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2021 18:04
I got a few draft projects on itch.io (I do a lot of testing, not a lot of publishing) and never seen that error, very odd!
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Sep 2021 18:07
You just export to html then upload the files, right? There's nothing else I'd have to setup on itch is there?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 2nd Sep 2021 19:11 Edited at: 2nd Sep 2021 19:13
Export the files, rename the main html file to index.html, zip it up and upload, itch.io settings mostly are for visibility and display port, comments, nothing in there that would stop the game from running
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Sep 2021 02:04 Edited at: 3rd Sep 2021 02:15
I didn't zip it or rename the file. It let me choose which file is loaded. But I'll try all that to see if it matters.

Apparently that does. I still get some warnings in the console, but it loads. When I attempted to submit a score to PT, I get this error:

Quote: "Access to XMLHttpRequest at 'https://purpletoken.com/update/index.php' from origin 'https://v6p9d9t4.ssl.hwcdn.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."


I've configured the headers on my site to allow it. I've tested this with itch.io and it now works!
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 3rd Sep 2021 02:31
Quote: "I've configured the headers on my site to allow it. I've tested this with itch.io and it now works!"


That is frigging awesome, will be adding this to my game (and every game) for sure, nice work Phaelax
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee

Login to post a reply

Server time is: 2024-03-28 20:09:49
Your offset time is: 2024-03-28 20:09:49