Saving Unique File... But only few times? - (project bug)

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • And I think, you need to start learning something new, something useful and indeed extremely powerful... Arrays! They will improve undo/redo system so much. Just sit down and start learning. I mean really, nowadays there thousand of books/videos/tutorials on the internet, arrays is not something that is very complicated (although it might look like that at the start) compared to some other "programming stuff".

    Totally agree with this advice, I'm always RUNNING AWAY from Arrays, not because it's hard to understand.

    It's actually very logical, data based on Rows and Columns... blah blah blah, this has NEVER been the issues for me.

    The real issues was how to actually USE Arrays in C3... when it start the confusing: JSON (thinggy) AJAX (thinggy) things that doesn't make sense to me and so many properties for them that I can never GUESS because I don't know the programmers-terms, while in general it's just inserting data to the specific Array, change it, remove it, and other stuff that my non-programmer noobish brain can understand. but as always as soon as I get to C3 I'm scratching my head and don't know what or how to accomplish what's on "the paper".

    So I tried so many times to use arrays (from scratch on simple projects) in order to learn it specific in C3 since that's what I'm using... I always run away screaming and try to avoid this powerful tool (I just know how POWERFUL arrays can be) this is sad but... oh well.

    BTW - The UNDO/SYSTEM by dop2000 is based on a simple Array object. :)

    For now, I'm learning a lot (slowly, but learning a thing or two) while working on my current project with a HUGE thanks to this awesome community.

  • Add a condition "isUndoSave is NOT set" to the "SaveStep" function. This will guarantee that another save will not start until previous save has finished. If you are saving too often, or the save size is too big, some undo steps may be skipped, but this is a minor issue comparing to all the bugs you can have from multiple simultaneously running saves.

  • Add a condition "isUndoSave is NOT set" to the "SaveStep" function. This will guarantee that another save will not start until previous save has finished. If you are saving too often, or the save size is too big, some undo steps may be skipped, but this is a minor issue comparing to all the bugs you can have from multiple simultaneously running saves.

    Wait, before I ruin anything... I don't understand what do you suggest:

    SHOULD I do what you just suggested (edit the function)? or I rather not do that? what option is LESS risky and most efficient?

    I'm asking because I really don't want to screw the way the all UNDO system currently works.

    because so far everything works GREAT... but again, tested only on my personal machine as I develop it so that's not the best indication.

  • Why don't you just add and test? You could have done it in time you spent typing your comment..

    I was telling you many-many times - you need to prevent multiple saves from running at the same time! Adding this condition to the function will do exactly that.

  • Why don't you just add and test? You could have done it in time you spent typing your comment..

    I was telling you many-many times - you need to prevent multiple saves from running at the same time! Adding this condition to the function will do exactly that.

    I just added the "isUndoSave is NOT set" to the "SaveStep" function:

    but to be honest, I got confused now... if I disable the Group: "MOUSE WHEEL - Cooldown" where the code.

    and ADD back again the "SaveStep" function to "On mouse wheel up" and "On mouse wheel down" (where the first ORIGINAL crashes used to be) still creates zillions of saves which make sense.

    But... it's NOT crashing (so it does what you're saying 1 save per time) which sounds pretty much SAFE to me.

    But there are ZILLION of undo saves since it's not saving ONLY AFTER the Wheel Scroll is finished but on every tiny scroll which is not functioning very well when I undo (too many undo's saved created to go back with no actual change between the Z-Order).

    MAYBE: the ALTERNATIVE approach should be based on the action itself and not the input?

    I don't know how to accomplish such thing (I tried), is it possible to call "SaveStep" AFTER every Z-Order change INSTEAD messing with the Scroll Wheel?

    It's probably a bad idea, but in my simple logical brain it seems like a nice alternative, I just have no clue how to do such thing in C3, I didn't find any option similar to: "On Every Z-Order change" or anything like that.

  • Yeah, that condition prevents crashing. That's why you should absolutely definitely keep it.

    But you should also try to minimize the number of unnecessary saves, it's up to you how you do it. To tell you the truth, I've lost track of your changes a long time ago.. :) You can add a cooldown period, wait for a pause in mouse wheel scrolling, or require holding Ctrl or some other keyboard button and save undo step when it's released. Or there may be other methods, I don't know.

    You can invent a system that monitors z-order of all objects and signals when it changes, but I don't think it will worth the effort.

  • Yeah, that condition prevents crashing. That's why you should absolutely definitely keep it.

    But you should also try to minimize the number of unnecessary saves, it's up to you how you do it. To tell you the truth, I've lost track of your changes a long time ago.. :) You can add a cooldown period, wait for a pause in mouse wheel scrolling, or require holding Ctrl or some other keyboard button and save undo step when it's released. Or there may be other methods, I don't know.

    Thanks I will keep it, no crashes is the highest priority for now that's for sure.

    Weird extra UNDO saves for the the Z-Order using the wheel only is better than extra delays.

    I wish I could just have a way to add "SaveStep" for every Z-Order change of this family instances.

    My brain is already on other much more interesting missions I can barely track this myself anymore hehe

    but... as I said, no crashes is first, UNDO is the core of the system so I can't just ignore it.

    I'll play around with some delays or just get back to the Release CTRL if I'll have no choice...

    Thanks again for everything! :)

  • Me again...

    I didn't want to make a new thread because this issue is somehow related to the SAVE that I thought we solved, but it appears in a different situation:

    THIS TIME!

    Starting to make a tiny scene in my software creating few objects, tweaking them, changing size, rotate, etc.. SAVING at first few times works like a charm, I can save, load, import etc..

    So far so good! :)

    .

    BUT THEN!

    I started to "TEST" my software by adding MORE objects and having fun... so much fun that I almost forget I'm TESTING it... the save ISSUE/BUG is back: when I click "SAVE" nothing happens.......

    I didn't expect it because I thought we've already solved this with the mighty help from dop2000!

    Since that change we did with the GROUPS to enable/disable I didn't even touch the Save/Load section.

    .

    TESTING:

    So, the first I did is trying to check out what's up via the Console, and I actually can see that I click and IT IS "TRYING" to save.. but it's waiting for me to save, the PROBLEM IS: there is no SAVING WINDOW so I cannot save, it's like it's not popping up so whenever I click SAVE again it will just requesting another "invisible" saving window that I cannot see (because it doesn't exist) and that's why it's kind of stuck and I can't actually SAVE!

    I also tried testing FEW MORE TIMES (without using UNDO/REDO and with) it doesn't matter, the SAVE is sick.

    Last time it was a random saving related to undos and other mess, this time... it's PURE SAVING issue... (or NW.js issues? I wish I knew).

    When I cannot SAVE I just quit the software and the console give me that SAME warning:

    So it's obviously WAITING for saving but... WHERE IS THE SAVING WINDOW ?

    I didn't see anything strange on C3 Debugger, and it's obviously related to the NW.js "SAVING WINDOW" is not there anymore... but still wants me to SAVE AS and click OK... so it waits, I don't know how to explain it better.

    I'm starting to think it's a NW.js issue because it's like the window is "SOMEWHERE" but in none of my screens waiting for me to save the file and continue creating my stuff.

    .

    Any ideas how can I test it in different ways?

    How do I track down the issue?

    Maybe I need to CHANGE something in the code like to limit the saving ONCE per window appearing or something weird that I can't even think how to do?

    I cannot replicate this to a fresh new project, it must be tested on my current project version because it is most of the code anyway... ANY suggestions are very welcome and appreciated!

    Thanks head!

  • OK! I think I'm on to something, but I'm not sure what it means!

    I think IT IS related somehow to the UNDO/REDO after all (again I DIDN'T TOUCH IT or the SAVE/LOAD since last time).

    TEST #1:

    My latest test was CREATING and cloning more objects UNTIL THE SAVE ISSUE happens:

    When I cannot save, I UNDO few times until I CAN SAVE AGAIN! the window is working...

    TEST #2:

    When I REDUCE the MAX UNDO to 10 (from 64) I can create MANY more objects on the screen without the issue to appear... and it happens again (I didn't eliminate it by reducing MAX Undos)

    I don't even have to use CTRL+Z to undo while creating, it's probably something about how many undo saves it creates in the background, but I still don't understand HOW it's related to the SAVE window?!

    Size of the project file is about 1MB saving and loading VERY fast:

    10 UNDOs is not enough for what I'm trying to achieve it is not enough... 32 still brings the issue back

    Could it be related to MAXIMUM save in a way? if so... why it won't let me save?!

    TEST #3:

    When I load the above project file and add 1 MORE OBJECT (or clone it) the SAVE ISSUE appears immediately, even if I just run on from a fresh C3 Preview (clean NEW project without UNDO's or anything).

    Current Saving System:

    THE (stupid) walk-around:

    Whenever the Saving Window doesn't appear I UNDO (Ctrl+Z) and REDO (Ctrl+Y) and I click the SAVE button and the SAVING WINDOW appears normally and allow me to save...

    Maybe these experimental tests can help hunt down where the issue is and how do I eliminate it?

  • Why the save size suddenly goes up from 50KB to over 3MB when you click save? It should be the same size as when saving Undo steps. This is not normal, there must be some other event in your project that's causing this. Maybe you also take a snapshot of the screen and load it into Binary data or something like that. 3MB save is A LOT, and it explains why there is a significant delay in displaying the "Save as" dialog.

    If you can't figure out why this happens, try to analyze the .alon file, see maybe there is a huge block of data that shouldn't be there, or thousands of small ones.. Try this tool for example:

    debugbear.com/json-size-analyzer

  • Why the save size suddenly goes up from 50KB to over 3MB when you click save? It should be the same size as when saving Undo steps.

    Another weird thing, I noticed that What shows in the console 3MB is NOT the size of the file at the end as I mentioned it was 1MB (or less) for the specific file I saved (as shown on my early post).

    This is not normal, there must be some other event in your project that's causing this.

    As you can see on the screenshot above there are more then few objects on the screen, it make sense that the file will become bigger compare to an empty canvas, right?

    And when the user will put more and more objects on the screen I guess it will get easily to 10-100 MB or MORE because of so many objects on the screen, but I don't know why it is sooo HUGE! it's weird.

    Maybe you also take a snapshot of the screen and load it into Binary data or something like that. 3MB save is A LOT, and it explains why there is a significant delay in displaying the "Save as" dialog.

    As I explained above, I did NOT change a THING from your original system SAVE/LOAD and UNDO/REDO

    On my tests I ONLY click the SAVE button, no export, no nothing... pure clicking SAVE button so why should it even take a snapshot? especially after you helped me separate the LOAD/IMPORT to groups I thought it will make better managing instead of hidden clashes that I can never find.

    YES! it is not just a lot it is HUGE! and that's only for few objects... what will happens when an actual creation FULL of objects on the screen? 200MB file?! this is not normal indeed.

    If you can't figure out why this happens, try to analyze the .alon file, see maybe there is a huge block of data that shouldn't be there, or thousands of small ones.. Try this tool for example:

    https://www.debugbear.com/json-size-analyzer

    Thanks! I will try this and have a look, I'll also try: EMPTY file and File With few Objects created, before I'll update in here.

    One thing I know for sure is that I did not put "No Save" on my menu Buttons (Save, Load, Export, Import, Quit, etc..) it is temporary because I have some issues with the Tween of their panel when not saving them (maybe I'll use containers! thanks to you I just discovered this feature!)

    But when I checked the difference it was about 10k without buttons, that's not the issue.

  • Undo system uses the same Save action, so the size of saved data should be the same. And yet undo save is 50KB, but moments later normal save is suddenly 3MB? That's 6000% increase!

    There had definitely something else happened between the last undo and you clicking the save button. My guess is that it has something to do with snapshots, drawing canvas etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh... I see! so basically the size of the files shouldn't be HUGE even if there are ZILLION of objects on the screen?

    You sure got a point! you know what you're talking about while I can only guess, RESPECT! :)

    OK, so I followed your suggested JSON analyze website, I copy-past the inside of the files.

    I see how it split the sizes from above but as soon as I get inside to explore... beside (number instances) I don't understand anything, I guess analyzing won't help me as a non-programmer it's all numbers that I can't relate or understand... at least I tried.

    .

    Maybe this will make sense, here are 2 files I've SAVED from my software:

    1 - THIS FILE saved STRAIGHT away as soon as the software opens, No Objects created! SIZE = 23kb

    2 - THIS FILE saved AFTER Creating 10 Objects! SIZE = 225kb

    I did NOT use Undo or Redo, or Import or ANY OTHER button, just to help hunting down the issue.

    I wonder what it is that causing the size go HUGE beside extra objects on the screen?

  • 220KB for 10 objects seems normal. 3MB is definitely not.

    Open the browser log and keep an eye on the save size. You need to try to replicate the problem when the save size suddenly jumps to 3+ MB and then try to save that huge file. (You may need to wait some time for the "Save as" dialog to appear)

    If you manage to replicate it, maybe it will become obvious to you why this happens. If not, then post the saved file, I'll take a look.

  • By the way, the biggest object in your 225KB file is "TempArray". It doesn't need to be saved. You might want to clear it before saving, to decrease file size.

    Add "TempArray Set size to 0" at the start of event 185

    Come to think of it, this is probably the reason why your normal save size is suddenly so big. The more undo steps you add, the bigger TempArray gets.

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