File Saving - Is There Any Hope?

0 favourites
  • 7 posts
From the Asset Store
Source File, music and art pack for Android Negotiator
  • I'm feeling pretty depressed at this moment... After lots of hard work and research I'm starting to wondering if the project I want to make is even possible with C2... My own fault though I suppose as I didn't do enough research before buying.

    If anyone could be so kind as to confirm or correct my findings it would be appreciated.

    Essentially, I'm looking to create a fairly large offline game for windows which requires the ability to save game states and to save levels created with an in-game level editor.

    From what I have found though it seems this is ONLY possible by:

    1) Using Web Storage - This has several problems such as a) Actual save file location is unknown. b) Very easy for user to accidentally delete all save data by running something like CCleaner. c) Very limited space available for saving data. d) Very easy for data to be erased if there are multiple players on the same computer.

    2) Export data from arrays to JSON files - The biggest problem with this being that it requires a file save dialog box to open and the user to specify a save location which just seems very unprofessional and clunky when trying to create a commercial title. It wouldn't be so bad if there was a way to customize the dialog box to match the design of my game and customize things like default save location...etc. Does anyone know of a way around this dialog box problem?

    3) Use the new HTML5 filesystem API - This is only supported by chrome currently (from what I read) and requires a bunch of permissions to be granted and I'm note even sure if this works with the web-node kit export option.

    Am I missing something that would allow me to be able to save files locally in the install folder of my game? Is it at all even possible for an offline game (can't rely on PHP to help here as most people don't have WAMP installed and running on their computers).

    ...Or have I just exposed the BIGGEST flaw with the idea of Construct using ONLY an HTML5 engine that will probably prevent any major titles ever being released on it's platform?

    Looking forward to any insight people can offer.

    Thanks

  • "2) Export data from arrays to JSON files - The biggest problem with this being that it requires a file save dialog box to open and the user to specify a save location which just seems very unprofessional and clunky when trying to create a commercial title. It wouldn't be so bad if there was a way to customize the dialog box to match the design of my game and customize things like default save location...etc. Does anyone know of a way around this dialog box problem?"

    I never found that unprofessionnal, also, you can imagine saving all maps into a folder inside the user folder (like "Userfolder/jambon games/GameFolder/custom maps/"& textbox.Text for exemple)

    EDIT: I am sure you could list files inside a folder too, so there could be a way to personnalize that

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Everyone should research the technologies they use prior to use.

    However why not just use NodeWebkit. you should be able to avoid the dialogue box entirely if you set the save location correctly. Then just make your own field for a save name. I don't see the problem if your doing a desktop executable.

    However what you are saying is that apparently MS Office, Excel, Photoshop and all sorts of others tools are not proffesional looking because they use the OS dialogue save location box?

  • Your insight limits you.

    A dialogue to confirm is just that. how come unprofessional ? I would guestimate someone deeming being informed of file storage to their computer, positive.

  • jambon

    Node-webkit seems the ideal solution for your project. I'm working on an offline game, as well, that requires storage.

    JSON data from user-created levels can be written to files with NodeWebkit. Set the path to the UserFolder expression or let them choose where to save it with a dialog--either way should work fine. You can then use WebStorage as a table of contents to index those saved files so the user can browse and find them, as required. If you want to avoid any pitfalls with WebStorage, save an index of user-created files (or whatever dynamic content) to the disk with NodeWebkit and then load that index file during the game. I.e. save a JSON file, such as an array or dictionary, that can by dynamically edited during the game.

    Likewise, with game states, the built-in save functionality can return a JSON string which can be written to disk with NodeWebkit. Using the save dialog lets the user choose where to save it, or you can use the UserFolder expression. No matter where the user chooses, you can access the ChosenPath expression to save the location of the file to an index (as mentioned above), so the game knows where everything was saved.

    Good luck, sir.

  • space Ape

    Thanks for pointing me in the right direction! I didn't realize that I could use the Node-Webkit as a action to write files locally! With all the searching I did on the forums the node-webkit option was never mentioned.

    I'm so glad that I don't have to scrap the project <img src="smileys/smiley4.gif" border="0" align="middle" />

  • jambon

    No problem, buddy. I'm using the nodewebkit functions a lot in my current project, so it was just good timing for you. :)

    Keep in mind that nodewebkit only writes text files, so don't try saving images or other things (at least not any way I've found), but JSON data from dictionaries, arrays, webstorage, variables, etc all work fine.

    Good luck with your project!

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