Page MenuHomeFeedback Tracker

OnPlayerSave to sync mod data with player data
New, NormalPublic

Description

I have this crazy idea about synching player saves and mod saves, but please hear me out ;-)

So most modders, server admins and server owners know the problem that if a server suddenly stops or crashes, the player db and mod data can become out of sync, leading to loss of items or, the other way around, duped items. Duping is accidental in most cases, but may also be exploited by players. This is because mod saves are instant, while world data changes are buffered.

The idea I had is that the server could have something like Game.OnPlayerSave() that mods could hook into. This event would fire when the players get saved.

Now with this, if a mod needs to modify a json, it could read it, but only modify it in memory, instead of writing it back to disk. It would set for example IsInMemory to true (initially false), and every modification after that would not read the json, but directly work on the object in memory.

If OnPlayerSave fires, all mods that hooked into it would save their memory objects to disk, and set IsInMemory back to false. I'm aware that this would lead to potentially a lot of mods saving json files at the same time, which could be a show stopper.

Now if the server crashes, the mods lose their in memory changes and basically roll back in sync with the player rollbacks.

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
General