-
-
Notifications
You must be signed in to change notification settings - Fork 20
Kongregate
Kongregate is a game page for serving Flash and HTML5 games and by that capable to distribute libGDX GWT games. It is mainly interesting for its good monetization: Players have to view an ad before the game starts, the revenue is around 1 ct per 10 plays.
Kongregate provides a working JS library for accessing its API. So the KongClient is very lightweight.
Kongregate API supports the following features:
- Leaderboards (called Highscore)
- Events (called Statistics)
Kongregate grants achievements to users - they are called badges -, but you are not allowed to define them yourself. If your game is a chosen one, Kongregate Team will define badges for it based on your events/statistics. Best approach is to define statistics for your achievements, and for that KongClient
calls submitEvent with value 1 when you callunlockAchievement()
.
You define the events and scoreboards via its "Statistics" page. Add /statistics to your game url and go on.
See also: http://docs.kongregate.com/docs/concepts-statistics
Include the Kongregate implementation in your build.gradle
for your HTML5 project:
compile "de.golfgl.gdxgamesvcs:gdx-gamesvcs-html-kong:$gamesvcsVersion"
compile "de.golfgl.gdxgamesvcs:gdx-gamesvcs-html-kong:$gamesvcsVersion:sources"
Add Kongregate's JS library to your webapp/index.html:
<script src='https://cdn1.kongregate.com/javascripts/kongregate_api.js'></script>
Now you can use KongClient
in your HTMLLauncher
class. You don't need any specific Kongregate initialization, Kongregate's JS library does this all for you.
Because Kongregate lets you define the statistic IDs yourself, you even don't need to define a mapping for calling unlockAchievement()
, submitToLeaderboard()
and submitEvent()
.
You can check if your game really runs on Kongregate before instantiating KongClient
. You can do so by checking Window.Location.getHostName().contains("konggames")
. This is not needed, but might be useful if you want to release the same build on different hosting sites.
While you can submit events and therefore these interesting data exists at Kongregate, they don't grant us developers a way to query it for analysis. Only stats for you to see are the ones on the (well-hidden) stat page you get when you add /dashboard/game_statistics
to your game url.
For leader boards, it is possible to show the entries on your game page for every user. Kongregate also provides a REST API to fetch the data, however, due to access restrictions it is not possible for your HTML5 game to do so. You can bypass this by tunneling the API call through your own web service: More information. The Kong API implementation reflects this by returning false
when calling isFeatureSupported(FetchLeaderBoardEntries)
, but fetchLeaderboardEntries
can parse an API call result to your own service which you define by overriding the buildQueryStatRequest()
method.
Check the open issues for Kongregate