Saving data to file possible in C2?

0 favourites
  • 8 posts
From the Asset Store
Data+ is the best Data Management solution for Construct 3. It contains 4 Addons (Plugin & Behavior).
  • Hi guys, I really am sorry if you have all heard this question before.. but i'm just trying to clarify.

    I bought C2 today as I tried the demo and was instantly impressed! I'm used to making games in Multimedia Fusion 2 by Clickteam and, though the support and functionality is great, Construct seemed to make some things so much easier, or even do things that just were not possible on MMF2.

    Anyway.. I'm a little gutted as after quite alot of research it seems that loading / saving data to the file system is.. 'Impossible' due to the fact that it is purely HTML5? I may be wrong here but after looking around to day this seems to be true. After looking further it seemed Construct Classic could do this?

    I like to build my own level editors for my levels, it just works better for me and to be honest if there is absolutely no way of saving them (I don't want to just save the data in a session, or webstorage) then Construct 2 for me, was a waste of money. But I guess that is my fault for not looking into it enough.

    The guy over at konjak.org apparently uses Construct now.. And he seems to be loading in level data from local files saved on the hard disk.. So how is he doing that.. Or was that made with Constuct Classic.. If that is the case, I really should be using that.

    Any answers appreciated, sorry for my ignorance!

  • Your little bit of research should have been a little bit more, but I guess that's where this thread comes in :P

    Don't dismay, saving and loading information is entirely possible with C2 using WebStorage. Don't let the name fool you, though, you can use WebStorage with offline apps, too, including Node-Webkit (desktop) and CocoonJS (iOS/Android).

    Everything is covered in the manual entry, and here is a super basic example I made for another user recently.

    Oh, I see that you have already seen WebStorage. Then what you want is "local", not "session" storage. That's possible too as you can see in my example.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That was a quick reply thanks Geometrix! I did notice before that WebStorage isn't exactly what it sounds like and the data is actually stored on the local machine, but for making a level editor, you would want to be able to 1. create the level, 2. click save to open a dialog box, 3. save the file somewhere on the hard drive. And then the actual game can read from that file and load in the level array data. Is that kind of thing supported?

  • As far as I understand it, XML and AJAX can do half of what you want (loading files), but not actually create new files, but my knowledge of those functions is pretty limited so I wouldn't be able to give you a definitive answer.

    I suppose you could use WebStorage to save your data from your editor and then retrieve that data as necessary, but that would be a bit cumbersome for your needs.

  • Hmm.. seems like this plugin pretty much does what I would like: scirra.com/forum/plugin-filesaver_topic49803.html as far as letting me choose some where on the file system to save a data file (If run as an executable on windows) Only thing is now trying to compress that data, but thats a different story entirely!! Thanks for your help by the way!

  • From your level editor you can download the contents of an array as a json textfile (array->download). In preview mode your browser will download it when you trigger it.

    You then import the json textfile into your game in C2.

    You then set your array to load the file.

    scirra.com/manual/108/array

  • Using a browser-based technology requires a bit of a mental shift: you can save data permanently, and download files to disk, but it just works a little differently. You can't do the traditional read-and-write-files arbitrarily, because that's a huge security risk in a browser.

    WebStorage provides permanent save storage, even when offline. You can download Array and Dictionary data as JSON for level editors, and AJAX them as project files to load them dynamically.

    We might be adding more storage features in future, but I think everything's there - it's just a different workflow.

  • Hello,

    And sorry if my question is silly...

    Is it possible to download audio files (by URL) and then import them?

    The aim is to play it with "play by name".

    Thanks

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