I'm working on a port of the fantastic Flox sdk to Game Maker and I thought I'd give others the chance to give it a go, find out what Flox is, possibly even contribute! First of all, what is Flox? Well if you don't mind, I'd like to ask you a few questions first.
- Ever wanted to keep track of players across devices/installs of your game?
- Have you wanted players to be able to challenge one another or interact more socially?
- Do you want players to sync their power ups / game saves across platforms?
- Or perhaps you just want to know how many people actually make it to the third level?
Flox can do all of this and more, it is a complete back-end solution to your game. Not only that, but it's pay what you use and you get the first 1,000,000 operations for free!
It's worth noting at this point that I am in no way affiliated with Gamua, just a fan-boy who uses the service.
Flox is a service and you must Sign up to Flox in order to use it. Add your game when prompted.
There are two ways to get Flox for GameMaker, importing the assets or downloading the marketplace extension. Downloading the marketplace extension is nice and simple, just add all the included assets to your project and you're good to go. However if you want to use the library for free you can! All the code is open source and completely free to use I charge for the marketplace library to recognize the significant amount of work I have done to make this library functional. But I don't want the price point to prevent anyone from using the library!
- Get the marketplace extension here.
- If you don't want to support the project, download the library for free here.
The first thing we want to do with Flox is to tell it what game we are. This is really straightforward
You can find your game id and key on the Game info tab of the Flox control panel. Now of course, what is the first thing you do with any new toy?
You'll need to run this a couple of times and wait a few minutes for the logs to process but soon you will see your logs appearing in the control panel. Cool!
You can save whatever you like to the cloud, either to be shared by a single player across their many devices (iPhone, iPad, Facebook etc.) or with friends across many game sessions. It's really easy! Create an entity and save it;
var saveGame = flox_entity_create("SaveGame"); flox_entity_set(saveGame,"level",3); flox_entity_save_queued(saveGame);
This will record the level a player has reached and save it to the cloud for later, primo!
Leaderboards are nice and simple too! Create a leaderboard in your Flox control panel and it'll give you the id of that leaderboard, then post a score;
var leaderboardId = "my-leaderboard"; var score = 500; var playerName = "Bob"; flox_leaderboard_post(leaderboardId,score,playerName);
Nice! Bob has a new score of 500!
Examples / Tutorials
I have made a couple of examples, in each you must swap the credentials used in flox_init for your own.
- Asynchronous multi-player example (Think song-pop) Tutorial here.
- Basic leaderboards example
- More to come (Let me know if you've made a tutorial, I'll add it to the list)
For the complete API and documentation, check out the wiki page on BitBucket.
What's a Callback?
// v0.1.1 (20-04-2014) Initial release, Players, Logs // v0.1.2 (22-04-2014) Fixed callback context, minor bug-fixes // v0.2.0 (27-05-2014) Entities implemented, save anything to the server // v0.2.1 (17-06-2014) Queries, why is this a point release? // v0.2.2 (26-06-2014) With != Where + bug fixes // v0.2.3 (19-07-2014) Remove the need for flox_list with some fancy tricks + bug fixes // v0.3.0 (26-07-2014) Leaderboards & scores + major bug fixes // v0.3.1 (25-08-2014) Date/time corrections + bug fixes // v0.4.1 (07-03-2015) Completely re-architected for better stability // v0.4.2 (29-03-2015) Login email / password // v0.4.3 (20-05-2015) Bug Fixes // v0.5.0 (03-07-2015) Secure persisted data + api clean-up + better mobile support // v0.5.1 (29-09-2015) Bug fixes + firstRun and flox_query_ids_only // v0.6 Add entity type descriptions + conflict handling // v0.7 Optimisation (Reduce ds_* redundancies) // ... // v1.0.0 WINNING
Known Issues / Report a Bug
For a complete list of issues or to report an issue with the library, check out the current issues on Bitbucket. If you sign up to Bitbucket, you can watch issues to be notified about when they have been resolved (just click the little eye alongside the issue you wish to watch).
Currently there is only one major issue known, a GameMaker bug is preventing the Android platform from working as intended. You can find the bug report here. Make sure to be using GameMaker 1.4.1711, the Android networking bug has now been resolved.
I have Git repo on Bitbucket here, If you want to contribute PM me and we'll work how best to manage things. If you would like to support the project but don't want to touch the code, please donate generously.
Happy Game Making, R.
Edited by Rani_sputnik, 19 February 2016 - 08:35 AM.