How do I create an autoload for game

0 favourites
  • 8 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • How do I use local storage to check if game should load automatically a saved game.

    1. I need this to automatically save the game after appr. every 25 minutes in order to prevent the game from crashing due to lack of memory purging. So my game saves every 1200 seconds and after save

    browser: reload

    in order to purge memory.

    After that I would like the game to check local storage to see if there is an autosave and load it if there is.

    I wonder what´s the easiest and best way to do this. I have tried to check if local storage exists but it seems not to work perfectly every time.

  • It should though.

    Check this tutorial that explains how to check for different systems if default values exists or not, and either set default values for it, or load them from the existing local storage.

    Also, there is possibly something inherently wrong with your project anyway since you are talking about lack of memory purging.

    You should pay more attention to your memory usage and how to lower it as much as possible.

  • Thanks. I will try to check out your localstorage system and see if it has something I need and understand.

    About this memory usage issue. Of course I could use less memory but it does not save it from being a bug or a problem yet to be fixed as you can see yourself from these:

    And in fact this issue can be achieved after 2 minutes of "game designing" so in that sense there are issues that can´t be fixed by lightening the game. For example this:

    I think that this is a memory issue and it can be achieved like this:

    Here is how to try if you got an error too without downloading anything:

    1. Open new empty project

    2. Insert sprite and paint it with some color. Don´t change it´s size (250x250)

    3. Apply physics and sine behaviours to sprite. Change movement horisontal to SIZE (in sine). Don´t touch the other sine attributes.

    4. Copy sprite 17 times and put them next to each other in 3 rows. 6x3 so to speak.

    5. preview and wait about a minute and get an error (at least I do)

    This might be a little bit offtopic since the original question is about autosave and autoload and I hope that if anybody has figured out some neat way to do it, it would be interesting to see.

    Thanks again

  • I used localstorage to check if there was a save (localstorage value was created when game saved itself after 1200 seconds). However it did not start always (sometimes did, sometimes not). So I made it so that the player must everytime actually tap Restore game button. Because of that I think that the localstorage is not needed in this. However I wonder if there is a way to tell game that player is coming from autosave -> browser reload and not from actual start.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Global variables' values and checks on the "On start of layout" that will check "where" you are coming from, as explained in the already linked tutorial.

    Same idea, same logic, only applied to your needs/program (in the tutorial is it a first execution ever, is it not; in your program is it the start of execution or not).

    Also none of the links you linked to are an opened/currently investigated bug.

    So if you have a case for a bug, do a proper report for it following the guidelines. Without proper opened reports, bugs won't get fixed.

    Closed reports are not being investigated further. And necroing them does not help bringing attention to them either.

  • Well, the browser reload function actually starts the game all over again so that´s why I think that game does not know from which direction the player is coming. I thought that after all and that´s why I think that some outside source is the answer. I wonder if persistent objects could also be an answer or a working localstorage (must learn it better)

    Those links are not investigated. That´s true. Should they be? Yes. Who´s fault is it? It sounded like my fault, but I think it´s not my fault...

    Btw. There.. in one of the links was a bug report so I am not making another on the same subject as the conditions are very similar and there has not been an answer to it. The memory leak is a known problem in construct 2 and making a bug report won´t change that. At least have not.

    Your last answer let a little bit a bad taste to my mouth as if this is somehow me to blame or my fault. So I stop here before I write something I feel sorry afterwards.

  • Kyatric. You still think that I should make a bug report even though there was unanswered bug report already? You are a moderator. Is it really so that you were unaware of the memory leak problem or are you saying it does not exist?

    I think you could open this up a little bit as you seemed to point a finger at my direction. I´d like you to answer since you opened the door to this kind of a discussion.

  • Yeah. I thought so too...

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