Read/Write to disk

0 favourites
  • 15 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Are there any plans to allow arrays, hastables, audio etc. to read from & write to disk? I figured this would've been added in r100 with the .exe exporter but I guess not. The age of custom level editors / much better external file management in general is nigh!

  • I would also really love to see this added.

    Preferably with choices on format and encryption!

  • Bump for justice.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anything that can save to JSON can be saved to WebStorage, so that includes Dictionary and Array. Due to a bug WebStorage doesn't work in Awesomium in r100, but it should be fixed in the next build where it saves persistently to disk. Do you really need full file I/O access? Shouldn't that be enough for simple cases? Full disk access would be complicated to add, and only relevant to the Awesomium exporter. I hesitate to add features which are not portable to all platforms.

  • Hmm, but Webstorage stores in your cache or just for that session.

    For a RPG game or a more serious, longer game, we would want a permanent file save. I wouldn't want my players not to clear their cache because their EXE game's data would be lost..

  • Hmm, but Webstorage stores in your cache or just for that session.

    No it doesn't, that's only due to a bug in r100. In the next build WebStorage saves persistently on your hard disk drive, and isn't erased if you clear your cache (because it is separate to any browser installation).

  • So when you say "Shouldn't that be enough for simple cases?", what do you mean? What can the fixed Webstorage not handle?

  • I think it would be nice to at least being able to save the webstorage files to a specified location, so the user can backup his save files.

    As a more advanced feature (but equally welcome), the ability to read and generate image files and save them to disk would be useful for screenshots or custom game avatars.

  • I made a pretty advanced webstorage system with multiple slots and modes. It's actually amazing what you can save in a string with webstorage and also suited for RPG's and inventories. You just have to use some creativity and be very systematical about how you approach it.

  • I would really, really like not only full file I/O, but also the ability to preview as an EXE instead of through a web browser like with construct classic - one click and an exe appears running on the screen. Reasons for this in order of importance, least to highest:

    File size - Not as much of an issue these days, but it seems a waste especially with needing 3 copies of each sound file in each backup of a game. However, it leads into...

    Saving times - true, saving as a project is faster, but even with a small game it can start to take a bit of a disconcertingly long time when imagining how much longer it would take to save a big game.

    Previewing times - while I haven't tested it yet, I'm concerned that at some point when working on a larger game it's going to start impacting preview times as well, as happened with construct classic. I realize C2 is written far, far more efficiently, but regardless that can be a lot of data to move around all at once and if some of it could be loaded at runtime when it's needed via actions instead it would make it much smoother.

    Updating files - if we want to update a piece of music, we have to go through the process of importing and replacing it each time. If we could have it load from disk, all we need to do is overwrite the file.

    Some people want to make EXE-only games - it would be very, very nice to preview directly via the output method they're going to use - no having to wonder if the game is going to work differently via the EXE exporter (bugs in awesomium or such, etc). A lot of bugs are found when testing other stuff in the preview - having to do a whole extra round of testing specifically for the export would be extremely inconvienent, especially for large games like an RPG!

    Webstorage issues - as browsers have limits of 2.5 or 5 MB for webstorage, that means if you want to use more than that you have to start resorting to swapping stuff in and out of webstorage to disk using clumsy save/load file from disk dialogs every time you want to swap between them, you have to keep track of which is which, and hope that is the dizzying process of making a game you don't accidentally save as the wrong file name and overwrite the wrong file or some such.

    Or then, what about on the user's side, if your save files simply need more than 2.5/5 MB, like if you include a level editor that the user can use? What then? Even with using EXE, there are simply no options other than asking the user where to save the file, then to load it later, both via a windows dialog box. Users aren't going to like that, it's not a smooth experience at all.

    What's worse, is when previewing via a browser, that's 2.5/5 MB shared for ALL games made with construct 2! Want to make multiple games that use a lot of data at once? Gotta swap webstorages every time.

    The full file I/O would really need preview as EXE to work well, though. Otherwise, you'd have to export to EXE each time to preview, which would be infuriating!

    If we had both preview as EXE and full file I/O, that would solve these problems completely and be a great working experience. Please, please add both to C2!

  • Arima Great points, especially about the shared 2.5/5 MB limit.

    I keenly believe that C2 should work as a game maker for HTML5 games for the web, as well as a full-fledged one for desktop applications. If its going to be able to export .EXE files, it should work as a full experience of making a desktop game, including testing. It shouldn't just feel like a wrapper, but an option to work on a desktop game from the start to finish.

  • I feel bad asking for more on the EXE side of things at all... I spent so long asking for an EXE wrapper in the first place, I just feel plain ungrateful to be unsatisfied. <img src="smileys/smiley36.gif" border="0" align="middle" />

    But Arima's right, on all counts... This features would be really great to have.

  • ability to preview as an EXE instead of through a web browser like with construct classic - one click and an exe appears running on the screen.

    Yes, that is a "must have" feature. As I wrote in this post here running a game from an *.exe and from browser are two different things.

    It's just a simple example but it's impossible to test it, cause in the browser that game is unplayable. So to test my game I have to export it to exe every time and it's only possible now, after releasing r100. I had to abandon that project before because I could not test it properly.

    And it only a small, simple game - not even small just few tiles and sprites moving across the screen, and it takes about 5-8 seconds to export it.

    Now imagine all that big projects, with xx numbers of layouts, xxx numbers of sprites, tilebg, audio etc. to export every time when you want to preview it.

  • In theory, previewing in Chrome should be identical to previewing in Awesomium, since they use the same engine. I'd prefer not to add a preview option for EXE if it basically works the same as the Chrome browser. I would also prefer to avoid adding full file I/O options which are not portable, i.e. only work in Awesomium. Browsers are beginning to understand files with various file system APIs appearing in browsers. I think it would be far better to come up with a cross-platform file I/O system which works transparently with both Awesomium and browsers which support file systems. However, that means not using the traditional file I/O, so I'm not sure what that would look like. It probably means unlimited file I/O, but in a sandbox (where the user can only choose files previously saved to the sandbox). This will be looked in to, but I don't have any immediate plans...

    File size - Not as much of an issue these days, but it seems a waste especially with needing 3 copies of each sound file in each backup of a game.

    Not sure why this is a reason for EXE preview. Only .oggs are exported with Awesomium since it can read them.

    aving times - true, saving as a project is faster, but even with a small game it can start to take a bit of a disconcertingly long time when imagining how much longer it would take to save a big game.

    Not sure what you mean here, do you mean save times in C2? Why would a new preview option affect this?

    reviewing times

    Preview times for an EXE are likely to be the same as previewing in Chrome. Classic was slow because it would build a new data file for each preview, as if exporting. C2 now points the browser to the existing project files without copying anything, so even large projects should be fast. I don't see an EXE previewer improving on this.

    pdating files - if we want to update a piece of music, we have to go through the process of importing and replacing it each time. If we could have it load from disk, all we need to do is overwrite the file.

    If you save your project as a folder, don't you get this already?

    ome people want to make EXE-only games - it would be very, very nice to preview directly via the output method they're going to use - no having to wonder if the game is going to work differently via the EXE exporter (bugs in awesomium or such, etc). A lot of bugs are found when testing other stuff in the preview - having to do a whole extra round of testing specifically for the export would be extremely inconvienent, especially for large games like an RPG!

    I admit this is probably the best reason for making an EXE previewer. But if we can get it working nearly identically to Chrome, I still think that's a better solution. Hopefully the EXE exporter can literally be Chrome in its own window.

    ebstorage issues - as browsers have limits of 2.5 or 5 MB for webstorage...

    This is only because browsers operate on the open web. The limit can be removed in Awesomium. I'll check if this is done already or if we need to do something.

    hat's worse, is when previewing via a browser, that's 2.5/5 MB shared for ALL games made with construct 2!

    The limit, if any, is per-game. However it is most likely any limit can be removed anyway.

  • I think it would be far better to come up with a cross-platform file I/O system which works transparently with both Awesomium and browsers which support file systems. However, that means not using the traditional file I/O, so I'm not sure what that would look like. It probably means unlimited file I/O, but in a sandbox (where the user can only choose files previously saved to the sandbox).

    It sounds good, but I'm concerned with transferring the files in the sandbox into and out of the browser. It's not an elegant process having to use a windows dialog box to do it. What if I have a lot of files there that I want saved to a folder to reimport into C2's files section later? Would I have to save each one individually every time they get updated? Or would it instead work to basically "ship" the game WITH the sandbox to the user? If that's the case, then that would solve a lot of the reasons I wanted file I/O.

    > File size - Not as much of an issue these days, but it seems a waste especially with needing 3 copies of each sound file in each backup of a game.

    Not sure why this is a reason for EXE preview. Only .oggs are exported with Awesomium since it can read them.

    It was more a reason for file I/O - what you mentioned above about the sandbox would fix it though (and it wasn't much of an issue anyway).

    aving times - true, saving as a project is faster, but even with a small game it can start to take a bit of a disconcertingly long time when imagining how much longer it would take to save a big game.

    Not sure what you mean here, do you mean save times in C2? Why would a new preview option affect this?

    I was thinking the file I/O would affect it, because then c2's editor wouldn't have to do anything with the files when saving since they wouldn't be kept in the project, but on second thought, if you coded C2 so that if a file wasn't modified it doesn't get rewritten when saving, I guess that wouldn't happen.

    reviewing times

    Preview times for an EXE are likely to be the same as previewing in Chrome. Classic was slow because it would build a new data file for each preview, as if exporting. C2 now points the browser to the existing project files without copying anything, so even large projects should be fast. I don't see an EXE previewer improving on this.

    I was thinking that the browser itself could potentially take quite a while loading everything at the start. However, with how you described how it works, as long as the eventual option for loading objects/layouts can read things from disk as they're needed rather than all at once at the start, I guess that's a non-issue as well.

    pdating files - if we want to update a piece of music, we have to go through the process of importing and replacing it each time. If we could have it load from disk, all we need to do is overwrite the file.

    If you save your project as a folder, don't you get this already?

    *Facepalm* - yeah. Forgot about that.

    ome people want to make EXE-only games - it would be very, very nice to preview directly via the output method they're going to use - no having to wonder if the game is going to work differently via the EXE exporter (bugs in awesomium or such, etc). A lot of bugs are found when testing other stuff in the preview - having to do a whole extra round of testing specifically for the export would be extremely inconvienent, especially for large games like an RPG!

    I admit this is probably the best reason for making an EXE previewer. But if we can get it working nearly identically to Chrome, I still think that's a better solution. Hopefully the EXE exporter can literally be Chrome in its own window.

    I have to disagree here. I still think it's important to preview the game as it will be delivered, as well as a complex game could potentially expose previously unknown bugs. Also, I just feel... uncomfortable with the idea of shipping a game that I didn't test thoroughly in its shipped form.

    hat's worse, is when previewing via a browser, that's 2.5/5 MB shared for ALL games made with construct 2!

    The limit, if any, is per-game. However it is most likely any limit can be removed anyway.

    Per game if it's EXE, sure, but with web browsers it seems that the webstorage for all C2 games that I'm developing show up in the same keys list under resources in chrome - which implies they're sharing the same 2.5/5 MB limit. Is that incorrect?

    ebstorage issues - as browsers have limits of 2.5 or 5 MB for webstorage...

    This is only because browsers operate on the open web. The limit can be removed in Awesomium. I'll check if this is done already or if we need to do something.

    That would be fantastic, but it still runs into the problem:

    I'd prefer not to add a preview option for EXE if it basically works the same as the Chrome browser.

    ...that it doesn't work the same if EXE has no limit to webstorage and browsers do. Most of the benefits of unlimited webstorage are for while developing the game, rather than after export.

    I understand your reluctance to add EXE-only features, and if sandbox you mentioned was implemented and especially the limit for webstorage was removed, I guess I'm okay with no direct to disk file I/O as it won't limit us that much, but I still strongly feel the need for previewing as EXE for the webstorage limit reason alone, and also I still think it's important to preview a game as it will be played. Would it be difficult to add it as a feature? Because I think a lot of people would use and appreciate it.

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