Save EVERYTHING but... with unique file extension?

  • Hi All,

    I'm working on a creation tool software, basically the user creates objects, place them around, manipulate them, etc..

    I want to let the users the option to SAVE EVERYTHING so they can come back later, and keep manipulating.

    There are 2 questions I would like to start with:

    1. Which SAVE option should I use? (I never used one, I believe there are few options to do so)

    2. How can make the file extension UNIQUE to what I like for example: MyTest.dan

    Before I start using C3 people told I don't have that amount of freedom in this game-engine so I should use Unity or other game engine that is more dynamic and won't limit me before I waste my time and money.

    To be honest, I'm not sure if this is true or not.

    but here I am with a dynamic file name that I want to let the user to SAVE and LOAD to my own software, so windows also will be able to recognize it if you Double Click on the file it will open and load the file (just like we run C3 files or any other file).

    If you can guide me or help me out here I'll appreciate it, I have a lot more to learn about C3 so if possible Please explain in basic terms or step-by-step, it will be VERY helpful!

    Thanks ahead! :)

  • It's easy actually. Run "System Save" action, then in "On Save complete" event expression SaveStateJSON will contain all saved data. To save it to disk with any extension use "Browser request download of string" or "NWJS Write text file".

    To load - read the file from disk into a string variable and use "System Load from JSON".

    .

    It's also possible to compress data (as files in JSON format may be pretty large). See this plugin. And again, you don't need to use "zip" extension for compressed files, you can choose any extension you like.

  • Depending on what you want there's a few options.

    The inbuilt save option is the easiest, it just saves the current state.

    If you want a bit more control you can save just the information you want to local storage.

    If you want a full on system then the BinaryData plugin can be used to encode/decode a binary file.

    If your intending to create a web app you can get users to select a file with the "filechooser" plugin, the "ajax" plugin can read the file into the "binarydata" plugin for you. When saving you can use the "browser" plugins "invoke download" action to download the contents of a "binarydata" object with a filename of your choice.

    If your intending to create a desktop app (NWJS) then you can use the "NW.js" plugin to read a file directly into a "binarydata" object, and can write it back using the same plugin.

    In terms of file extensions you can use pretty much anything, the 3 letter limit on file extensions date back to software restrictions in windows in the early 90's and isn't a problem anymore. So you can use as many letters as you want.

  • Thank you for the quick detailed reply dop2000 Nepeo

    It seems like it is possible which is VERY encouraging!

    I'm aiming for a Desktop version, so I guess the NWJS is the answer.

    I have no idea how to code such thing, I can try messing around of course (a nice way to learn) but with the all JSON file and how to deal with it sounds confusing to me.

    It's very cool that I'm not limited to the 3 letter extensions, sounds like I'll have lots of freedom with any name I would like to use as extension! :)

    If there any chance any of you guys can make a most basic C3 file example to SAVE & LOAD with unique file extension for Desktop (NWJS) so I can explore how it's done and learn from it, it will be extremely helpful!

    I hope it's not confusing as it sounds to me (noob), but you guys really encouraged me with the solutions! thank you so much and thanks ahead for any file example that may show me the way.

    BTW - Since my goal is to make NWJS (.exe) for Windows, will it also work for MAC and Linux with no problem?

  • .

  • Thanks for the example dop2000 No way I could understand how to do this complex AJAX / NWJS actions by myself...

    I can save and name the file "whatever.alon" and I can also Load and choose it.

    So the dialog boxes for both save and load works, but when I LOAD nothing happens...

    Can you please point where I had a mistake?

    I tried to follow your example but I guess I missed something.

    Thanks ahead! :)

  • Look at your AJAX request action, why are you requesting "icon-128.png"? You need to request URL NWJS.ChosenPath

  • Look at your AJAX request action, why are you requesting "icon-128.png"? You need to request URL NWJS.ChosenPath

    Thanks! I knew it was something I mixed up, IT WORKS GREAT NOW!

    Thank you so much dop2000

    Question:

    I'm guessing this save system saves EVERYTHING (as I wanted) but, after testing it now I'm wondering Can I exclude or decide what will NOT be saved? because there are some things I don't want to be save.

  • You can add NoSave behavior to things you don't want to save.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can add NoSave behavior to things you don't want to save.

    Thank you so much! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)