seiyria Posted February 12, 2014 Share Posted February 12, 2014 Is there a preferred way of saving and loading data from within Phaser? I couldn't find a class in the docs that would seem to reflect something like a data manager (and a quick forum search turned nothing up), so I wanted to double check and see how others do it. Link to comment Share on other sites More sharing options...
RestingCoder Posted February 12, 2014 Share Posted February 12, 2014 I tend to just use localStorage, myself. Link to comment Share on other sites More sharing options...
away168 Posted February 12, 2014 Share Posted February 12, 2014 localStorage. You'll need to create your own manager once your game has its own set of data to save, which is game specific, but in the end it still uses localStorage as well. Link to comment Share on other sites More sharing options...
alex_h Posted February 12, 2014 Share Posted February 12, 2014 Bear in mind though that AFAIK localStorage will get wiped if the user clears their browser cache. If this will be a problem then you will want some kind of remote database setup instead. Link to comment Share on other sites More sharing options...
RestingCoder Posted February 12, 2014 Share Posted February 12, 2014 Yeah. If I ever need to have a way of keeping data if a player clears their browser cache, I'd probably use mongodb or another database option and a unique key for each player so they can load data that is saved on the server. Link to comment Share on other sites More sharing options...
rich Posted February 12, 2014 Share Posted February 12, 2014 I'd use localStorage. The LS API is so painfully easy to use that it didn't seem to be any point in wrapping it within Phaser. Link to comment Share on other sites More sharing options...
seiyria Posted February 12, 2014 Author Share Posted February 12, 2014 Cool! Thanks all. Link to comment Share on other sites More sharing options...
d13 Posted February 12, 2014 Share Posted February 12, 2014 You can also try localForage: https://hacks.mozilla.org/2014/02/localforage-offline-storage-improved/ seiyria 1 Link to comment Share on other sites More sharing options...
Recommended Posts