Home › Forums › General Questions › Saving changes made in the Application!
Tagged: save
- This topic has 14 replies, 5 voices, and was last updated 1 year ago by kdv.
-
AuthorPosts
-
2022-07-25 at 4:45 pm #54390pontusCustomer
Hello I have a question and I do not know if it is possible.
Let’s say i have an application and it has the possibilities to change color, move, clone and hide/show objects.
Is it possible to close the application and save the changes that was made to later open it up again?
This is very important. Thank you
2022-07-25 at 10:20 pm #54395kdvParticipantIs it possible to close the application and save the changes that was made to later open it up again?
You can export changes to GLTF and load this GLTF later…
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-07-27 at 7:25 pm #54435pontusCustomerIs this GLTF able to reopen the application and continue from where it left off?
2022-07-27 at 10:55 pm #54441CrunchCustomerI think what you are looking for is something like a “resume” feature that reloads the user app to the exact same state it was before closing the browser.
That would be a VERY nice feature/puzzle to have in Verge. So why don’t we don’t we have it?
Good question.. I for one never really thought much about requesting it as my understanding has always been ‘saving to disc’ means having to configure something to store it in – meaning database setup, php scripting, and other fun stuff that involves coding… Basically, something way out of scope for Verge3d developers to invest time in much less trying to provide user support for.
*Wordpress being the exception here, as its standardized, mainly codeless option for Verge users to be able to ‘plugin’ an online DB storage solution. However, not everyone using Verge uses, or wants to use, WordPress.
So I suppose I had ruled the idea that there could be any EASY button (puzzle) to implement a ‘save to disc’ and ‘resume’ feature for Verge apps… but that was before I learned about window.localStorage
https://www.w3schools.com/jsref/prop_win_localstorage.asp
It is so simple to use and from what I see, it’s a standard feature across all major browsers.
So far, what I have managed to put together is a simple scheme where I create a dictionary with the variables I want to save (as Yuri and company have been advising as a solution for years), then convert it to a string to save to local storage.
When my app loads, it checks localstorage to see if my key is set, if its not there, I run a procedure to set their default values – if the key is set, I load the string value into a JSON to setup a dictionary with the saved values, then run a procedure to set my variables to those values.
Being able to simply save and load variables is great – but, its still far off from being an easy button for a ‘resume app state’ feature.
You basically have to wire another layer of logic into your app to deal with the event of reloading variables and setting things to get back to the saved state where you left off. If your app allows users to modify any properties of objects (position, color, textures, clones etc), then things get even more complicated.
It would be SO nice if Verge developers could come up with something that could essentially take a ‘snapshot’ of an apps current state (variables, object properties, etc) that could then be automatically restored/resumed on command.
Still not sure how technically feasible such a feature would be, BUT with an essentially universal storage option (web local storage) open to all Verge developers (and end users) on the table… I now just have to ask the question to the Soft8Soft team.
Yuri? Your thoughts?
For starters, maybe a “create suspend data string” puzzle that simplifies the process of gathering all variables used in the app and writing their values, along with any object properties, when invoked at runtime, and writing out a stringified JSON formatted text string?
With options to then save that string to local web storage, send to database, or whatever?
Not sure what the puzzle looks like to load/unwrap the info back into the app as part of the resume process, but I am sure you guys could figure something out.
Attachments:
You must be logged in to view attached files.2022-07-27 at 11:09 pm #54444CrunchCustomerOf note, if you look at the attached screenshot of my local storage in post above, notice the ‘ispring’ key in there.
Ispring is an Elearning authoring tool similar to Articulate that I know you are familiar with. Their ‘resume’ feature works by writing out a JSON formatted text string that stores progress (ie “lastslideviewed: 5”, etc).
Of course since every Ispring “app” runs off the same cookie cutter template, restoring the app to where the user left off (last viewed slide, what links have been clicked, etc) is a much simpler scenario compared to say a custom Verge app.
Articulate is a much more robust authoring tool that allows for variables, custom javascript, custom object states.. More moving parts means of course means more data for the save/resume function and from what I can tell, they actually run their ‘resume string’ through compression before storage.
Which makes sense, as I know from experience that string size can get beefy really fast.( In case you missed it on separate post, I mentioned the major bonus of upgrading from SCORM 1.2 to SCORM 2004 is the ‘suspend data field’ (on the LMS) goes from a limit of 4096 characters to 64,000 characters)
I believe the max size for local web storage 5 megs per app, so plenty of space there.
2022-07-28 at 8:28 am #54455Alexander KovelenovStaffHi,
Indeed, having local storage supported in Puzzles would be very useful. Making it a priority task.
Regarding SCORM 2004, we should consider adding this standard to Verge3D as well. The strange thing with it, however, I can’t say exactly what open-source LMS-es support this standard. We used Moodle to test our e-learning Puzzles, but the developers of this system stopped working on SCORM 2004 long time ago. Perhaps you have some LMS in mind that you can recommend?
2022-07-28 at 10:31 pm #54477CrunchCustomerAlex.. actually, after doing a little research & thinking about, its not strange at all why open source LMSs (ie moodle) don’t bother with SCORM 2004 support.. ‘upgrading’ SCORM is akin to trying to “polish a turd”.
Moodle apparently developed its own proprietary format for content development that breaks the chains of SCORM standards and thus opens the door for them to make a better experience for creators and learners. Makes total sense to me. Being an open source LMS platform operator, they have that luxury.
So I am retracting my request for SCORM 2004 support in Verge and exchanging it with a BETTER IDEA.
Before I get to that BIG idea.. in regards to the limitation on the suspend data field..(even the 64k that 2004 provides still sucks) I know the field size can be expanded from the LMS side (SCORM cloud allows you to tweak it), but there really is no assurance any client LMS you deliver a SCORM app to will have their admins make such accommodations. However where I am going with this, “we don’t need no roads”
Aside from simpler work arounds like splitting the resume string up and shoving it into unused LMS fields (like the comments field), I came up with a possible workaround that opens the doors to other features.
First I rewired your Elearning box demo so it saves and resumes from where the user leaves off. Nothing fancy there and I did a messy job (see screenshots)…just a proof of concept that Verge SCORM 1.2 puzzles provide everything needed for creating very advanced SCORM modules.
I further modified it (not shown in any of the ss) to be able to also save and load a resume string from an external server (via ajax call)… well almost. My ‘external’ server I got it working on was still local.. when I uploaded to SCORM Cloud to test, it threw a Mixed content error as their Cloud is https and my local server’s SSL is no longer setup..doh..
I will save sharing my BIG IDEA for later after some more testing.. but before I do, does anyone with LMS/scorm experience see any pitfalls so far with being able to save and pull data from external servers (that I control) from within a SCORM module hosted on an LMS server (that I have no control over)?
I think I am still concerned over cross-domain issues.. My first attempts at sending and receiving data from my external server got blocked, but I was able to modify the headers on my scripts to Access-Control-Allow-Origin* which fixed things. Still worried I am missing something…
Any input appreciated, thanks!
Attachments:
You must be logged in to view attached files.2022-07-29 at 11:17 am #54498Alexander KovelenovStaff2022-07-31 at 6:23 pm #54536kdvParticipantAfter exporting to JSON and parsing from JSON the object looks like this
Any ideas how to convert this object to a normal Object3D? Some kind offromJSON()
is needed )))Indeed, having local storage supported in Puzzles would be very useful
The best solution to realize an app’s state saving/loading. It would be possible to save
_pGlob.states[0]
and restore this state on loading…Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-08-02 at 6:40 am #54564kdvParticipantA draft variant of the save/restore system based on GLTF export/import )))
https://v3d.net/9vj
Materials should beMeshStandardMaterial
.MeshNodeMaterial
is exported asMeshStandardMaterial
(glTF 2.0 compatible)p.s. Four cubes are draggable, two of them are hidable.
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-08-15 at 9:45 am #54865kdvParticipantA fully functional demo that can save/restore all made changes. No limitations with materials. It can restore the main camera position and direction, all geometry (including appended scenes), objects visibility, outlined objects and annotations. It just restores the saved state )))
https://v3d.net/a4kPuzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2022-10-17 at 8:28 pm #56664CrunchCustomerWoah!! KDV, that is awesome!!!!
I got pulled away from board and only today came back to this thread.
For others who missed it, check out KDVs demo app which allows for saving an apps state then reloading in the exact same state you left it.KDV, so using Verge Storage key puzzles, you could basically stuff that ‘.sav’ into a local storage key, and have things setup so when the app loads, it will check for that key, if found, loads and restores the user session? Pretty sweet!! Nice work, thanks for the high quality contributions!!
2022-10-18 at 8:19 am #56668kdvParticipantyou could basically stuff that ‘.sav’ into a local storage key
No,
localStorage
is not used. It can store string values only and it’s too small to store some serious scene. All parameters are exported into.gltf
file and then restored from it.Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
2023-11-16 at 1:46 pm #68595BrameisterParticipantyou could basically stuff that ‘.sav’ into a local storage key
No,
localStorage
is not used. It can store string values only and it’s too small to store some serious scene. All parameters are exported into.gltf
file and then restored from it.That’s pretty impressive! Could you give us mortal non-coders maybe a little bit more to go on? Would it be possible to see the puzzles to try and figure out how you accomplished this?
Thanks!
2023-11-17 at 1:03 am #68602kdvParticipantIn general, that’s an individual task depending on what exactly you want to save/restore.
Here’s a simple set of puzzles to save/restore objects’ position/rotation/scale
Link to zip https://v3d.net/q7q
Puzzles and JS coding. Fast and expensive.
If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.
-
AuthorPosts
- You must be logged in to reply to this topic.