tAPI Autosave & Backup Settings

blushiemagic

Retinazer
tModLoader
Imagine this: you've downloaded a large number of mods, you're having fun and you've made tons of progress... and then suddenly, one of your mods crashes, making you lose all your progress from the past 10 minutes! With Autosave Settings, never again will you have to fear losing so much progress!

This mod essentially allows you to customize how often your world / player should autosave. By default, the game autosaves in singleplayer every 10 minutes, and doesn't seem to autosave at all on servers (although players connected to servers autosave every 5 minutes). This mod let's you autosave more frequently, even every second if you wish (although I do not recommend that). It even works with servers, and synchronizes the saving of the server world with the saving of all connected players.

Another feature of this mod is automatically saving multiple backups of your world. You can set how often the game should save backups, and how many backups it should keep before deleting old ones. This way, if the world file becomes corrupted, you can try to go back through your list of backups to try to salvage something.

I'm not sure if anyone has actually done this yet, but while I was playing with someone else the server crashed causing lots of progress loss, inspiring me to make this. And the solution was very simple (as you can tell by the mod's small file size), so I decided to give it a go.

This mod provides two important options for autosaving:

Autosave Time determines how many seconds will be in between every autosave. The Autosave Time can range anywhere from 1 second to 600 (vanilla default) seconds. By default this setting is set to the vanilla autosave time.
- Do note that saving the game drops your framerate. Also, the lower your autosave time, the more likely that the game will be just happening to autosave at the same time your game crashes (not sure whether or not this makes bad stuff happen). So do not set this too low!

Server Autosave determines whether or not dedicated servers hosted by you will autosave. By default this is set to false. When set to true, not only will the server autosave, but also all connected players will be saved at the same time. Note that this means that the autosaving of connected players is controlled by the settings of the server owner.

Note that you must have the vanilla autosave option set to true in order for anything to work.

There are three more options related to backups:

Backup determines whether or not this mod should store backups in the first place. Pretty self-explanatory.

Backup Time determines how many autosaves should be between each backup. For example, if you have this set to 1, a backup will be made before every autosave. If you have it set to 2, a backup will be made before every other autosave, etc. This option can range from 1 to 100.

Number of Backups determines how many backups should be stored before the mod starts deleting old ones. This option can range from 1 to 10.

1. From the main menu, click on "Mods".
qsZTos5.jpg

2. Click on "Autosave", then click the yellow "Mod Options" button on the left. If the mod is disabled so that you cannot do this, then first click the green "Enable" button on the left then the "Reload Mods" button on the bottom.
p4IzJvv.jpg

3. As described above, "Autosave Time" determines the time between autosaves, and "Server Autosave" determines whether or not dedicated servers should autosave. The option "Notify Autosave" just makes a notification appear in chat whenever the game or server autosaves. I used it for testing purposes. By default it is set to false. The same thing applies to "Notify Backup".
l6GQjUe.jpg

4. If you find it too tedious to hold on to the minus button with your mouse, click the "Open Mod Directory" button from step 2. Open "ModOptions.json", and you can set whatever options you want there.

5. If you want to access your backups, navigate to the folder that contains your world files. If you do not know where this is, first click the "Open Mod Directory" button from step 2. Go up two folders, into the "tAPI" folder. Then go to the "Worlds" folder. Backups will be stored in folders named "WorldName.wld_Backups" (obviously replacing WorldName with the world's actual name). In this folder you will find files named in the format "month-day-year hour-minute-second AM/PM.wld", depending on the day and time the backup was made. Copy one of these files into the "Worlds" folder then rename it to the world name.

Disclaimer
While I have tested this mod to make sure everything works, and although this mod is simple in nature, there is always the chance that weird stuff might happen. I am not responsible for anything bad that happens to your world.

Download
Current version: v1.0
You may either use the Mediafire link or download the attached file. This mod requires tAPI.
http://www.mediafire.com/download/bnt2uj15ksb6icn/Autosave.tapi

v1.1
- Added support for backups

v1.0
- Release

 

Attachments

  • Autosave.tapi
    8 KB · Views: 742
Last edited:
If you're able to, I'd love for this mod to allow more than 1 backup of a world file to be stored. I often find that when my World becomes corrupted, the backup has already become corrupted as well. If this mod could allow the old backups to be kept longer I probably would be able to find one that isn't corrupted.

The faster Autosaves are real handy!
 
If you're able to, I'd love for this mod to allow more than 1 backup of a world file to be stored. I often find that when my World becomes corrupted, the backup has already become corrupted as well. If this mod could allow the old backups to be kept longer I probably would be able to find one that isn't corrupted.

The faster Autosaves are real handy!
That sounds like a pretty good idea. I've got a general solution in my mind now; I'll start implementing a full solution either the beginning of next week, after my other mod's next update, or if I manage to think up a full solution, whichever comes first.
 
v1.1 has been released! This update adds support for storing multiple backups of the same world. Currently I have the cap set to 10 backups, although I will raise this if people request it.

This update took way shorter than I was expecting; imagine my disbelief when I tested it and it actually worked.
 
Thanks for the mod man! finnaly i can play my modded terraria without crashing and loosing my characater and my world! :D
 
Hello ik this is really late but can you pls turn this into a tModloader mod cause tAPI is discontinued and i really need a autosave mod.So please try and make it into a tModloader mod.
 
Please can someone update this to tModloader because I am dire need of some way to make autosaves very frequent. Thanks
 
Back
Top Bottom