I can see that this hasn't been updated in 6 months, but a couple of thoughts, anyways:
The 'only keep' 10x saves thing doesn't work. I regularly go in and manually delete 100+ saves from the backups, which is like 10GBs of data.
A good thing to add would be batch files into the backup folders (the 2021-##-##_##-##-## folder, not the characters.bak folder). That would allow people to load their game easily, I will include some code below in case anyone wants to make some for themselves.
Delete all but last 10 files (This would go in the characters.bak folder and the worlds.bak folders): for /F "skip=10 eol=| delims=" %%I in ('dir ".\????-??-??_??-??-??" /AD /B /O-N 2^>nul') do rd /Q /S ".\%%I"
1. Serious bug where i started singleplayer game and it lagged like mad. I closed game and took a look at the newly made backup folders for world and characters and there were more than 10 files created in each. So it was rapidfiring backups with 0 interval and disregarding my "keep 3 files" config setting. LogOutput.log confirmed something like 40-50 saves done within a couple seconds. In jdodger415ValheimCharacterBackup.cfg i had intervals around 30 minutes: BackupIntervalChar = 1807 IntervalTime = 1602 BackupIntervalWrld = 1799
2. I figured that the backups aren't compressed so i shouldn't be using this mod.
3. I figured it's making backups of everything, not just character i'm playing or world that is loaded. This is really bad, you could be losing the last working points of other worlds or chars.
Uploaded to Thunderstore https://valheim.thunderstore.io/package/SengU87/Valheim_Character_Backup/
I just don't know how or it's possible to update the description without changing the version number. Seems like through Thunderstore, the config path is under - %appdata%\Thunderstore Mod Manager\DataFolder\Valheim\profiles\(modprofile)\BepInEx\config\jdodger415.ValheimCharacterBackup.cfg
Biggest issue I have is that mod just copies files at hand, so if I setup backup every 5 minutes, and game saves world once it feels like (roughly 25-30min), I just end up with 3-5 copies of same files. And I tried to setup that interval, put it to 300 as well (assuming it's also seconds), but game just started saving like every second so it was unplayable (hardly went past loading screen). For the record I don't have V.Plus or any other save-changing mods except this one. Was I doing it wrong?
It did save my behind in one occasion, but it could be so much better. Eg (suggestions): whenever game makes save, trigger autobackup 5 sec later. Likewise, if backup is to be run, it would be awesome to first trigger game's own save, wait couple sec, then copy files. If neither of those is possible, it should just monitor game files, and create new backup folder only if save files have been changed, to reduce the clutter and unnecessary dupes. Also, I hoped that console "save" would actually make a save, but nope. Manual workaround is to wait for game to show world save icon (top left) and then pop the console and type save to trigger backup.
To reply to my own dumb self... After having a look at the plugin code, I noticed correct config is way simpler: - enable character backup, set timer to 300, rotations to 10 - enable world backup, set same timer & rotation - enable interval and set it to 0 (ZERO!!)
In such case plugin will trigger game's own save process every 300 sec as well, and world and character will save every 300 sec as well, so after a while of playing I got expected result - 10 folders, each 5 minutes apart, and inside them 10 character and 10 world backups, likewise with about 5 minute intervals. Sure, folder says like 11-35 and files inside are 11:33 but that doesn't really matter, all it matters is you can go backwards in saves in roughly 5min jumps, and that's all there is.
Note again - set interval to true (enabled) and let the integer number STAY AT 0!
For some reason manually setting it to 300 triggered a continuous save loop. But keeping iz at 0 does it every 300 sec so I skipped on debugging. I did have a look, but don't see what's wrong. Maybe I just had something else in there as well...
Sorry about that, I wrote it with Windows in mind (didn't know it was on Linux, lol). If you wan't the source code to poke around just shoot me a message.
I think I have put something together which should allow it to work with Linux. I have a test virtual machine but I can't get the game to run using BepInEx.
Let me know if you need help testing the mod on Linux. Running the game with BepInEx requires setting execute permission on the start_game_bepinex.sh script. Cheers!
Had a bit of a poke around and the ondestroy only kicks in when the game exits, as opposed to died, or logged out back to main menu, which is why the backups keep running. Just looking at the shutdown or disconnect to see if that kicks in.
Doesn't save the character just the file that the game saves of the character. loosing progress in case of crashes for example would not be prevented by this mod.
55 comments
- The 'only keep' 10x saves thing doesn't work. I regularly go in and manually delete 100+ saves from the backups, which is like 10GBs of data.
- A good thing to add would be batch files into the backup folders (the 2021-##-##_##-##-## folder, not the characters.bak folder). That would allow people to load their game easily, I will include some code below in case anyone wants to make some for themselves.
Load Character:?del C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\characters.restore /q
mkdir C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\characters.restore
move C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\characters\*.* C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\characters.restore
xcopy ".\*.*" C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\characters
Load World:
del C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\worlds.restore /q
mkdir C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\worlds.restore
move C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\worlds\*.* C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\worlds.restore
xcopy ".\*.*" C:\Users\USERNAME\AppData\LocalLow\IronGate\Valheim\worlds
EDIT:
One more .bat file that might be helpful...
Delete all but last 10 files (This would go in the characters.bak folder and the worlds.bak folders):
for /F "skip=10 eol=| delims=" %%I in ('dir ".\????-??-??_??-??-??" /AD /B /O-N 2^>nul') do rd /Q /S ".\%%I"
BackupIntervalChar = 1807
IntervalTime = 1602
BackupIntervalWrld = 1799
2. I figured that the backups aren't compressed so i shouldn't be using this mod.
3. I figured it's making backups of everything, not just character i'm playing or world that is loaded. This is really bad, you could be losing the last working points of other worlds or chars.
https://valheim.thunderstore.io/package/SengU87/Valheim_Character_Backup/
I just don't know how or it's possible to update the description without changing the version number. Seems like through Thunderstore, the config path is under - %appdata%\Thunderstore Mod Manager\DataFolder\Valheim\profiles\(modprofile)\BepInEx\config\jdodger415.ValheimCharacterBackup.cfg
It did save my behind in one occasion, but it could be so much better. Eg (suggestions): whenever game makes save, trigger autobackup 5 sec later. Likewise, if backup is to be run, it would be awesome to first trigger game's own save, wait couple sec, then copy files. If neither of those is possible, it should just monitor game files, and create new backup folder only if save files have been changed, to reduce the clutter and unnecessary dupes. Also, I hoped that console "save" would actually make a save, but nope. Manual workaround is to wait for game to show world save icon (top left) and then pop the console and type save to trigger backup.
- enable character backup, set timer to 300, rotations to 10
- enable world backup, set same timer & rotation
- enable interval and set it to 0 (ZERO!!)
In such case plugin will trigger game's own save process every 300 sec as well, and world and character will save every 300 sec as well, so after a while of playing I got expected result - 10 folders, each 5 minutes apart, and inside them 10 character and 10 world backups, likewise with about 5 minute intervals. Sure, folder says like 11-35 and files inside are 11:33 but that doesn't really matter, all it matters is you can go backwards in saves in roughly 5min jumps, and that's all there is.
Note again - set interval to true (enabled) and let the integer number STAY AT 0!
For some reason manually setting it to 300 triggered a continuous save loop. But keeping iz at 0 does it every 300 sec so I skipped on debugging. I did have a look, but don't see what's wrong. Maybe I just had something else in there as well...
Also taking into account where the saves are (different path).
Would be nice for dedicated servers too (which may have the word data in any arbitrary folder)
Are you able to start the backup when timeScale >= 1