Load Save Fail

0 favourites
  • 10 posts
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • Why would a System>Load savegame fail?

    I have a button for running the System>Save and that completes, but when I go to the Load it keeps triggering On Load Fail. What exactly causes that? How would I test the actual save game is there? where does it save it? would I see a savefile in the runtime directory?

    I tried a small example project and it works for me in the small example. However my game is somewhat large and I wonder maybe that has something to do with it? Are there any limits?

    Also will Loading save-games automatically switch layouts? I'm loading from a different layout.

    EDIT: testing this on NWjs export

  • There is a limit to how much you can put into local storage, but the save state should be fairly small.

    That doesn't mean you're guaranteed to have enough room if its already pretty full.

    You can download the save as json and look at it, but that's really only good for seeing how big it is.

    If it is big there's not much you can do to alleviate that other than reduce how much you have stored in the browser.

    Then of course if its still giving the error loading start by removing the third party plugs and go from there.

  • newt interesting stuff about the json... I will try that

    but if its too big would the save work and not the load? seems like the save would fail.

  • also I'm not using the No Save behavior on anything... mostly because I don't really understand where I would apply that... the doc says to background objects and HUD, but don't you need those recreated when you load the savegame?

    Is a layout loaded with everything it starts with? I don't really understand the process and the doc is somewhat lacking on how it applies to an actual layout.

  • okay not sure what did it, but I changed the name of the save slot and then gave a bunch of background objects NoSave behav and now its working like a charm!

    only probably now is... all my Trigger Once events retrigger!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • okay it seems like if I make a boolean GameLoaded = false

    Start of Layout -> GameLoaded = false

    On Load Complete -> GameLoaded = true

    Trigger Once While True AND !GameLoaded

    do whatever

    seems like this works... so I assume Start of Layout is not rerun??? so if I have pins or destroys will that be a problem??

  • Existing objects referenced in the save will be over written. Objects that don't exist in the layout will be created. Objects that aren't referenced by the save that exist at the time the load is made will be unaffected afaik. So yes start of layout is still run, but only at the start of the layout. Loading will overwrite that if its in the save. No save is usually not that important. You would use it like if you were designing a level and didn't want the bad guys to spawn with the load.

  • newt ah, so the layout is started then the load happens? in that order?

    I have the On Load Complete Trigger in an #include in the event sheet. Is it wise to set a flag On Load Complete Trigger, that says we came from a load and not a natural layout start? Will the flag be overwritten by the Load or the Start of Layout?

    I need to turn the flag off in the Start of Layout in order to make my Trigger Once to run (once). but if I came from a Load I don't want it to run once if it already ran once...but what if they save before the Trigger Once? oh man.. how do I do this?

  • You can load anytime you like, but it will overwrite everything it references.

    I would use a global to say what happens at the start of layout.

    That also tells you if its a regular start, or load, so a trigger at the end is not real necessary.

    I would use on load complete like if you wanted to pause the game IE timescale at the time of the save, the change it on load.

    Obviously trigger once can't be saved as a state. Can't help you there...

    Variables might work better since they can work the same way. As in changing the variable works as a trigger.

  • newt that's a good point... I probably need to replace my all my Trigger Once with bools

    I have one scenario where pirate ships spawn in on a random timer, predetermined outside the layout. Once the layout start it knows pirates are coming, the timer starts. It's all kicked off by a Trigger Once The player can save at any point:

    • before pirates are spawned (timer is running)
    • while pirates are here and attacking player
    • after pirates spawned and player destroyed them already

    but I should be able to figure something out... this will teach me to not put off my save-game logic for so long!

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