jmoerschbach
Topic Opener
Joined: 2019-09-26, 20:40
Posts: 24
Pry about Widelands
|
Posted at: 2020-06-19, 13:14
Hi,
regarding https://www.widelands.org/forum/topic/4755/?page=8#post-33564 and Github issue #3945
I need help understanding some fundamental requirements regarding replays and savegames.
So here is what I know/think:
we have 2 separate directories for save-files in .widelands: "replays" and "save". Whenever the player saves a current game, it is placed under "save" (both multiplayer and singleplayer games that are manually saved). But there is no manual "save as replay" afaik. So, the game creates automatically (in a specific interval?) files under "replays" while playing.
In the code, we have an enum class FileType { kShowAll, kGameMultiPlayer, kGameSinglePlayer, kReplay } which is used to differentiate the types and is saved along the file on disk (when you unpack a .wgf there is a preload-file which contains gametype=<number>
In loadOrSaveGame.cc (which is the basis of all loading screens) we differentiate according to this enum and create different flavors of the savegameTable/savegameLoader which only shows the files of the "right" type.
We have 3 different "entry points" for getting into a loading screen from the menu:
- SinglePlayer (Single Player -> Load Game)
- Multiplayer (Multiplayer -> LAN /Direct IP -> Host a new game -> Saved Game)
- Replay (Watch Replay)
The first two look into "save" folder (but showing only single player save games, that is gametype=kGameSinglePlayer , or multiplayer savegames that is gametype=kGameMultiPlayer respectively) whereas the third one looks of course into "replays" folder.
Is this behaviour generally accepted so far? It is quite a while this way already and nobody complained
Now the tricky part as far as I understand:
When watching a replay (Watch Replay and then select a file), the "player" (more specifically: the spectator) can once again save the replay. This results in a new savegame file located in "save" folder but with gametype=4 which is kReplay
So, from my point of view, we have now an invalid file in "save" folder which is filtered out and not displayed (as described above).
Thus, my big question to you guys is: What is the purpose of saving a replayfile again? And why is it saved in "save"-folder but with gametype=kReplay ?
Currently, I am not convinced that we have a bug here, rather a different behaviour many people seem to be used to. However, if I understood something wrong, please let me now and I'll be happy to fix
Edited: 2020-06-19, 13:22
Top
Quote
|
|
|
Nordfriese
Joined: 2017-01-17, 17:07
Posts: 2000
OS: Debian Testing
Version: Latest master
One Elder of Players
Location: 0x55555d3a34c0
|
Posted at: 2020-06-19, 13:35
jmoerschbach wrote:
we have 2 separate directories for save-files in .widelands: "replays" and "save". Whenever the player saves a current game, it is placed under "save" (both multiplayer and singleplayer games that are manually saved).
Correct
But there is no manual "save as replay" afaik. So, the game creates automatically (in a specific interval?) files under "replays" while playing.
When you start a game (or load one), the game will create a savegame immediately under ~/.replays (xyz.wrpl.wgf). Additionally a replay stream (xyz.wrpl) will be written during the game containing info about the playercommands sent while playing.
In the code, we have an enum class FileType { kShowAll, kGameMultiPlayer, kGameSinglePlayer, kReplay } which is used to differentiate the types and is saved along the file on disk (when you unpack a .wgf there is a preload-file which contains gametype=<number>
In loadOrSaveGame.cc (which is the basis of all loading screens) we differentiate according to this enum and create different flavors of the savegameTable/savegameLoader which only shows the files of the "right" type.
We have 3 different "entry points" for getting into a loading screen from the menu:
- SinglePlayer (Single Player -> Load Game)
- Multiplayer (Multiplayer -> LAN /Direct IP -> Host a new game -> Saved Game)
- Replay (Watch Replay)
The first two look into "save" folder (but showing only single player save games, that is gametype=kGameSinglePlayer , or multiplayer savegames that is gametype=kGameMultiPlayer respectively) whereas the third one looks of course into "replays" folder.
Is this behaviour generally accepted so far? It is quite a while this way already and nobody complained
Yes, this is what it should be like. There are sometimes comments that it would be nice to be able to load SP games as MP and vice versa, but this would not work out of the box in all cases and is not a big problem, so changing this behaviour is not worth the effort imho.
Now the tricky part as far as I understand:
When watching a replay (Watch Replay and then select a file), the "player" (more specifically: the spectator) can once again save the replay. This results in a new savegame file located in "save" folder but with gametype=4 which is kReplay
So, from my point of view, we have now an invalid file in "save" folder which is filtered out and not displayed (as described above).
Thus, my big question to you guys is: What is the purpose of saving a replayfile again? And why is it saved in "save"-folder but with gametype=kReplay ?
It used to be possible to continue a game saved from within a replay like a multiplayer savegame. That's no longer possible. This is what the bug is about as I understand it …
Currently, I am not convinced that we have a bug here, rather a different behaviour many people seem to be used to. However, if I understood something wrong, please let me now and I'll be happy to fix
… however, for debugging lengthy replays it would be very nice to change this behaviour instead to create a new replay by using the save button that is equal to the running replay starting at the point of the save. E.g. when debugging a bug in a ten-hours replay, I always have to resume watching from the start in every debugging session which is very annoying. Watching the first nine hours once, then hitting Save, and then being able to watch the remaining hour over and over again would be a nice feature. I suggest to change the use of the Save button like this. Probably not trivial though.
Top
Quote
|
|
|
jmoerschbach
Topic Opener
Joined: 2019-09-26, 20:40
Posts: 24
Pry about Widelands
|
Posted at: 2020-06-19, 13:49
Nordfriese wrote:
It used to be possible to continue a game saved from within a replay like a multiplayer savegame. That's no longer possible. This is what the bug is about as I understand it …
This must be confirmed from more people I think. I still do not get it completely to be honest. Is this then used as some kind of recovery if a multiplayer game crashed and the replay is somehow "misused" as an automatically saved game?
Nordfriese wrote:
… however, for debugging lengthy replays it would be very nice to change this behaviour instead to create a new replay by using the save button that is equal to the running replay starting at the point of the save. E.g. when debugging a bug in a ten-hours replay, I always have to resume watching from the start in every debugging session which is very annoying. Watching the first nine hours once, then hitting Save, and then being able to watch the remaining hour over and over again would be a nice feature. I suggest to change the use of the Save button like this. Probably not trivial though.
Yes, I get you, full ack. Not quite sure if this is complicated. The "save-algorithm" must be adapted to save a replay to "replays" and otherwise to "saves".
Top
Quote
|
|
|
Nordfriese
Joined: 2017-01-17, 17:07
Posts: 2000
OS: Debian Testing
Version: Latest master
One Elder of Players
Location: 0x55555d3a34c0
|
Posted at: 2020-06-19, 13:54
jmoerschbach wrote:
Nordfriese wrote:
It used to be possible to continue a game saved from within a replay like a multiplayer savegame. That's no longer possible. This is what the bug is about as I understand it …
This must be confirmed from more people I think. I still do not get it completely to be honest. Is this then used as some kind of recovery if a multiplayer game crashed and the replay is somehow "misused" as an automatically saved game?
I have no idea what this is useful for. I guess you can use it to undo a playing mistake if you have no backup savegame available – but other than that I don't see a real reason to have this feature. Otherwise I wouldn't have proposed replacing it…
Top
Quote
|
|
|
niektory
Joined: 2019-06-03, 19:06
Posts: 206
Widelands-Forum-Junkie
Location: Poland
|
Posted at: 2020-06-19, 14:06
It's sometimes useful for debugging, I used it once or twice.
Top
Quote
|
|
|
kaputtnik
Joined: 2013-02-18, 19:48
Posts: 2481
OS: Archlinux
Version: current master
One Elder of Players
Location: Germany
|
Posted at: 2020-06-19, 16:53
In the past it was always possible to create a savegame from a replay and afterwards load it again. Otherwise the possibility for saving a replay makes no sense at all
Sometimes one may want to play a foreign replay from a specific point on as a normal game. Just to compare if he would make some things better than the player in the replay.
Fight simulator for Widelands: https://wide-fighter.netlify.app/
Top
Quote
|
|
|
WorldSavior
Joined: 2016-10-15, 03:10
Posts: 2095
OS: Linux
Version: Recent tournament version
One Elder of Players
Location: Germany
|
Posted at: 2020-06-19, 17:38
kaputtnik wrote:
In the past it was always possible to create a savegame from a replay and afterwards load it again. Otherwise the possibility for saving a replay makes no sense at all
Sometimes one may want to play a foreign replay from a specific point on as a normal game. Just to compare if he would make some things better than the player in the replay.
+1
Nordfriese wrote:
jmoerschbach wrote:
Nordfriese wrote:
It used to be possible to continue a game saved from within a replay like a multiplayer savegame. That's no longer possible. This is what the bug is about as I understand it …
This must be confirmed from more people I think. I still do not get it completely to be honest. Is this then used as some kind of recovery if a multiplayer game crashed and the replay is somehow "misused" as an automatically saved game?
I have no idea what this is useful for. I guess you can use it to undo a playing mistake if you have no backup savegame available – but other than that I don't see a real reason to have this feature. Otherwise I wouldn't have proposed replacing it…
It's an extremely valuable feature. It can always be used to create a savegame when autosave fails or if savegames are broken, which also happens. If replays work properly (which is finally the case after b19) the feature can replace autosave partly. It's just very useful to be able to create for every match a replay for any second when you wish. You can then look closer at any settlement in the game at any time.
What's the point of removing a feature - especially a great feature?
jmoerschbach wrote:
I still do not get it completely to be honest. Is this then used as some kind of recovery if a multiplayer game crashed
For example, yes
and the replay is somehow "misused" as an automatically saved game?
I wouldn't call it misuse, it provides excellent backup to savegames.
Nordfriese wrote:
… however, for debugging lengthy replays it would be very nice to change this behaviour instead to create a new replay by using the save button that is equal to the running replay starting at the point of the save. E.g. when debugging a bug in a ten-hours replay, I always have to resume watching from the start in every debugging session which is very annoying. Watching the first nine hours once, then hitting Save, and then being able to watch the remaining hour over and over again would be a nice feature. I suggest to change the use of the Save button like this. Probably not trivial though.
Yes, I get you, full ack. Not quite sure if this is complicated. The "save-algorithm" must be adapted to save a replay to "replays" and otherwise to "saves".
No. If you save from a replay, it's like you save a game, so the file has to go to the save folder. How do you want to easily load a savegame from the replay folder? The save files in the replay folder are used to load a replay.
Nordfriese wrote:
jmoerschbach wrote:
Currently, I am not convinced that we have a bug here, rather a different behaviour many people seem to be used to. However, if I understood something wrong, please let me now and I'll be happy to fix
… however, for debugging lengthy replays it would be very nice to change this behaviour instead to create a new replay by using the save button that is equal to the running replay starting at the point of the save.
- 1
But this would be a very good additional feature! With another button for example.
E.g. when debugging a bug in a ten-hours replay, I always have to resume watching from the start in every debugging session which is very annoying. Watching the first nine hours once, then hitting Save, and then being able to watch the remaining hour over and over again would be a nice feature. I suggest to change the use of the Save button like this.
- 1
By the way, as the feature is missing because of the regression bug currently: Is there a simple way to convert a LAN-savegame and a Savegame-from-replay into usable Multiplayer savegames?
Edited: 2020-06-19, 17:41
Wanted to save the world, then I got widetracked
Top
Quote
|
|
|
niektory
Joined: 2019-06-03, 19:06
Posts: 206
Widelands-Forum-Junkie
Location: Poland
|
Posted at: 2020-06-19, 19:46
WorldSavior wrote:
By the way, as the feature is missing because of the regression bug currently: Is there a simple way to convert a LAN-savegame and a Savegame-from-replay into usable Multiplayer savegames?
You can unpack the savegame (it's a ZIP archive) and open the preload text file. It contains a line gametype="4" . 1 is single player, 2 is net client, 3 is net host, 4 is replay. Change the number and it should show up in the respective menu.
Top
Quote
|
|
|
jmoerschbach
Topic Opener
Joined: 2019-09-26, 20:40
Posts: 24
Pry about Widelands
|
Posted at: 2020-06-19, 20:37
Pull request is up: https://github.com/widelands/widelands/pull/3948
From my point of view, it is a workaround though. There should never be a file in "saves" with gametype=kReplay (gametype=4).
So when loading a replay via "Watch replay" and then saving it, gametype should be correctly set to the correct value. Don't know how much work this is...
When a replay is successfully loaded via single/multiplayer load menu (possible on the new branch) and then once again saved, its gametype is changed... After all, it looks a bit messy to me
Top
Quote
|
|
|
WorldSavior
Joined: 2016-10-15, 03:10
Posts: 2095
OS: Linux
Version: Recent tournament version
One Elder of Players
Location: Germany
|
Posted at: 2020-06-20, 20:29
niektory wrote:
WorldSavior wrote:
By the way, as the feature is missing because of the regression bug currently: Is there a simple way to convert a LAN-savegame and a Savegame-from-replay into usable Multiplayer savegames?
You can unpack the savegame (it's a ZIP archive) and open the preload text file. It contains a line gametype="4" . 1 is single player, 2 is net client, 3 is net host, 4 is replay. Change the number and it should show up in the respective menu.
Thanks
jmoerschbach wrote:
Pull request is up: https://github.com/widelands/widelands/pull/3948
From my point of view, it is a workaround though. There should never be a file in "saves" with gametype=kReplay (gametype=4).
So when loading a replay via "Watch replay" and then saving it, gametype should be correctly set to the correct value. Don't know how much work this is...
Currently "4" is the correct value ; )
When a replay is successfully loaded via single/multiplayer load menu (possible on the new branch
Why would one load a replay in single/multiplayer?
) and then once again saved, its gametype is changed... After all, it looks a bit messy to me
Those problems could (and should ? ) be fixed by "there aren't 4 different types of saves, but just one"
Wanted to save the world, then I got widetracked
Top
Quote
|