• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.~ saving (more of a question than issue)

ATT3

Intermediate OT User
Joined
Sep 22, 2010
Messages
512
Reaction score
100
Not sure if this is the right place for this thread, but anyway I been lately thinking about saving in general.

My question is; Where, how would/should you save players and how often?
  • Doing "global save" every few hours causes a little lag (few seconds) >>not wanted
  • Saving player on advance is a great place to save: player:save() >> Great but not very effective after all
Globalevent with async saving?
How often should it execute and should it save X amount of players at once or just 1?
Got this idea while writing this, tried to do something with it but couldn't get anywhere:
Code:
function onThink(interval)
    local playerCount = Game.getPlayerCount()
    for _, player in ipairs(Game.getPlayers()) do
        local mathRandom = math.random(playerCount)
        player:save()
    end
    return true
end

We also want to save houses etc.
saveServer() handles that? >> Saves everything?
Using player:save doesn't use much CPU while saveServer() does~

Anyway, how this simple question became so long and unclear, sorry for that in advance.
 
I personally think that saving every 24 hours (on a stable server), using a timer + restarter like real tibia is the best approach. Everyone will know what time they will be logged out for 2 minutes.
If your schedule at home is the same everyday.. set-up the server save to when you wake up, or when you go to bed, or an hour before bed et cetera.
This way you can make sure everything is good to go and can continue doing stuff as normal. At the same time you could make a back-up of the player files and server data.
This also gives you a time-frame for when your updates will launch, so you can take your test server's updates and upload them to the real server and ensure no problems occur.
No point in making things complicated if everyone is already used to something.
 
Back
Top