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?
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:
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.
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
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.