Game Jolt API C++ Library
v1.2.0
|
Game Jolt is a host for free independently developed computer games.
As a gamer you are able to play every game on this site for free, rate them with shiny stars, write awesome comments, get trophies and highscores and talk about stuff on the forum or the chat.
As a developer you can upload your game, add screenshots, embed videos, write news, receive feedback, eat pizza and do other great things.
And if your game is written in C++, then this library is able to connect your game with Game Jolt.
(for other languages/engines/platforms take a look here)
The current library is available from Game Jolt and contains all necessary files for Windows x86/x64, Linux x64 and Android. For OSX you may need to download the latest cURL library.
You also need to create an account and upload your game to Game Jolt to retrieve a game ID and a private key.
Currently there are no build scripts implemented, all source files are distributed raw. You simply need to add them to your project build (source folder), compile them with C++11 support,
and link with the cURL library (libraries folder, incl. include). Alternatively you can include the gjInline.h file.
Supported compilers: GCC/MinGW 4.7+, MSVC 10.0+, Clang 3.3+
Current Update Notes are available here.
This library provides full access to the functions of the Game Jolt API.
At the beginning you simply need to create an API-object in your game with the ID and private key from the achievements-tab of your game's dashboard.
After that you have to update the API-object in your main loop. This is very important when sending non-blocking requests.
(https://gamejolt.com/api/doc/game/sessions/)
Currently a session only shows which games everyone plays at the moment on Game Jolt. This feature is still new and will be extended in the near future.
The library starts the session after logging in with an user and updates it autonomously, but you can set the session status manually to active or idle.
(https://gamejolt.com/api/doc/game/users/)
Users and all their data can be fetched from Game Jolt by either knowing the user name or the user ID.
There is also an integration in the score class to easily fetch the associated user.
(https://gamejolt.com/api/doc/game/trophies/)
Trophies are achievements. You can create them on your game's dashboard, and include the appropriate triggers in your game.
Currently it's not possible by the API to retrieve trophy data without an user login.
Also you have to define the sorting, secret trophies (only display after achieved), and hidden trophies (never display) by yourself.
(https://gamejolt.com/api/doc/game/scores/)
You can fetch all or specific score tables from the API and add new score entries to them or fetch existing score entries from them.
Score tables are also created and managed on the game's dashboard. There are several properties available, to customize their behavior.
Score entries are assigned to users or guests, and contain a score string, a sort value and optional extra data.
(https://gamejolt.com/api/doc/game/data-store/)
Data store items are cloud-based objects on the Game Jolt server, which are identified by a key and contain various data.
Those items are either globally stored or user specific stored (separate for each game) and can be created, modified and deleted.
This library provides a very easy and fast way to access them and allows to handle string and binary data with Base64 encoding.
This library uses the cURL library for sending an retrieving data, which provides a simple interface to do this without blocking and freezing the application.
Therefore many request functions have two different sub-functions: -Now and -Call
Now-functions will block the application, if the requested data has to be fetched or downloaded,
but they have no drawback, when the data is already cached. The data is always forwarded to the target parameter.
Call-functions use an object-related callback system. You forward an object which receives the data, a function pointer from his class as callback, and optional extra data as a void-pointer.
The implementation creates no additional thread, callbacks are executed immediately when the requested data is cached, or later in the update-function when the download is finished.
This method is especially useful for large requests and file downloads.
To increase the performance and reduce the network load, several data objects from the API are cached, because they won't change much, or only within the scope of the current main user.
Also some of the data is prefetched when creating the API-object or when logging in.
Cached are: all users, all trophies, all score tables, user score entries, user data store items, downloaded files
Not cached are: non-user score entries, global data store items
Prefetched on creation are: all score tables
Prefetched on login are: main user, all trophies, user data store items (only keys)
Currently only available for trophies, this feature saves retrieved Game Jolt data into a file to keep it after a logout, application restart or when offline.
This feature makes it possible to provide trophies even without an active Game Jolt login, and to ship it with the application for easier integration.
The local data is updated with the next successful login, the achieved status is not saved to prevent multi-user-conflicts.
Offline Caching is deactivated by default, but can be enabled in the gjAPI.h file.
It's possible with the cURL library to download files from any URL to a local folder and use them directly in your game (e.g. textures).
You simply need the URL of the file, a folder path where you want to save it, and an optional alternative file name.
The target folder(-hierarchy) is created if it does not exist. Also a direct download for user avatars and trophy thumbnails is already integrated.
The library uses Base64url encoding and decoding with an URL and filename safe alphabet.
This is a method to convert binary data into readable string data, to use them in SQL-queries, URL-requests, or other situations where only text can be processed.
(more information is available here)
Dedicated Base64url-functions are available for data store items and the extra data of score entries.
This library is developed and tested with Windows, Linux, OSX and Android.
The cURL library for Windows x86/x64, Linux x64 and Android is enclosed to the project files.
Special Thanks to: David "CROS" DeCarmine, Joona "erakkun" Melartin, Ashley Gwinnell, Bruno Assarisse, Jani "JNyknn" Nykänen, Jorge Martínez "Sasurai" Vargas
This is 3rd party software which is not directly affiliated with Game Jolt or Lucent Web Creative, LLC.
cURL Library (https://curl.haxx.se/)
MD5 generator by Frank Thilo using the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" (https://bzflag.org/)
Base64 decoder (modified) by FreeCode-FreeCode (https://freecode-freecode.blogspot.co.at/2008/02/base64c.html)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.