ItchGamesCarousel GDevelop extension
ItchGamesCarousel is a GDevelop extension which allows you to show off your other games hosted on itch.io within your game(s) with a beautiful image carousel, like this:
The extension is highly configurable with automatic advancing between games (images), alternate API URL (more about that below) and option to override children configuration - where you can change highlight color, fonts, outlines, colors etc. for each element of the prefab object.
Simply drop the prefab object (GamesCarousel) and set your itch.io API key in the object properties, add the following event blocks and it should start running as soon as you run your game (preview):
That's pretty much everything you need to make it work.
Known issues
There are a couple of known issues with this extension.
CORS problem
For some strange reason, the itch.io API does not allow CORS requests so this extension will not work with HTML embeds (when playing in browser). This is a technical issue - look below for the solution.
API key revealed
By adding your itch.io API key to the game code/properties, it's out there for everyone to find it. By doing some network sniffing a malicious user can find your API key pretty easy. And your API key allows more than just listing of your games. This is a non-technical issue - but we have a solution!
Games sorting
By default itch.io API doesn't sort games by their publishing date in a descending order - it seems it sorts them in the ascending order, which is not good as the carousel will show only first three games returned by the API. I'm too stupid to sort an array in GDevelop - sorry :( but... I know how to do it in PHP
Alternative API URL
You may have noticed the extension allows you to set your own API url. By default it uses itch.io API with something like this set as an API URL:
https://itch.io/api/1/%key%/my-games
I've made a custom API proxy to solve all of the problems listed above. You will still need your itch.io API key, but you will use it on my API proxy to generate a new API key which will hide your original itch.io API key. This new API key will be used on my proxy API and it can be used to list your games only. My API proxy is also set up to allow CORS requests, so all of the problems listed above should be resolved.
Head on to https://utils.avramovic.info/itch-games and put your itch.io API key in the form. You will be presented with the new API endpoint and API key which you can use with this extension. You should then set the new API endpoint in your object prefab properties:
https://utils.avramovic.info/itch-games/api/%key%
Besides this, you will be issued a new API key like this:
b37e312e-1edd-44a1-b7ff-1a613ef106b5
Put both of these values in your object prefab properties and that's it - with this setup:
- your original itch.io API key is hidden,
- the CORS will work (so you can use this within your HTML5 web games) and
- the API proxy will automatically sort games from newest to oldest, showing only your 3 newest games in the carousel.
The API proxy allows further customization, like custom sorting, filtering by platform, excluding multiple game IDs, etc... check it out:
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.