Search code examples
jsondatabase

Save Data: JSON or Database?


In a html/css/js browser game I'm making, I have determined I will eventually need to have saving functions. I've used database save data before, but my other coding friends recommended using JSON. Which method is better? more efficient? easier?

Only a few strings and mostly small integers are being saved. Some Object-oriented programming is used.

Thanks for any feedback.


Solution

  • Part of your choice will depend on how much you care about the users having access to the save data and also really what the game is in the first place.

    json or xml for that matter are nice save formats that you can dump all the info into and easily read it back later. But if you are saving it on the local machine the user obviously has access to it.

    Also storing stuff locally like that means you don't rely on network anything which is always good unless your game already relies on the network.

    If you have any online play local save data is obviously bad in most cases. Against it really depends on what your game is doing.

    Finally it's much faster to get something up in running that uses local saves. And is one less thing to worry about the users having network issues because of proxys or whatever that prevent them from getting their save data.

    I would say local storage with json/xml is more efficient/easier. But the downside is it is less safe and prone to the being accidentally deleted/corrupted (which is why many steam games have local saves but also cloud backup).