Sync save data with updates

Yeah, this is something I never really understood why it's still not a thing when this has been missing since RPG Maker 2000. If I change the values in the game editor, sometimes you have to play through the entire game for these changes to take place or it may literally break the game as the save and the update go out of sync basically. This is not acceptable and every player hates having to redo a game, especially if it's long one if an update totally breaks it.

How can this be fixed? How can the save files, load the up to most data only everytime?
It depends on what you change, and in some cases *nothing* can fix it. For instance, database entries like actor stats and such usually take place right away. Same with where items are in the database. So if you move a weapon from ID 4 to ID 500, and someone had a weapon in ID 4 equipped, they will now have nothing equipped.

However, if you have a plug-in which adds instance items, then nothing will fix it, as the plug-in creates the item when it is found, and only starting from the beginning will fix it.
It depends on what you change, and in some cases *nothing* can fix it. For instance, database entries like actor stats and such usually take place right away. Same with where items are in the database. So if you move a weapon from ID 4 to ID 500, and someone had a weapon in ID 4 equipped, they will now have nothing equipped.

However, if you have a plug-in which adds instance items, then nothing will fix it, as the plug-in creates the item when it is found, and only starting from the beginning will fix it.

I added item categories in the game but in an old test save at my friend's place, when I brought it over it made the game crash. If we began new save file, it didn't crash. This sort of stuff is what needs eliminated in any means necessary.

It's also not true, I did play and at my friend's place the default airship was turned on even though I had a new one. Also a placeholder TEST npc joined instead of the actual character who was supposed to, which I checked home that didn't even exist in editor any more.
And how in the world would an old save know to recognize the categories? There is NO way to make it know that they exist. Save files only have what is stored there. If you need to add extra things like that then you need to program a converter. And no one can program one for you, as they don't know what you changed.

As for the actor, did you initialize the actor? If so that resets who gets added, unless you have something that adds independent plug-ins. And yes, I've tested it in clean projects. But, if you don't remember to initialize the actor, then it uses the data when the game was first started, as that is the only time it is initialized.

Also, the airship is set at game start unless you change it in system settings via an event.

But, in all honesty, all things you've posted so far are things that should be decided on and figured out before you release the game, and not after.
And how in the world would an old save know to recognize the categories? There is NO way to make it know that they exist. Save files only have what is stored there. If you need to add extra things like that then you need to program a converter. And no one can program one for you, as they don't know what you changed.

As for the actor, did you initialize the actor? If so that resets who gets added, unless you have something that adds independent plug-ins. And yes, I've tested it in clean projects. But, if you don't remember to initialize the actor, then it uses the data when the game was first started, as that is the only time it is initialized.

Also, the airship is set at game start unless you change it in system settings via an event.

But, in all honesty, all things you've posted so far are things that should be decided on and figured out before you release the game, and not after.

I haven't released the game. This was a test. We've had to replay the game through from start to finish multiple times already because of the save files not updating the content that has been added.
This might help though. Here is the way things are set:

