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

Storages or Database

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
131
Location
Unknown
Currently I am developing a new war server with lots of stuff like frags counter, killing spree, KD ratio, etc. I want you guys to tell me what would be the best way to store the frags by storage or database.

Storages:
Code:
 doCreatureSetStorage(cid, frags, getCreatureStorage(cid, frags)+1)
Database:

Code:
db.executeQuery("UPDATE `players` SET `frags` = `frags` + 1 WHERE `name` = '"..getCreatureName(cid).."';")
When I say best way I mean that what would be the one its consumes less resources, to not to get lagged.

Thanks in advance.
 
They do pretty much the same, a storage is saved in the memory until the player logs out / gets saved and then it will be saved in the database.
While a query would save it right away into the database.

So go with a storage value.
 
They do pretty much the same, a storage is saved in the memory until the player logs out / gets saved and then it will be saved in the database.
While a query would save it right away into the database.

So go with a storage value.

Does the memory can get overloaded by using storages? doesn't it? I know that the fact of using database could lag the server every time the script runs. I will be using SSD btw.
 
Does the memory can get overloaded by using storages? doesn't it? I know that the fact of using database could lag the server every time the script runs. I will be using SSD btw.

IMO SSD isen't that big of a deal when it comes to an otserver, go with a better CPU and RAM insted.
It can, but still would take ALOT, just like any program can.

Don't worry about it, most of the things the server does is read from the memory anyways xD
 
Storages would be the best way to do it and also the easiest when compared to running a query every time you want to set/check/modify/compare anything. The memory usage is quite small for a storage value, I'd imagine you would need to have over 1k players with several hundred different storage values each before you would have to worry about it. Keep in mind that even a normal server without the systems you are speaking of already use a lot of different storages just for quests.
 
If you want to imlement something like a multiple kill counter, I suggest you hook the onKill/onDeath event to increase the murderer's kill counter and addEvent to decrease it after a specific amount of time, or store the amount of kills and the time of the last kill in two storages. This should be lightweight enough.
 
Back
Top