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
  • You wrote "if I just press and RELEASE CTRL by itself... it will create an UNDO"

    If you are using the flag correctly, this should not happen. When you press and release Ctrl or any other button, without actually changing any objects, undo step will not be saved. Only when anything about the object has been modified (scaled, moved on z-axis etc.), then you set the flag and undo step will be saved.

  • You wrote "if I just press and RELEASE CTRL by itself... it will create an UNDO"

    If you are using the flag correctly, this should not happen. When you press and release Ctrl or any other button, without actually changing any objects, undo step will not be saved. Only when anything about the object has been modified (scaled, moved on z-axis etc.), then you set the flag and undo step will be saved.

    Exactly!

    You still don't understand the issue... I NEED it to be saved why should I disable the undo?

    and it works fine but again... not as I need it to work, I described it few times above.

    I wish I could explain it better, sorry about my bad English.

  • If the undo needs to be saved, and it is saved, then why did you wrote that it is a problem and that it doesn't make sense? (your words, not mine) :)

    English is not my first language either, so there may be a misunderstanding on my part. Anyway, I hope you'll get everything working exactly as you want.

  • If the undo needs to be saved, and it is saved, then why did you wrote that it is a problem and that it doesn't make sense? (your words, not mine) :)

    English is not my first language either, so there may be a misunderstanding on my part. Anyway, I hope you'll get everything working exactly as you want.

    That's right, I believe it's a misunderstanding (probably because I can't explain it better) your English is GREAT!

    In overall: the most important part is that the ORIGINAL bug is gone.

    What I tried to explain above is that the current "solution" is not the most efficient one, and I wish I could find a replacement for it based on the cursor wheel ALONE (without holding a button and releasing for sake of UNDO) in other words: saving the Undo only AFTER I scroll without crashing, which is impossible since it's saving to the Undo History too fast and that's what causing the original crash so I MUST use an EXTRA key to release, so it will cool-down the rate of saving undos.

    What I was looking for is a way to do the SAME (save undo) but WITHOUT any extra keys while scrolling up/down... not possible unfortunately and very incontinent for my software and the users.

    BUT! I'll just move on since the error is not there, that's the plus! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AFTER I scroll

    Its easy to make custom event, that will be triggered when user stop scrolling.

    A quck example: drive.google.com/file/d/1CUUe5aoDkdxJyfV1KOWbCrcDPETb6ORH/view

  • > AFTER I scroll

    Its easy to make custom event, that will be triggered when user stop scrolling.

    A quck example: drive.google.com/file/d/1CUUe5aoDkdxJyfV1KOWbCrcDPETb6ORH/view

    YES!!! you're awesome rokstars322 THIS IS THE SOLUTION I was looking for!

    Thank you so much :)

    I wonder if someone could make this into a plugin or addon that could be used as a simple action because I could use it A LOT!

  • Note that this method waits for a pause in scrolling, which is not an ideal solution in your case. If you keep this timeout at 0.3s, for users who scroll slowly (when they want to precisely adjust object size), undo will be saved every 0.3 seconds, which is still too frequent.

    If you set a larger timeout like 1-2 seconds, undo step will be saved with a big delay, during which user may do something else, for example delete the object. And this again can cause the situation when two undo steps are saved at the same time.

  • Note that this method waits for a pause in scrolling, which is not an ideal solution in your case. If you keep this timeout at 0.3s, for users who scroll slowly (when they want to precisely adjust object size), undo will be saved every 0.3 seconds, which is still too frequent.

    If you set a larger timeout like 1-2 seconds, undo step will be saved with a big delay, during which user may do something else, for example delete the object. And this again can cause the situation when two undo steps are saved at the same time.

    Yes 0.3s is a bit slow (but safe) so I just did some tests and I stretched it to a faster delay such as 0.1 sec it works GREAT! even if I go like CRAZY FAST with the wheel I can easily undo back to the MAX limit on the UNDO object until it reaches the end "maxSteps" which I can easily change manually thanks to your dynamic Undo/Redo system dop2000! :)

    True that slow scroll is acting weird as you explained, but I don't see other way WITHOUT extra key to add for release to call the undo, so this is good for the Z-Order changes.

    I believe that it's very stable because it's only calling the UNDO function "SaveStep" AFTER as I wanted so it's emulating the same timing as I release a key real fast. maybe without the manual delay the scroll do multiple scrolls each time and it SUPER fast, that's the only reason I think it crashed originally.

    I WISH we had a built-in action for "AFTER WHEEL FINISHED" like this, it could be sooo useful for many things I do! I'm using the code by rokstars322 which is kind of tiny without the logs/coneole so it's still very nice!

    I'm sooo happy that it's solved and works exactly as I imagined! it is very efficient for my project :)

    UNDO / Memory Question:

    dop2000 I'm curious if you can tell me if it will be a problem if I'll push the maximum amount of undos from 30 to something like 64 or even 128 (which is too much but I'm curious)

    Memory wise... will this be an issue to old machines with 4GB RAM? consider there will be many objects on the screen that may also take memory.

    What is your suggestion about the maximum amount of UNDO'S for my software to keep it work nicely even on older machines?

    It's not that I'm making it FOR old machines, but it's always nice to have MORE machines be able to run my software.

    I still don't understand the Debugger/Profiler that should help me out with the memory and CPU (I GUESS?) so I'm asking in Theory if I should go for a HIGHER maximum UNDO limit without risk memory issues on older machines.

    I can always let the user change it with a menu I'll make but I'm talking about the defaults for now.

    Will 64 / 128 Undos be a REALLY bad idea? or not an issue at all?

  • Why did you make the delay even smaller? This means saving lots of unnecessary undo steps. Not only it can cause bugs, but also will make it more difficult for user to undo.

    Sure it works great on your PC, but on an older machine with a slow HDD saving a big project may take much longer time.

    Regarding the number of steps - it depends on the average size of each save. Add some objects, open browser console, it should tell you the amount of data saved, in bytes. Multiply by the number of steps - that's how much memory the array will take.

    I doubt you will run out of memory even with 256 undo steps, but a very big array may be slow.

  • Why did you make the delay even smaller? This means saving lots of unnecessary undo steps. Not only it can cause bugs, but also will make it more difficult for user to undo.

    Make sense, it's hard to make it work perfect for all machines but 0.3s may be too slow so I need to test it.

    Sure it works great on your PC, but on an older machine with a slow HDD saving a big project may take much longer time. 0.1s is probably good for my specific machine true I must play with it.

    The thing is that since it's ONLY be used for the Z-Order event my main goal was to immune that crash like an extra "Safety Layer" but I guess combined with the way the undo works I rather be careful and not use this cooldown for anything else so I won't cause delayed undos and a mess for the users.

    Regarding the number of steps - it depends on the average size of each save. Add some objects, open browser console, it should tell you the amount of data saved, in bytes. Multiply by the number of steps - that's how much memory the array will take.

    That sounds scary! because the user may create and tweak MANY objects over the canvas and tweak them around. From my current tests: I didn't have any issues with large amount of objects on the screen, no slowdowns no delays But once again... my computer is average+ I don't want to ruin the experience on older machines if it's an option.

    I doubt you will run out of memory even with 256 undo steps, but a very big array may be slow.

    That's encouraging! because I'm thinking about 64-128 UNDOS so I won't need to even give the user a need to change it manually.

    Thanks dop2000 that's VERY helpful!

  • And I'm saying that even 0.3s is not enough, especially if you anticipate users will be adding lots of objects. I've seen save/load actions taking more than 5 seconds.

    You need to make a proper system that doesn't allow two or more saves running at the same time.

  • I wonder, are you using "No save" behavior?

  • And I'm saying that even 0.3s is not enough, especially if you anticipate users will be adding lots of objects. I've seen save/load actions taking more than 5 seconds.

    You need to make a proper system that doesn't allow two or more saves running at the same time.

    OH MY! That's REALLY good to know, thanks for sharing your experience! it sounds too risky if so, than maybe I should consider go back to the addition Release Key + Mouse Wheel for the extra safety? what do you think?

    My older version (before the delay) I used CTRL + Wheel Scroll UP/DOWN and once Releasing the CTRL the save undo function execute.

    The problem was that even if the user just Press and Release CTRL by itself it saves extra undos, this is why I didn't like it...

    Maybe a better solution is to combine on: Release CTRL + Wheel Scroll Finished (without delay?) for giving the OPTION for the "Scroll Finished" I didn't try it yet but I'm curious if I should.

    Unfortunately I don't see other solutions for "After Wheel Released" WITHOUT any extra Releasing key beside the current one which may cause issues on different machines now that I realize it.

  • I wonder, are you using "No save" behavior?

    Yes, on anything that is not the instances such as GUI panels and such, anything that I don't need to save for next session.

  • And I think, you need to start learning something new, something useful and indeed extremly powerful... Arrays! They will improve undo/redo system so much. Just sit down and start learning. I mean really, nowdays 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".

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