Newbie question about saving and loading games

  • #1, by nmvhSaturday, 14. May 2022, 20:48 2 years ago
    Hello!

    I'm new to this board, and currently learning Visionaire. There are a bunch of good video tutorials and docs out there, but I have difficulties finding much info about how to implement saving and loading of games for the newbie, like me.

    1) What actually is saved to a savegame? I would guess it's the current scene, the position of all characters, and the states of all conditions and values? Did I miss anything?

    2) I tried a simple experiment and made it so that when the player left-clicks on a certain object, the game is saved. But I can't seem to find the savefile anywhere after I run the game.

    3) An in-depth tutorial on the details of saving and loading would be much appreciated!

    Best regards,
    Nikolaj

    Newbie

    38 Posts


  • #2, by esmeraldaSaturday, 14. May 2022, 21:13 2 years ago
    1. you could take a look at the luadocs to see what gets saved.
    But yes, pretty much current scene, current character, all conditions and values

    2. the save files are stored in the folder of the game (subfolder in the AppData folder in Windows). Easiest way to find them is hovering over the save icon and click on "go to messages log"
    During the game you can call the console (hit TAB) and in the tab savegames you will find your savegame. It is possible to save and load using the console.

    3. there are not many tutorials on the save system. I used the one by Glenfx when I was starting. The tutorial was done for an older version and the Interface of the engine changed a lot since then, but the principle still applies. (part 7 creating the menu)
    https://www2.visionaire2d.net/glenfx/

    There is also a video tutorial by turbomodus (sebastian here), but that is in German.

    A good way is also to look at the template games (in the download section here) and see how they have done it.

    Key Killer

    508 Posts

  • #3, by nmvhSaturday, 14. May 2022, 23:50 2 years ago
    Thank you for the exhaustive and quick reply, I'll definitely follow every tip you gave. I'll be back with my report afterwards.
    Best regards,
    Nikolaj

    Newbie

    38 Posts

  • #4, by afrlmeSunday, 15. May 2022, 00:48 2 years ago
    There's also the advanced menu ved & resources I shared a number of years ago. It's not a tutorial or a plug & play template - it's just meant to be used for reference. It's a bit out of date as I probably created it in VS 4.x & VS has improved a lot since then & I have new methods for many of the things I do, but it should all still be relevant & usable.

    https://www.dropbox.com/sh/594t03agkg18e06/AAC6L2GOFjn_hrLl4...

    Imperator

    7278 Posts

  • #5, by nmvhSunday, 15. May 2022, 01:20 2 years ago
    That's great, I'll look that up too!

    Newbie

    38 Posts

  • #6, by nmvhTuesday, 17. May 2022, 21:03 2 years ago
    I've now gone through a lot of the material you suggested (have to say that the menu example by arflme was simply beautiful).

    I think I should clarify that I have no big issue with the part having to do with conditions and states, the use of if-clauses and so on.

    I think my main issue right now is simply: 

    a) how to perform a save? A load? When I perform the action "Load/save game" nothing seems to happen.

    b) Am I currect in assuming autosaves are saved as "bookmarks01.dat" and so on?

    Best regards,
    Nikolaj 

    Newbie

    38 Posts

  • #7, by afrlmeTuesday, 17. May 2022, 21:13 2 years ago
    Autosaves aka quicksaves generate the files with bookmark in their name, they are different than regular saves as they can be executed/loaded from anywhere, also they don't store a savegame thumbnail or the date/time that the save was created. You can create autosaves with the load/execute autosave action part with the execute option ticked & you use the load option to load the autosave. You can save autosaves into any slot from #0  to #99.

    You need to create an actual menu scene with save slots if you want to create regular saves with thumbnails. My advanced menu template shows how to setup the regular save system. All you need to know is that to use it you need to have been on a playable scene, then you change to the save/load menu scene you have created, click on a save slot & save/overwrite that slot & it should insert a thumbnail into it - quick note: it automatically defaults to the first available empty slot, so it's not guaranteed to insert the save into the actual slot you select unless it is the first available empty slot or a save game already exists in it, which in that case means it will overwrite it.

    Anyway, all I can really suggest is that you should carefully look through how I've setup the advanced menu template & also run it & try it out yourself to see how it works in-game.

    Imperator

    7278 Posts

  • #8, by nmvhWednesday, 18. May 2022, 06:15 2 years ago
    Ok, thanks for clarifying about the different behaviours of quicksaves vs regular saves. I will now study your example in-depth, as you suggest.

    Newbie

    38 Posts

  • #9, by nmvhWednesday, 18. May 2022, 06:59 2 years ago
    Afrlme, after studying your menu template I more clearly realize that the "actions" of a menu/scene are basically like functions in programming, callable when needed, and reducing the need of repetitive lists of actions.

    I have difficulty understanding where in Visionaire the "currently chosen savegame" is stored. I notice that when all is said and done, when the user presses "Yay" and some conditions are met, the action is simply "Load game" or "Save game". Well, how does the Visionaire engine know what game is meant to be loaded/saved?

    I guess the value "save_slot_number" is the answer, but that is just some user defined value, right? Or is it a special name reserved for load/save?

    Newbie

    38 Posts

  • #10, by nmvhWednesday, 18. May 2022, 12:15 2 years ago
    Tinkering a bit more, I'm slowly getting it. There is a "floppy disc" icon that is easy to miss in the MENU design screen (the only thing that is different compared to the SCENE design screen). Pressing this icon, and then marking some boxes over the menu background image, I somehow create areas where load and save left clicks will connect with actual savegames on disc. In what order these connections are set up remains to be investigated, I guess.

    Newbie

    38 Posts

  • #11, by nmvhWednesday, 18. May 2022, 12:18 2 years ago
    BTW, this explains why load and save screens need to be the same actual menu, right?
    With just a condition or value showing which of the two tasks (save or load) is the current one.

    At first, I thought it natural to create two different menus, one for save and one for load.

    Newbie

    38 Posts