How To Manage All Of Your Game's Data Programmatically
Holger Weissböck on October 15, 2013Hello Floxxers! Only a few days after releasing the well-received team support I am happy to announce another handy feature: As of now Flox allows you to manage your game’s data programmatically. All you have to do is summon a hero! “Uhm, a … what now?”
Players
Let’s step back for a jiffy and have a quick reminder on the player system: Everytime a new player logs in to your game the backend creates a corresponding player entity. Your game uses these player entities to handle the data (entities) your players create.
Every player and every entity created underlies an end-to-end permission system that makes sure that each player is (unless otherwise configured) only allowed to see the data he creates. This approach automatically compartmentalizes your game’s data without you lifting a finger. For example, by default every player only sees his own savegames.
If you, however, need to share entities between players you can do so by setting the necessary “public access” state on these entities. You can use this to share savegames, invitations and other things between different players.
All in all this allows your players to save both private and public data. As always you can find the details over at the documentation. However, there’s one thing that it’s designed to prevent…
Heroes
Players will never be able to see or modify all of your game’s data. Of course! That’s the whole point of a permission system!
As a game developer however, there are situations in which it can become quite cumbersome or even impossible to work if you are confined to a single player account. For example, how would you add, change or remove a property on all Savegame entities of your game? Up until now this was impossible! Even you as a developer can only see your own savegames. That’s why we need to call heroes to the rescue!
What are heroes, you ask? Essentially heroes are players which are not subject to the internal permission system: They boldly tower above such puny restrictions (with their hair blowing in the breeze).
It’s up to you to create, modify and remove heroes for your game. You can do so in your game’s web interface under ‘Heroes’. Once a hero is created you can use the SDK to log on as that particular hero using the hero’s key and the loginWithKey(…) method. After logging in you are able to load, edit and remove every single entity and player of your game’s data. No questions asked!
With Great Power Comes…
Heroes enable you to do a lot of things, most likely in the data management area. However, to wield their powers requires you to be quite careful. You are able to change every single entity and player of your game. This means that you are also able to chaff them beyond retrieval … and that with a vengeance. Having said that: are there any questions? ;-)