What would be the best way to handle storing data for a mobile game?

0 favourites
  • 4 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hello everyone,

    This may be a stupid question. I also looked for similar threads but I couldn't find one.

    I'm working on a mobile game where I want to save user progress, let them collect in game currency, track their unlocks, their stats etc.

    I'm struggling with figuring out how to manage that data efficiently and make it easy to scale.

    What I been going with so far is just a huge mess of having one dictionary and saving and setting all key-values separately in localStorage. But the moment I want to add something to the game it's pain and misery.

    After thinking about this for like 3 months the best way I could think of is to:

    1. Set initial data from dictionary.json file with AJAX

    2. Once there is some actual player data, set Local Storage item to the dictionary object .AsJson

    3. Turning game on again, check if that Local storage item exists, get it, use dictionary "Load from json string". If doesn't exist, go to 1.

    This seems much better and smoother than what I was working with previously but still, I feel like there should be some even better and more automated way. Developing the game the way I described here still means that If I want to add something later I have to add new fields to dictionary file and add more actions to loading events.

    I'm probably asking for too much but do you guys have any other better ways to go about data or see some potential improvements to what I described here?

    Thanks in advance for any replies! Have a nice day.

  • If anyone is interested this is for an update for my game Star Cruise: Space Adventure play.google.com/store/apps/details

  • 1. Set initial data from dictionary.json file with AJAX

    2. Once there is some actual player data, set Local Storage item to the dictionary object .AsJson

    3. Turning game on again, check if that Local storage item exists, get it, use dictionary "Load from json string". If doesn't exist, go to 1.

    What you described is a good and effective solution.

    If you are extracting each value from the dictionary into a global variable, it may be easier and more convenient to use several dictionaries. For example, one for storing player progress (copy values to variables), and another one for storing game settings (use directly, without copying to variables).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm surprised I didn't think of that, that may my life a bit easier. Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)