WUData

In under 60 seconds, turn any game into a cloud based game and sync your data across devices!

Note: This kit is an extension of the WordPress User Login kit

The WordPress User Data kit allows you to store any number of variables you want and even classify them into categories for batch retrieval per category if you don’t want to fetch the entire game’s settings in one go. Save string, float int, long, bool, Vector2, Vector3, Rect, Quaternion, Color or any custom class that has a ToString() method. You can even store images for in-game and website use.

Available fetch options include: Available save options include:
  • Fetch a single field
  • Fetch a category
  • Fetch all data for the specific game
  • Fetch only the player’s personal data that shared between games (i.e. custom avatar, preferred difficulty etc)
  • Fetch everything about the user and all categories of all games
  • Relevant parts of the above for other players (For use with authoritative servers)
  • Fetch game settings shared by all players
  • Save a single field or category for the specific game
  • Save a field or category to share among games
  • Save data globally for all users to share. I.e. post-publishing data tweaks. All changes are live immediately so the first time a player fetches that data they will receive the updated values. No need to download a new binary to receive your updates
  • Save images to the uploads folder into a custom folder created per user

WordPress User Data makes it possible for you to check what other games of yours the player has and even update the player’s settings in one game from within another! “Did you buy the Prequel? Excellent, thank you. Here is 5000 extra Gold”. Or the other way around… “Thank you for buying the prequel. I see you already have the main game also. Excellent. I have now unlocked a secret character in the main game”

Store any value! Keep it online and out of the hands of the cheaters… Gold, score, health, experience, tower upgrade level… whatever values you want to store, now you can!

Install the plugin once and you are good to store data for all your games.
Includes comprehensive documentation explaining the available functions


Pro tip:
The game’s data is fetched as CML which means all your data is typecast to their required types when you use them. This means that at runtime you can create, store and use any variables you want and are not limited to using only the variables you know about at design time. CML offers runtime typed variable creation. Think about the possibilities this affords you!

One option you have is to create a single CML object for your game and then store ALL your game’s variables inside of that. When the time comes to save the game you can store every single last one of your game’s variables using a single line of code. When the game starts you can fetch that back from the server and then restore every single last one of your variables in one go and be right back where you left off!

Example:

//filename data.cs
static public CML data;
static public void SaveGame() {
     CMLData cat = new CMLData();
     cat.Set("everything", Encoder.Base64Encode( data.Tostring() ) );
     WUData.UpdateCategory("", cat);
}

void Start() => WULogin.onLoggedIn += AutoFetchMyData;
void AutoFetchMyData(CML response) => WUData.FetchField("everything", onSuccess: RestoreMyData);
void RestoreMyData(CML response) {
     data = new CML();
     data.Parse( Encoder.Base64Decode( response[1].String("everything") ) );
}

And that is that. You now have yourself a complete game load and save system and all your updated values will be available on all your devices as soon as they login to the game. That simple… if you want it to be.

Example use:

//just for simplicity, let's use local vars instead of data.data
CMLData GetCategory (string name) {
    if (null == data.data) data.data = new CML();
    if (null == data.data.FirstNodeOfType(name)) data.data.AddNode(name);
    return data.data.Node;
}

CMLData player_data, progress_data;

//fetch the categories in the CML file so we can work with them directly
void Start() {
    player_data = GetCategory("PlayerData"),
    progress_data = GetCategory("LevelData");
}

//save whatever you want to whatever category you want
void SomeRandomFunction(int levels, int this_level, int stars)
{
    player_data.Set("position", transform.position.ToString());
    player_data.Set("rotation", transform.rotation.ToString());
    progress_data.Seti("Level"+this_level, stars);
    progress_data.Seti("Levels", levels);
    data.SaveGame();
}

//use your saved data however you want...
void SomeOtherRandomFunction()
{
    transform.position = player_data.Vector3("position");
    transform.rotation = player_data.Quaternion("rotation");

    int unlocked_levels = progress_data.Int("Levels");
    int[] stars = new int[unlocked_levels]; 
    for(int i = 0;i < unlocked_levels; i++)
        stars[i] = progress_data.Int("Level"+i);
}

Alternatively you can update individual fields/categories directly and have those values available immediately rather than saving everything at once and only fetching the data when you login. You have options. This is one of them. How will you use this kit?