->Actors and initial equipment and all system settings are set at game start (not sure about categories, I've had no issue changing them mid game, but that depends on plug-ins). So if you change say the battle music, you have to use a system command to get your save game updated. For actors, you have to use initialize to get it to use the newest data, otherwise it will use the actor as it existed when the game started.

->Skills and items change to match the database settings, as when you use them, the game calls the skill (or item) by the ID of the skill (or item) and that is how those are handled.

->Equipment is set as used, unless you have an independent item plug-in installed. If you do, those are set when found or added to inventory instead.

->States are the same as skills and items.

->Variables and switches are set at run-time in your game. If you significantly change how those are used, then a restart is required, as there is no easy to fix that.

->Plug-ins can make exceptions to all of these. Always watch out for what plug-ins you use.

Now...to get around that, you can do what I do, and that is create a dummy event which you step on, which will set everything to where it should be now, with your changes. I mainly use it for when I change a counter variable or realized I forgot to turn off a switch, but you could probably use it to give the party new updated equipment just as easily, or to reinitialize the actors.
You'll need save file versioning plus plugin exception code to do what you want - that is a lot more difficult to program that a lot of plugin writers can handle, and even the few that probably can program that have choosen not to implement that code in their plugins.

Savefiles need to store additional data for plugins if those plugins are added to the game. Simply because otherwise the data will not be saved and will be lost in your games - something you definately don't want.
For that reason, plugins add code to the save and load functions of the savegames.

However, a game saved before the plugin was installed has not been saved with that data, because the changes in the functions were not made and the data didn't exist before the plugin was installed.

So loading an older savefile will be missing that data, causing the new plugin to crash exactly like you described.

The only way around that is to have the load function written in a way that it creates the data if it detects that it is missing from the save.
That will need a version number in the save (so that the plugin knows the older savefile versions are missing the data and the newer ones have it), and then it needs to branch its own code to load the data if it is in the save, and to create it if the save is detected as older.

And believe me, writing a versioning system for the saves AND placing their own functions correctly into that versioning system is much too difficult for most of the plugin writers, especially considering that each and every plugin needs to be compatible with that versioning system or we're back at the start.

I made a suggestion to implement an official versioning system in the improvement boards, because that is the only way I can see this to work (if it is an official system with samples on how to change the load and save function depending on the plugin so that every plugin writer and every plugin user knows how to handle this), but the answers it got so far are basically proof that a lot of the people don't even understand what this is about, and that means it will most likely never work and you'll always have to start a new game whenever you add a plugin.
The same methodology I described for episodic games can be used here: https://forums.rpgmakerweb.com/inde...n-regarding-episodic-games.79048/#post-737285
Consider that the data in a save from an earlier version of the game needs to be migrated to the current version. Since you know what you have changes you in many cases take an earlier save, modify the parts of the data to match the delta, and use the migrated data for playing the game.
Sometimes it's not possible to guarantee that the updated save will work correctly. There are situations where you simply cannot derive what the updated values should be.

Doing this requires discipline and time. It may not be worth the effort during the development of the initial release, but at the same time it may be good training.

*hugs*
I've only encountered crashes when updating or modifying plugins that are included in save Data.
For example, a Monster Arena plugin. This saves the total monster defeated, now you change it to be specific for each monster. This will crash the game when it tries to find "enemyTotals" (array) instead of "defeatedEnemiesCount" (number).

Save versioning or data migration will not save you from this case because "defeatedEnemiesCount" does not indicate what enemies were defeated, only a total count. In this case the only way to rescue that file is to fall back to 0. basically reset the progress of that particular piece of data, the save will work now but you've literally lost all of your "Arena Progress". This is of course doesn't solve your issue of having to repeat anything on Updates and if the enemy counts were needed to unlocked something can result in very angry players.

The only sure way to avoid the example issue is to make sure the features you add into the game do not cause a discrepancy in saves. Even additive features can cause issues if the game does cannot logically account for the older ones that may have been in place. If writing a plugin, have a fallback when someone loads a save that doesn't have any of the required data if that plugin modify save data in anyway.
For example your item categories theoretically could default themselves when an old save is loaded that lacks item category data. but in the Arena case it would of been undesirable.
I forgot to say but a tileset of a custom made dungeon was a garbled mess at my friend's place, so do tilesets get decided on when the game's started too!? This makes updating your game at any point just impossible! If I add more content later on down the road, it'll not appear correctly for any of the old saves!!


I realized Yanfly's Utility Common Events lets you run events when you load game.

http://yanfly.moe/2017/04/21/yep-133-utility-common-events-rpg-maker-mv/

Can you run some sort of parameters to refresh the game each time you load a save and thus not cause a save desynch?
No, tilesets are set at map load. If you have a save on that map, and load it, then it might be a mess, but otherwise the only for that to happen is for the map tileset to not save correctly (aka you didn't use networking rules in your naming of the tileset).
OK that i can't explain. as far as i Know Tilesets are stored in the Database and are used to create Map on runtime. not the Save data and thus shouldn't effect how it is displayed. Even "Custom Dungeon" is dungeon the user creates or is made at run time what you describe sounds like what would happen if the Database was "de-synced". In that case they're really no avoiding that.in those cases the best solution would just update the game

As for the Yanfly plugin, i think that could be used for bgillisp's suggestion.
checking for dysync could be something like this. (conditional Branch?)
Code:
//pseudo code
var ver = 0.96; //Current version number
if($gameSystem.ver !== ver) {return true;}
return false;
@Fornoreason1000
No no, there are plenty more ways than simply resetting to 0. You could also distribute the kills to random enemies, set each enemy to have been killed 100 times and the like. You can also keep the old "defeatedEnemiesCount" and initialize the "enemyTotals". Then have the plugin take care of both the old save scenario for partial functionality and new saves functionality where you don’t have the discrepancy. This does come with a potentially pretty significant complexity cost. Suddenly you need to test additional cases, and bugs are more likely to exist. You can also choose to not do anything about it.

Apart from actual data manipulation letting the player know of problems can be a good idea.

Some of the games I have implemented Steamworks for, I store additional information in the saves so I can activate certain achievements. Since this information is not stored in save from the non-steam version I let the player know that loading that game may cause some of the achievements to not trigger properly, but I still give them the choice to play using the save anyway.

I don't think I have seen any complaints about Steam Achievement not working when loading from a non-steam save, and I believe it is because I am upfront about the issue.

@Andar
What you are suggesting is pretty much the idea behind the Save File Doctor for... VX Ace or XP (don't remember)
It may hide the issue but it won't properly solve it. You really need the game developers for each individual project to decide how to handle the discrepancies.

*hugs*
@Zeriab... see the problem of randomly distribution random kills everywhere would create highly inaccurate information on the game that the player will quickly notice. for example a player farms "wolves" enemy for XP and does so 58 times... his game updates and now apparently he killed 40 behemoths, 8 one eyes and 10 wolves. It doesn't make sense to do it this way. As i said, there is no possible way to know from that data which enemy that player has killed. As a result you can either choose to make basically corrupt save to to re-initialize that data. Either way you're in a pickle.

your second idea works alot better... much better than just setting it to 0, however this still would still affect the game progress which is what the OP is trying to avoid altogether. This happens becuas if the player above needs to kill 60 wolves to unlock a level and he killed 58 before the update. he updates his game, and the wolves counter is created. the player still needs a total of 60 wolves to unlock the next level. ways of checking that.

1. if "defeated Enemies"(58) continues to increase and is checked the same way "EnemyTotals"(0) is, you will find that suddenly the level that required 40 behemoths would just unlock itself.This can also be exploited to just farming wolves to unlock everything.
2. if "defeated Enemies"(58) does not increase and is not checked the same way "EnemyTotals" (0) is, the player starts from the beginning.
3. if "defeated Enemies"(58) is distributed across EnemyTotals(14), you get a combination of the problems of 1 and 2.

To credit though, these types of discrepancies are sign that the game/plugin is just incomplete. so the save would of been incomplete from the start. All comes down to planning I suppose. From a developer perspective its easy to just hack over the saves from the editor so we can continue debugging and testing.

Making the player aware of such problems upon loading the file give a player a heads up. Bethesda games do a similar thing when you try to load a save that relies on a mod. when players see this , they know the onus is now on them. But in an update that don't really have a choice doing (unlike mods) that affects the game play rather than something arbitrary like Achievements(like Item Categories or a Story element), saying "you save contains incompatible data" may not be enough.

The best we can do is minmise such scenarios from happening in the first place.
@Zeriab
not exactly - save file versioning is a method, a tool for the developer. It doesn't happen automatically, it will require the developer (that is the person who uses the plugin, not the plugin writers alone) to handle it.
If it is used correctly, it will solve the problem - but it will require the MV-user to understand his parts and what steps to do manually (basically on every plugin change the version number needs to be increased and the load/save-functions need another version sequence added, which will require manual work).

Because you're right, an automatic versioning system can't work correctly and will cause other problems.
The versioning is not an option as it requires end user to manually do things. The game and all the sollutions must work out of the box when people download it.
The versioning is not an option as it requires end user to manually do things.
I think you misunderstood that - not the end user as the game player has to manually do things for that, the RMMV end user (as in the game developer, or you) has to manually provide the versioning data.
And sorry, there is no way around that if you want to prevent a restart with "new game" - in every case where the updates for the players are automatic (not only in RPGM, but in any game engine anywhere), the only way to keep the data integrity is a massive preparation and work on the developer side.

And the biggest part of that problem is that most plugins are simply unable to be included into such a versioning system at this moment, which will require even more work on the developer side (as in modifying the plugins) to enable syncronity.
Which is one reason why we suggest to people to start with plugin implementation and when the engine stands, don't change the plugins anymore while creating the maps and the story of the game.

Original thread: https://forums.rpgmakerweb.com/threads/sync-save-data-with-updates.79776/