File Saving - Is There Any Hope?

Get help using Construct 2

Post » Wed Nov 20, 2013 9:45 pm

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
jambon2013-11-20 21:51:06
B
5
S
1
Posts: 8
Reputation: 491

Post » Wed Nov 20, 2013 10:02 pm

"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

Aphrodite2013-11-20 22:03:48
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed Nov 20, 2013 10:04 pm

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?
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Wed Nov 20, 2013 10:09 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Wed Nov 20, 2013 11:09 pm

@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.
B
16
S
6
G
2
Posts: 152
Reputation: 3,764

Post » Wed Nov 20, 2013 11:35 pm

@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
B
5
S
1
Posts: 8
Reputation: 491

Post » Wed Nov 20, 2013 11:47 pm

@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!
B
16
S
6
G
2
Posts: 152
Reputation: 3,764


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests