babbleon Posted July 25, 2018 Share Posted July 25, 2018 (edited) Hello, Does the below seem a reasonable way to deal with undo / redo and snapshots? When required, I serialize the whole scene and append this to a scene > metadata > snapshot array. I can then undo by loading a previously serialized scene in the snapshot array or I can jump to, say, 4 snapshots earlier. I am mindful that the scene saved to snapshot should not include it's metadata > snapshot as I'd end up with files increasing exponentially in size. I can then serialize the whole scene (including the snapshots), upload to server and so can reload another day and still see previous snapshots. So, some questions: Is the above a lazy or bad approach? Is there a better way that I have not yet thought of? Any input would be gratefully received. Thank you. Edit: Alternatively, I could just serialize the whole scene when any particular changes are made and dump that on the server and then grab when required. Edited July 25, 2018 by babbleon thought of something Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 25, 2018 Share Posted July 25, 2018 I do a similar thing with my 3d level editor. It is just determining what you mean by serializing the whole screen. I suppose you could store everything is a scene container including vertex data, but I am storing a minimal state to restore a scene to keep size down and speeds up. I have worked on do/undo support, but am using a library called redux for the time travel - perhaps my scenario is much simpler than what you are building, though. Undoing at the most basic is performing compensating actions in reverse order. Quote Link to comment Share on other sites More sharing options...
babbleon Posted July 25, 2018 Author Share Posted July 25, 2018 Thank you @brianzinn, In a nutshell, my scene will involve; adding and removing meshes, changing properties of materials, changing vertex positions of added meshes and a couple of meshes created from user input. I also have a UX which I need to ensure is synchronised with things in the scene along with the relevant parameters. So long as you don't think my idea for undo / redo is way off I will put pen to paper & see if it's going to work. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted July 25, 2018 Share Posted July 25, 2018 @promontis and I had a discussion about this a few weeks ago as we are doing the same thing, but at least I am not doing anything like changing vertex data. Here is that thread from a month ago: http://www.html5gamedevs.com/topic/38437-redux-a-global-scene-and-scene-recreation/ babbleon 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.