Savegame/Loading for PC Game

0 favourites
From the Asset Store
A space themed game with high quality 2D graphics and addictive music that provide hours of fun
  • Hey there,

    Now i created a loading/saving menu in my project, which is gonna be a pc-game. I set up 5 text boxes in my loading screen. Now i'm wondering, how i can get

    the savestate informations like, player,some stats,playing-time and maybe a screenshot in there?

    Any suggestions?

    Thanks in advance!

  • Maybe make an ID system(Also making the player able to save to a name) using constructs function and random features(if you want multiple save files). and use an array and/or LocalStorage keys. Since it's a PC game I recommend using NW.js, it makes it easier and cleaner to set up some "safe" file directories. This will also make it easier for players to share save files. If you are making it for NW.js dont use localstorage.

  • BunnehBoy thank you guy for your advice! i think i have to research some more about all that stuff, cause i havent worked with arrays before!

  • Hi PulvererPeter,

    I recently wrote a small tutorial about saving/loading game with NW.js, maybe it could help you a little

    https://www.scirra.com/tutorials/4870/save-and-load-game-in-a-specific-folder-using-nwjs-node-webkit

    At least, it could show you some basic stuff and help you understanding how it works.

  • Ratmaster wow, this is great, gonna read it as soon as i can thank you so much and keep on doing that stuff, really helpful!

  • Ratmaster i just made a quick capx for trying your method, but i cant get the loading of the json file to work. can you tell me what im doing wrong?

    https://

    drive.google.com/file/d/0B-Ksnwlyt36SdlNlcXhwY3ZhLUU/view?usp=sharing

  • PulvererPeter

    I'm glad it could help you a little

    I just had a quick look at your CAPX file, and I see where the problems are :

    In your file, you wrote :

    On save complete -> NWjs | Write "" to file NWjs.UserFolder&"\Test\Slot1"

    • First, with this you try to write in "Slot1", but it must be a file, so maybe you should name it "Slot1.something" (you forgot to precise a file extension, so maybe no file was created)
    • Also, you try to write "" (an empty string...) so even if your file was created it would be EMPTY, so nothing could be loaded from it ^^'

    -> You have to use the SaveStateJSON expression to write the savestate

    => with something like On save complete -> NWjs | Write SaveStateJSON to file NWjs.UserFolder&"\Test\Slot1.something" it should work just fine

  • And you have to set "NW.js" as preview browser or it will not work ! (the first link in my tutorial explains how to install it if you haven't done it yet)

  • Ratmaster man i'm so thankful, you really helped me out! with your advice i could finally get it working fine thank you! i have one question though, what exactly is the difference between the normal "system-save and load" and the "json-save and load"?

  • PulvererPeter

    I'm glad I could help you

    Well, the normal "system save and load" uses json too, but it stores data in either WebStorage or IndexedDB

    (I'm not really sure where it is exactly), which are in theory "permanent storages" and are not affected by the user clearing their cache.

    However if he uses a program such as CCleaner, the savegame may be erased... (that's what appened to me ^^')

    So to avoid problems and prevent the user to lose his savegame, it's important to save the game in a file, especially if your game is a desktop application.

  • You wouldn't want your player to lose dozens of hours of game in a few seconds, except if he choses to erase his savegame himself.

  • Ratmaster ok, now i understand! you are really helpful and you seem to know quite a lot of the construct mechanics. thank you so much for your help!

    Sorry for bothering you, but may i ask you one last question? How can i access specific data from the json file? Like the level of a character, which i of course saved in a variable.

    Cause i wanna show that information in the loadscreen at the beginning.

  • PulvererPeter

    Well, I learned a lot from the official Construct2 manual and tutorials (I strongly advise you to check them as often as needed), and other users helped me now and then when I had questions ^^

    I'm sorry I don't know how to access specific data from the json file yet, I learned how tu use NW.js by myself a week ago and I didn't have time to learn that ^^'

    I'm interested in that too, so please let me know if you find a way to do so

  • By the way, if anyone could help us for that, it would be greatly appreciated

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ratmaster

    [quote:yzh5pxbv](I'm not really sure where it is exactly), which are in theory "permanent storages" and are not affected by the user clearing their cache.

    It save it under the name of the game (preview)

    C:\Users\AppData\Local

    and thank you for the tutorial

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