Load Game and New Game with Autosaves not working

  • #1, by tom-barnetThursday, 26. August 2021, 23:24 2 years ago
    Hi all, I am having tremendous trouble setting up a simple Load game/New Game interface and I am not sure if I am doing something wrong or Visionaire just bugs out. Please help me, as I am completely desperate at this point and don't know what else to do.

    I have two menu screens in my game. Menu 1 appears when you start the game, Menu 2 is accessible during the game. I opted to use only Autosaves, because I do not want a preview picture of a saved game and I need only a single savegame (slot).

    If you start the game for the first time, there is just the option to start a new game in Menu 1. If you however played it before and run it again, a Continue game button appears here. This button has the preset condition to false.

    In the in-game Menu 2, there is an option to resume the game (no problem there) and New game (if you want to reset the game and start fresh).

    I use two Autosaves, Autosave 1 for in-game progress (usually after the character picks up some item) and Autosave 2 to save the beginning of the very first playable scene, so it can be used as a beginning of a new game when some progress in the game has already been made.

    The coding:

    Menu1 

    At the beginning of the scene action:
    If autosave 1 exists
    Change condition "Continue button" to true
    Else
    Change condition "Continue button" to false
    End if

    Object Continue button
    Left-click:
    If autosave 1 exists
    Load autosave 1
    End if

    Object New Game
    If autosave 2 exists
    Load autosave 2
    Else
    Switch to scene Level 1
    End If
    If autosave 1 exists
    Delete autosave 1
    End if

    Menu 2 (in-game menu)

    Object New Game
    Load autosave 2
    If autosave 1 exists
    delete autosave 1
    End if

    In Level 1 scene is an Execute Autosave 2 action at the beginning of the scene.


    How the game behaves:
    When I start the game and enter Menu 1, the Continue game option is sometimes there, sometimes not, even if I just freshly built the game. If I decide to click the Continue Game button, nothing happens at all. I can only click the New game button. When in the first level and I already picked up some objects and enter in-game Menu 2, I cannot restart the game by clicking New Game, the button just doesn't do anything again.
    What I don't understand is the different results I get every time I run the game even though nothing was changed. 

    Please help me, am I doing something wrong? (I'm fairly new to this programme) Or is this a bug? I would love to fix this or find out a way around it. At this point, the whole Visionaire work I've done is worthless since I cannot simply load or start a new game.








    Newbie

    37 Posts


  • #2, by afrlmeMonday, 30. August 2021, 11:45 2 years ago
    1. You only need to create the autosave used for new game once, so check in if queries if the autosave for that already exists & if not then create in the first scene or inside of a scene that consists of nothing but a black background before changing to the actual intended first scene. You also probably add a pause of about 1000ms before actually executing that save to make sure the scene is properly loaded first.

    2. It's a really bad idea to use the save system while you are still actively developing your game. Loading old save files can & will most likely generate random bugs that wouldn't occur during a fresh playthrough because the save files you are loading potentially contain incorrect data in them - because you edited/removed something in the ved, or missing information in general because you added new things to the ved file since the save file was created.

    In other words, the save system is only ok to use in the current play session of a game project that's still in development.

    3. VS sometimes has persistence issue. If you load a save game & play the game for a bit & then load a new game, it's possible that some of the values/conditions/Lua variables, etc that have been set during that playthrough might not get updated by the save game that you load. To be honest the best method for new game is to use the replaceGame() function, but that's something you need to setup when the game is ready to be exported/built as you link the replaceGame() function to the exported .vis file & it will load that while restarting the game like you would reset a console system - but you don't need to worry about that right now.

    Imperator

    7278 Posts

  • #3, by tom-barnetThursday, 02. September 2021, 21:14 2 years ago
    Thank you so much! It works now. The whole problem was that I didn't insert that extra scene that will act as a "new game" save and it was creating a big mess. Also, I purged any remaining autosaves within the editor by putting a delete autosave action at the very beginning of the game (before the "new game" scene), ran the game within the editor just so these are executed, and shut it down. Only then I built a new game and it works just fine.

    I am going to disable the autosave system while I finish the rest of the game. The whole point why i did it now was just to test if everything works using just the first level before i invest time in finishing the the rest of the game.

    In any case, thank you for helping meagain!

    Newbie

    37 Posts

  • #4, by afrlmeFriday, 03. September 2021, 11:42 2 years ago
    Ok dokie, no worries. I would however recommend looking into the replaceGame() method later on in your development as it's the only guaranteed method for restarting cleanly without actually closing & reopening the game. It requires a single line of code & the creation of an autosave file that you need to query on game start to see if the game should play the intro videos/go to the main menu, etc. or if it should immediately go to the first scene/execute the new game action parts.

    Imperator

    7278 Posts

  • #5, by johndanielsWednesday, 08. September 2021, 13:06 2 years ago
    Games stand as a great opportunity for people to develop their various skills along with entertainment. Although entertainment is the main purpose of games, it can help people to learn new languages and improve their language skills. There are many games that are intended to enhance the mathematical skills and knowledge of people. They can improve the words power, concentration skills, patience, and teamwork necessary to succeed in a game. More

    Newbie

    1 Posts