MrStahlfelge / gdx-gamesvcs

Easy integration of gameservices in your libGDX game: Google Play Games, Apple Game Center, Amazon GameCircle and more
Apache License 2.0
113 stars 20 forks source link

Kongregate: fetch leader board entries #13

Closed MrStahlfelge closed 7 years ago

MrStahlfelge commented 7 years ago

After integrating fetch leader board entries and achievements status in core (issue #4), it now has to be implemented for Kongregate client.

MrStahlfelge commented 7 years ago

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

MrStahlfelge commented 7 years ago

Fetching the stats did not work because of CORS restrictions. Another Kongregate dev also had the problem and described it very well here:

https://www.kongregate.com/forums/4-game-programming/topics/686429-retrieving-statistics-for-displaying-in-game

"Solution" there is a workaround that needs an own server. Kong should just add the missing header information => support@kongregate.com

mgsx-dev commented 7 years ago

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.

MrStahlfelge commented 7 years ago

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,

mgsx-dev commented 7 years ago

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 :-)

MrStahlfelge commented 7 years ago

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.

MrStahlfelge commented 7 years ago

I have mailed Kongregate about the problem, but do not expect an answer. Closing this for now.