Kongregate: fetch leader board entries
MrStahlfelge opened this issue · 7 comments
After integrating fetch leader board entries and achievements status in core (issue #4), it now has to be implemented for Kongregate client.
https://docs.kongregate.com/docs/server-api-high-scores
When relatedToPlayer is set to true, implementation should use friend's high scores.
https://docs.kongregate.com/docs/server-api-friends-high-scores
Fetching the stats did not work because of CORS restrictions. Another Kongregate dev also had the problem and described it very well here:
"Solution" there is a workaround that needs an own server. Kong should just add the missing header information => support@kongregate.com
Since kongrate is for HTML, your already have a server. You can then make the call on server side changing the requests origin to match CORS.
An own server is not available in every case. Sure, you can host the game on your own server, and then you can use the solution from the link. But the little indie-game is normally hosted directly on Kongregate. One might think that would solve the CORS problems; but it does not because games are hosted on konggames.com, the API on kongregate.com. :-/
It is an easy change for Kongregate to add this one header line, so I will just ask for it (and I am also curious how their support works).
I will add the code for fetching the stats to KongClient in any case, but it won't work without an own call-through server if they don't change the behaviour,
Ah OK i just discovered it doesn't require a server to deploy libgdx HTML5 projects when you don't use RPC ! Amazing, I wasn't aware of that. So indeed you need a local proxy for development in your case. It answer another question then : gpgs desktop won't run for HTML5 (it running a local server in the desktop app for the OAuth handshake), it's needed to develop another client using REST API from client side.
And for the konggames.com / kongregate.com mismatch, indeed ... shame on them :-)
Yes, indeed shame of them. Kong's API is the least mature of all the API's I implemented (also, the whole publishing process for your game also is). It is really sad given the fact that releasing a Webgame on Kong is a must. GameJolt shows what is possible, but at least Kong's service is working generally and they are providing a useable js library (while Newgrounds API is just not working correctly on HTML5 and no one is interested - perhaps they will notice 2020).
I also discovered desktop-gpgs will not work on html platform, but Google provides a JS Client Lib for Play Games which could be used with JSNI calls. Just a piece of work to do.
I have mailed Kongregate about the problem, but do not expect an answer. Closing this for now.