PLEASE GOD make an undo last feature

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Re: PLEASE GOD make an undo last feature

Post by hertogjan »

I would imagine that undoing construction is relatively simple. One can just memorise the last action, (e.g., construct object x at tile y), and then undo that action (e.g., destruct object x at tile y). As far as I know, everything that the player does is handled internally by the DoCommand function, which is also responsible for sending information about player actions in network games (correct me if I'm wrong). In theory, remembering the last DoCommand will be enough to undo it, if it comes to constructive actions.
But if it comes to destruction, then things get complicated, since the information about the objects that have been removed is destroyed. That means that if you want to undo destruction, then you have to memorise all information about the objects that have been removed. Just remembering that you used the dynamite tool on tile y does not have enough information for undoing that action. In other words, remembering the last DoCommand is not enough to undo the action if it comes to destructive actions.

To summarise: It is almost impossible to write an undo feature that is able to undo all possible player actions, since some actions destroy information. To write an undo feature that remembers enough information about every action that is done is enormously complicated.
And it is certainly too much work for too little gain over the current situation (loading the last autosave).
Mchl
Director
Director
Posts: 611
Joined: 05 Jan 2007 15:50
Location: Poland
Contact:

Re: PLEASE GOD make an undo last feature

Post by Mchl »

cmoiromain wrote:
Mchl wrote:You already can auto-remove signals along the line.
How can you do that? I only knew of the auto signal tool...

Same way you auto-place signals. You just have to have a remove tool (a.k.a bulldozer) selected.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: PLEASE GOD make an undo last feature

Post by DaleStan »

hertogjan wrote:I would imagine that undoing construction is relatively simple. One can just memorise the last action, (e.g., construct object x at tile y), and then undo that action (e.g., destruct object x at tile y). As far as I know, everything that the player does is handled internally by the DoCommand function, which is also responsible for sending information about player actions in network games (correct me if I'm wrong). In theory, remembering the last DoCommand will be enough to undo it, if it comes to constructive actions.
But if it comes to destruction, then things get complicated, since the information about the objects that have been removed is destroyed.
And a substantial portion of construction involves destructing the current contents of the tile. Trees, especially.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
hertogjan
Director
Director
Posts: 560
Joined: 03 Jan 2006 20:45
Location: Netherlands

Re: PLEASE GOD make an undo last feature

Post by hertogjan »

DaleStan wrote:And a substantial portion of construction involves destructing the current contents of the tile. Trees, especially.
It depends whether you really want the tree back if you undo construction on a certain tile. If you accept to undo the construction without getting the tree back, then it is relatively easily coded. If you want to have the tree back, then you have to remember that there was a tree (and even what type of tree(s)).

And I believe that what the "people" want is to undo accidental destruction. Undoing construction by hand (i.e., by using the removal or dynamite tool) is done quite easily, so that writing a patch for an undo feature for construction only it is a little bit silly. But unfortunately undoing destruction is much harder to implement, as a stated in my previous post. Due to the complexity a genuine undo function will not be implemented. Maybe a feature that lets you reload the last autosave with a hotkey, but not more.
dihedral
Tycoon
Tycoon
Posts: 1053
Joined: 14 Feb 2007 17:48

Re: PLEASE GOD make an undo last feature

Post by dihedral »

you guys are very much thinking in visuals, "what is on tile A" and "what was on tile A". step aside, and stop thinking with what you can see on your screen when looking at any one tile, and consider some other things.
perhaps town ratings (as one possibility).
anything done with a single tile has an affect on the entire game (uh - i remember this being said a few times before...)
as it is possible to memorize what tile A 'looked like', it is not easily possible to undo everything that a single change to a single tile has an affect on.

the best thing you can start doing, is using your own little thinker to memorize things. and yes, i am aware of the fact that you cannot reconstruct town buildings after you demolished them.
but coming back to the background influence a change to any tile has on the game and your 'feature' request of an undo function, i really hope you can start grasping why this is not really an easy task

if not, start considering some certain random factors: you do not want to go back in time, you just want to remove (or rather undo) your own actions (construction / destruction)
meaning what a town builds should not be undoable, but what you build should (though continuing in time)
imagine the following: you build a train route past a town, demolish some rail tracks as you would like to enhance them or whatever. you notice you dont have enough money to build the new tracks or perhaps even a station and want to undo the action. in the mean time however the town started construction on tiles you would like to undo (perhaps even finished building 2 buildings, which causes the town to now accept goods)
.... wow - this might turn out to be a real muddle-up!
i hope you can follow this. it shows a partially randomness in the game you cannot controll, nor is it your desire to undo this action - however it has a huge impact on the game.
and it is also a very 'basic' example, showing how actually it is not that 'simple' to start undoing.
Mr.Killer
Traffic Manager
Traffic Manager
Posts: 147
Joined: 31 May 2005 10:41
Location: Netherlands
Contact:

Re: PLEASE GOD make an undo last feature

Post by Mr.Killer »

I totally agree on the complexity of such a game, i did back in the eighty's a lot of programming in basic's and machinecode and that was kinda hard back then.. So i agree with dev's decision.
My solution if i want to replace a airstrip, i save first and try to build bigger. If it does not accept building a bigger airport, i build in that town some trees and try again. That mostly works all the time, but you got to have money.
One day i was trying a hard game without industries only towns, builded two stations and along building my money was depleted, no income, deleting would cost me more, tracks deleted would not bring enough money back so that i could finish the line in order to make money. I had to start all over again and wishing there was a undo button.
Making this short: It takes a whole lot of power to make things undone, one can make a mode where all progress will write to disk, thus rendering it some kinda savegame'ish mode, but, You can do that instead without the mess... It is possible to write all human actions in memory but when getting it back it can ....-up (nasty word) the whole game making it unstable.
So i agree, it is very hard to build, letting it be there don't you think? Be smart and save before making desastrous changes...
No hard feelings.... :wink:
Bla bla, and may the force be with you!
Never knew I was gonna say that! ;-)
el koeno
Route Supervisor
Route Supervisor
Posts: 454
Joined: 24 Sep 2004 15:47

Re: PLEASE GOD make an undo last feature

Post by el koeno »

dihedral wrote:you guys are very much thinking in visuals, "what is on tile A" and "what was on tile A". step aside, and stop thinking with what you can see on your screen when looking at any one tile, and consider some other things.
I think it is you who's overcomplicating things. Don't get me wrong, you have a valid point, but it was acknowledged quite a few posts back. This is why people suggested the "slimmed down" version of ctrl+z. It would just save you from having to manually remove erroneously built track. It would not have to restore the situation exactly as it was. If removing or rebuilding the object in question is impossible, pressing ctrl+z would do nothing.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1794
Joined: 30 Mar 2005 09:43

Re: PLEASE GOD make an undo last feature

Post by peter1138 »

Some user in the future wrote:Why can I undo this but not this?
To clarify, there will not be an undo feature, and no amount of arguing will change that.
He's like, some kind of OpenTTD developer.
Stienie
Engineer
Engineer
Posts: 80
Joined: 02 Aug 2008 12:35
Location: Den-Bosch (The Netherlands)

Re: PLEASE GOD make an undo last feature

Post by Stienie »

Or because the most fouls are with the dynamite tool, a max dynamite a time, so cou can just slop 8X8 a time
Scenarios: http://www.tt-forums.net/viewtopic.php? ... 35#p715935
Yeah, I need to update it. Some of them are like crap. I made them when I was ten or something xD
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=45027
Not many right now, but they're coming.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 7 guests