Save to disk using node-webkit

  • Hey there guys,

    I would like to ask you if there is any way to make Save/Load system for game that is not even meant to be played in a browser. I only plan to export it using node-webkit and I can't seem to find a way to save game state to hdd.

    Any help is appreciated.

    Thanks,

    Elci

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Webstorage should do the trick:

    Note that despite the name the WebStorage object does not use online storage. Since data is stored locally to the user's computer, it will work when offline, as well as for storing data like save games in offline exporters such as node-webkit.

  • Wow, thanks a lot, I certainly did not know that webstorage would work even when exported. I've read somewhere that using software like ccleaner would clear saved webstorage.

    Btw how hard is it to store large amounts of data (multiple large arrays etc.) with webstorage?

  • If you clear your cache or use CCleaner you will clear webstorage, yes. I'm not sure how it works with node-webkit. I haven't really used webstorage that much, but you could always just make a simple test youself.

    I'd say storing large amounts of data is relatively simple since you can use JSON for arrays, dictionaries (hash-table) and webstorage. I would have a look in the manual for more information on those subjects.

  • Under Windows, node-webkit exported games store their webstorage info at "OS:\Users[i]Username\AppData\Local[i]AppName\Local Storage", which is unaffected by users clearing their web browser's cache.

    I've tested CCleaner and it also leaves the data alone. Other cleanup applications might be more brutal, but I guess you could be extra careful and warn players against running these sorts of applications.

  • GeometriX:

    That's good to know, thanks for clearing that up.

  • Under Windows, node-webkit exported games store their webstorage info at "OS:\Users\Username\AppData\Local\AppName\Local Storage", which is unaffected by users clearing their web browser's cache.

    o you have paths for other operating systems? Linux and MacOS

    I've tested CCleaner and it also leaves the data alone. Other cleanup applications might be more brutal, but I guess you could be extra careful and warn players against running these sorts of applications.

    ctually it would be bit dangerous to clear random \AppData\Local\ directories. It could reset many apps to defaults and revoke licenses. Surely dirs could be scanned for known info but I don't think any cleaner will do that. Slow and not foolproof.

  • The built-in savegame system still works in node-webkit.

  • Is there a way to make the save data in app folder when we export using node-webkit GeometriX , Nimtrix , JoKiv, Ashley?

    not in OS:\Users\Username\AppData\Local\AppName\Local Storage

    Thanks

  • Why does it matter?

  • It would matter for things like Steam Cloud, transferring saves easily etc

  • Personally I'd like the option. From a gamer's point-of-view it's irritating to uninstall a game and then have to go hunting through obscure locations to clean out saved games, caches and other data. Being able to specify (a) "default folder" (b) "app folder" or (c) "My Docs\app name" for local storage would be a neat little feature, if it's not a massive hassle to implement. It'd certainly be a courtesy to players. Not sure how much control over this NW assumes and how much control we have on our side, though.

  • So im making a platformer editor in which the user can edit and position the objects in the game. Then he can save n distribute the result to others to play. The problem is when it is distributed, the objects will return to the default positions as the save file is not in the app folder but in the OS' appdata folder. Pls help. Thnks

  • Personally I'd like the option. From a gamer's point-of-view it's irritating to uninstall a game and then have to go hunting through obscure locations to clean out saved games, caches and other data. Being able to specify (a) "default folder" (b) "app folder" or (c) "My Docs\app name" for local storage would be a neat little feature, if it's not a massive hassle to implement. It'd certainly be a courtesy to players. Not sure how much control over this NW assumes and how much control we have on our side, though.

    agree, would be great to have it as an option

  • If someone wants to have easy portable game if would be nice to have optionally saves at same directory.

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