Jump to content

Serialize data for saving?


silversteez
 Share

Recommended Posts

Hey,

 

I was wondering if anyone has any experience trying to serialize the data of a Phaser game/state in order to create a game save. Wondering, for example, if it would be difficult/possible to accurately recreate a scene with a bunch of physics enabled sprites sitting on top of one-another, for example?

 

I was planning on giving it a shot, but figured I'd ask around for tips first.

 

Thanks!

 

- Matt

Link to comment
Share on other sites

You could use localStorage and JSON, it's really easy to use, and there's lot of articles on how to save data with that.

 

I don't know how your game work, but you could just serialize position and reference to the name of objects and stock them thanks to JSON.stringify().

Link to comment
Share on other sites

Thanks, Zaidar!

 

I should clarify, actually - I'm not as worried about the actual serialization aspect (JSON for sure!), but more so the best approach to collecting the states of every sprite/group/etc and then using that data to rebuild the scene later. There's bound to be some tricky aspects to getting that right.

 

I'll probably do some experiments later and report back with my findings. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...