Important Dates

Latest Posts

Topic: Additional savegame speed option: Backwards

Seefahrer
Avatar
Topic Opener
Joined: 2022-04-29, 18:24
Posts: 58
Ranking
Likes to be here
Posted at: 2022-10-08, 17:35

Hello, while watching a savegame, I noticed, that although you can speed it up while it runs forward, and that you than also can slow it down again, the lowest point is "pause" - but why not making savegames able to get even more page down, so that after pause there comes "-1,0x", then "-2,0"x, and etc., just like it is with the speed on the forward running side. I would like that option, because when you see something interesting and then it is fast over again, I felt the need, to rewind the scene. This would make sense in my eyes, because a replay-savegame is just like watching a video from game, and videos, as we all know, cannot only be played forward and speed up forward and paused, but also played backwards and speed up backwards... Anyhow, I don't wanna say that that would be a sooooooooo important feature. I just thought it would be nice, if this option would exist, that's all. But of course there are way more imporant things to work on, I'm sure. It's just a thought which came to my mind.


Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2098
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2022-10-08, 17:49

The thing is, watching a replay is not like watching a video - it's like watching a match between AIs. I don't know if there is currently some code which can make Widelands run backwards, but I estimate that it could be a lot of work. Probably it would be easier to integrate some video software into the game which can turn replays into actual videos.


Wanted to save the world, then I got widetracked

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2029
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2022-10-08, 20:49

Big -1, rewinding time would be an enormous effort. Just not doable.

Video conversion could also be problematic, how would you pick which part of the map to render for every given frame? Rendering the whole map for every frame is possible in principle (that's sort of what an in-game screenshot does) but the resulting file would be gigantic.


Top Quote
Seefahrer
Avatar
Topic Opener
Joined: 2022-04-29, 18:24
Posts: 58
Ranking
Likes to be here
Posted at: 2022-10-08, 21:40

Ah, ok, understood. Sorry, I have no technical knowledge and just thought that it would not be a big Difference whether a saved game would got run forward or backward. I didn't know that it is that different from a video and that it would be that complicated. :-o So, of course that huge effort would not be worth that little detail, so please forget my suggestion, I'm retiring it. But thank you for explaining the topic to me! face-smile.png


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2724
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2022-10-08, 22:08

just to explain a bit further. During the game, all player actions are distributed over the network, so every client associated with a game gets this information. this is what makes our spectator function possible. for the replays this stream of actions is sved into a file. with the corresponding save file (created at the beginning of the game) you can watch the computer replaying all players in the game by just executing the player actions.


Top Quote
Seefahrer
Avatar
Topic Opener
Joined: 2022-04-29, 18:24
Posts: 58
Ranking
Likes to be here
Posted at: 2022-10-08, 22:41

Aha! face-surprise.png That is interesting! face-surprise.png

Thanks for outlining the details of how a savegame-replay works! face-smile.png

Edited: 2022-10-08, 22:41

Top Quote
dreieck
Avatar
Joined: 2018-08-25, 11:48
Posts: 72
OS: Artix GNU/Linux
Version: -git
Ranking
Likes to be here
Location: Germany
Posted at: 2023-04-21, 12:48

hessenfarmer wrote:

with the corresponding save file (created at the beginning of the game) you can watch the computer replaying all players in the game by just executing the player actions.

Does it mean that stuff which is decided randomly by the game engine is not determistically replayed during a replay?

If so, this can result in different replays (in some cases even with huge differences), depending on where the engine during a replay chooses to route a scarce ressource to, chooses to decide if an exhausted mine still mines a bit, chooses which tree a tree cutter fells down, etc., up to the point where a recorded player action would just not be possible (because a tree is still there, or the own area has not been enlarged yet because the military building is not finished, etc.)

So, are not only player actions but all events recorded?

Edited: 2023-04-21, 12:49

(empty signature.)

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2029
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2023-04-21, 13:11

We record only the playercommands, but the initial savegame also contains the initial state of the pseudo-random number generator. With this information, all randomness in the game is reproduced deterministically, so the entire replay will have the exact same state as the original game at any given time point. We additionally compute a state checksum every 0.2 seconds gametime to validate that there is indeed no divergence at all between replay and source game.


Top Quote