Wouldn't you also need to store all status, inventory items, etc. right before ego enters the situation that kills him for the retry? Wouldn't that require modification at each danger point?
That's exactly the sort of challenge I faced at the outset. Most of the time, if you die it's because of something you immediately did wrong. Like step on the wrong trap in the Brigand Fortress, or fall down a hole in the Graveyard, etc. Those are easy. Just back track to right
before you did that one thing -- reposition ego, reset any views, undo any flags.
But my earlier example of destroying the spitting plants... you might do that early on in the game, and then forget about it... you could have done dozens of tasks and played through a handful of game days between destroying those plants and actually meeting the Dryad face to face. Others may approach the solution differently, but I decided on a minimally invasive approach to the Retry. In other words, I only change the one specific thing that caused you to die (and anything
directly related to it). Anything else you may have done after killing the plants still happened... time doesn't reverse, your stats aren't reversed, the only thing that changed is that Retry brings you back in the spitting plant room and the plants are alive (and the seed is out of your inventory and back with the plants). Now you can Retry to get the seed the proper way.
Similar thing if you died in battle, or because your stats were too low. I don't reverse any skill improvements you made. With the premise that this is a game and above all, should be fun... if you died because your character wasn't good enough, it would be incredibly frustrating to be put back right where you were, with skills still too poor. You're just going to need to grind again anyway... There are dozens of places where the hero can lose HP (and thus potentially die). I took different approaches in different contexts... in some, I revert the HP to before whatever caused them to die... in others, I just restore them to a token 50% HP or such.
And if people are concerned about "cheating" or getting a freebie or having an unfair advantage because they clicked Retry, well, it's not free... it's marked off in their Death List. That's why I not just mark the unique deaths, but the total number of deaths. You're still free to Save/Restore if you want the extra challenge. That's entirely on you.
I also don't remember, but does the Mandrake plant grow back if you take it in the daytime?
Even if it does grow back, I think if you try to take it the day you get the Baba Yaga quest it won't be there for you at midnight, resulting in an unwinnable state. Probably just having it spawn at midnight would solve this problem.
Also, I love the death achievement log! I'm not sure how you are achieving that, but I would love to add something like that to my current project...but I guess it includes a huge overhaul of the entire save/restore system. Still, I really love it!
The Mandrake is similar to killing the plants. It isn't a walking dead state, like not getting the seed on time. True, the mandrake doesn't respawn. But if you agree to get Baba Yaga her mandrake (and if you don't agree, you die) then you have 3 days to do so. If you don't do it in that time, you die. So I respawn the mandrake on that Retry. It may not be the most intuitive, and I may still tweak it, but I wanted to stay as true as possible to the original intent of the game... it's completely subjective... I'm just some schlub editorializing someone else's work. Obviously if you implemented this in your own project, it's entirely your choice to decide how to handle it.
Speaking of, I don't think it's as daunting a task as you imagine to retro fit it. Yes, I had to edit almost every script (and especially every script that had a death), but I wrote my modified EgoDead function so that I could fix things up piecemeal. I'll try and post the code later today in another thread, but basically, you can update the EgoDead function and change nothing else, and the game will properly recompile and all the existing Restore/Restart/Quit dialogs will remain unchanged. Then you can go through one by one, and update the existing Deaths at your leisure.