• 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!

Solved Storage System explanation

War-Ots

New Member
Joined
Feb 17, 2016
Messages
29
Reaction score
2
Helo guys, I hope is everyone doing well :)

I have been studying TFS again recently and i am currenctly building a server (ending a project). I already have managed to implement some stuff based on study i have been making here in otland and also reading code, testing etc.

I am currently having problems to figure out how exactly Storage system works. I have just implemented a crit/dodge system on my server where I saved the crit/dodge chance on the databse (of each player) (because the crit/doge system is connected to the player and not to a weapon or something else). Basicly each time a player attacks something it will calculate if the attack is crit or a normal hit, but (as far as my experience on IT) i was thinking that making a DB query everytime that a player hits a target is not very good.

So I started to look at the storage system or other csystem that could save that value on a cache or somerthing (but a friend told me that storage system also saves values on DB so I just impleted the feature saving on DB the values)

Now that i am looking again on storage, i saw on TFS 1.3 sources that it is like a map with key->value system but as I turn on/off the server the values are still there so it means that are persistent data types.

Can someone explain me better how storage system works? Can someone send me some documentation links? Or something else that helps me the understanting of the system for future implementations :)


Post automatically merged:

---- update ----

I have been searching and looks like it uses the player_storage table on one case I have tested (autoloot saved) here is the source i retrived the information: https://docs.otland.net/ots-guide/tfs-documentation/lua_functions#Game-setStorageValue although it says globalStorageTable not sure what this is refering to. My DB only have one table refering to storage that is player_storage. (my schema migh be incomplete?) not sure.

In terms of performance it is possible that even so using the storage it is possible that it is more efficient than making a query directly to the players table.

:)
 
Last edited:
Back
Top