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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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