Undo more than once

  • TheBluePirate
    25th Dec 2021 Member 1 Permalink

    Okay, so I am genuinely so mad, I made a BOMB cannon that fires when sparked, I had fun firing it, then realized I COULD NOT UNDO MORE THAN ONCE, so the cannon I made which I still have not saved literally got destroyed

     

    Can we please just agree to fix Powder Toys undo?

     

    It's genuinely annoying

  • LBPHacker
    25th Dec 2021 Developer 1 Permalink
    You can already undo up to 5 times by default, but you can up that. Do note though, it's so low by default because snapshots (the history entries required for undo and redo to work) are massive and a high enough undo limit can cause TPT to run out of memory. This can happen even if your system reports low memory usage, if it limits how much memory TPT is allowed to allocate. TPT does not go out of its way to ask for this limit to be increased.

    As for "fixing" this, sadly, undo history in TPT is already as good as it gets. We can't just do what text editors do, which is to store the actions the user takes, effectively storing a copy of the text in a chain of undo history items, which overall aren't too much bigger than (i.e. some constant multiple in size of) the actual text in the buffer. This is because while in text editors, the only actor changing the data (the text) is the user, in TPT, there is also all the simulation code changing the data (the simulation). Thus, the history is actually a combination of the user's actions and the simulation code's actions. The latter would be even more expensive to store than what we do store right now, which is just differences in snapshots of the simulation taken when the user does anything.
    Edited once by LBPHacker. Last: 25th Dec 2021
  • TheBluePirate
    26th Dec 2021 Member 1 Permalink

    @LBPHacker (View Post)

     Well, that kinda sucks but hey it's the best you guys can do. 

  • 008cff
    16th January Member 0 Permalink

    @LBPHacker (View Post)

     also i have idea, what if instead of getting the actions made by the used, a file just stores every pixel gravity pressure and info of pixels on the screen, like a screenshot with each element no deco and another with the deco, but it gets erased when u get out of tpt, would that make it less memory usage or it would get bigger, asking cause screenshots are like 1mb or 2mb, or kilobytes

    Edited once by 008cff. Last: 16th January
  • ArolaunTech
    17th January Member 1 Permalink

    @008cff I'm pretty sure that's what TPT currently uses.