Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

View Poll Results: Best way to store item data
SQLite 5 55.56%
Files 2 22.22%
DBNPC 2 22.22%
Voters: 9. You may not vote on this poll

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-23-2009, 12:51 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Item System Storage

My task is to create an item system. I was just wondering what everybody's opinions are on the storage of data. I'm not too worried about your caching opinions but if you want to make them known, I'm more than happy to take advise.
Reply With Quote
  #2  
Old 12-23-2009, 01:22 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
For me, both files and SQL works since I load them into a DBNPC. Both ways work since it's a one off read. SQL seemed pretty slow when dealing with alot of requests for me (which was really weird) so I wouldn't recommend storing and reading items out of it constantly.... works really well for logs though =D

For ease of use (and the fact I don't use the files live) I recommend file based
Reply With Quote
  #3  
Old 12-23-2009, 01:36 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by Twinny View Post
For me, both files and SQL works since I load them into a DBNPC. Both ways work since it's a one off read. SQL seemed pretty slow when dealing with alot of requests for me (which was really weird) so I wouldn't recommend storing and reading items out of it constantly.... works really well for logs though =D

For ease of use (and the fact I don't use the files live) I recommend file based
I guess that could work pretty well
Reply With Quote
  #4  
Old 12-23-2009, 01:41 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Immolate View Post
I guess that could work pretty well
Truth be told, could just skip the loading part and code it straight into the dbnpc
Reply With Quote
  #5  
Old 12-23-2009, 01:59 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by Twinny View Post
Truth be told, could just skip the loading part and code it straight into the dbnpc
That's what I used to do when I only needed to create and manipulate items. I'm thinking loading from text-files into a DBNPC cache would make things easier when people want to manipulate items in the event I'm not around.

Though, it'd still be nice to hear what other people have to say on the matter.
Reply With Quote
  #6  
Old 12-23-2009, 02:05 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
I have to say files. Easier to manage and work with if you are offline (You can write up items and all that stuff when you're missing an internet connection. Just upload them when you get internet back.)
I usually just store all the information in files, and then cache them for faster access.

It's just so much easier doing object.loadvars(filepath), instead of having to hazzle with requests and such with SQL..

It's personal preference to a certain degree though.
__________________
Reply With Quote
  #7  
Old 12-23-2009, 02:08 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by Chompy View Post
I have to say files. Easier to manage and work with if you are offline (You can write up items and all that stuff when you're missing an internet connection. Just upload them when you get internet back.)
I usually just store all the information in files, and then cache them for faster access.

It's just so much easier doing object.loadvars(filepath), instead of having to hazzle with requests and such with SQL..

It's personal preference to a certain degree though.
Thanks for your input
Reply With Quote
  #8  
Old 12-23-2009, 05:45 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Files + DB Cache for Base Arc Data, and SQLite for storing player's item info (quantity, custom modifiers, etc.).

It's so much easier to do trades with SQLite, since you can just make the updates in one transaction, then have them both reload their items. Plus it makes the backing up of player data a simple one file backup.
__________________
Quote:
Reply With Quote
  #9  
Old 12-23-2009, 05:46 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
SQLite is by far the easiest and most powerful way of doing it.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #10  
Old 12-23-2009, 06:41 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by xXziroXx View Post
SQLite is by far the easiest and most powerful way of doing it.
Could you elaborate on that?
__________________
Reply With Quote
  #11  
Old 12-23-2009, 06:46 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Chompy View Post
Could you elaborate on that?
Not too much to elaborate on. SQLite database is a huge total filesize decrease comparing to plain files, it's faster loading/altering of data, it's *A LOT* easier to find specific data across the entire table then searching through all files. And the biggest pro of them all: save one, that's right - ONE, file on your computer and your entire servers database is backed up.

I could most probably list a lot more reasons why SQLite is superior, but the above ones are the ones that convinced me.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #12  
Old 12-23-2009, 06:49 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by xXziroXx View Post
Not too much to elaborate on. SQLite database is a huge total filesize decrease comparing to plain files, it's faster loading/altering of data, it's *A LOT* easier to find specific data across the entire table then searching through all files. And the biggest pro of them all: save one, that's right - ONE, file on your computer and your entire servers database is backed up.

I could most probably list a lot more reasons why SQLite is superior, but the above ones are the ones that convinced me.
So you would store all information that is important or used by all of your systems in one SQL database?

Do you only use SQL or some combo as Jerret described in his post?

Edit; What if you have a player that had it's player data glitched, and you need to restore their old values from the old SQL backup, what would you do then? Install a third party software to view the table wanted and then manually query a change in the current SQL DB with the old backup data? (Seeing as requestsql2() isn't working as far as I've seen)
__________________
Reply With Quote
  #13  
Old 12-23-2009, 06:50 PM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
For some reason, SQLite seems to have a high cpu usage on a few queries with graal though :/
Reply With Quote
  #14  
Old 12-23-2009, 06:57 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Chompy View Post
So you would store all information that is important or used by all of your systems in one SQL database?
I so far store items, items owned by players, skills, quests, spells and recipes in my SQLite database. So yes, I guess you could say I store all important information in it.

Quote:
Originally Posted by SKJF91 View Post
For some reason, SQLite seems to have a high cpu usage on a few queries with graal though :/
Care to show examples? Only time I've experienced that is when I used SQLite queries in a very bad way (I've learned how to properly work with it since) or excessive use of VACUUM (which obviously gives high CPU usage).
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #15  
Old 12-23-2009, 07:13 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by xXziroXx View Post
Only time I've experienced that is when I used SQLite queries in a very bad way (I've learned how to properly work with it since) or excessive use of VACUUM (which obviously gives high CPU usage).
It would be really handy if you could provide tips and examples on how to properly work with it, since all I know is the basic syntax.
Reply With Quote
  #16  
Old 12-23-2009, 07:57 PM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
Quote:
Originally Posted by xXziroXx View Post
Care to show examples? Only time I've experienced that is when I used SQLite queries in a very bad way (I've learned how to properly work with it since) or excessive use of VACUUM (which obviously gives high CPU usage).
Just simple queries, inserting, selecting etc.. - and I know how to use proper queries such as JOIN etc although i'm unsure if sqlite supports all of that like mysql does.
Reply With Quote
  #17  
Old 12-23-2009, 08:21 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by SKJF91 View Post
Just simple queries, inserting, selecting etc.. - and I know how to use proper queries such as JOIN etc although i'm unsure if sqlite supports all of that like mysql does.

I'm not convinced that the CPU usage for SQL queries is entirely accurate.
Reply With Quote
  #18  
Old 12-23-2009, 08:50 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I find files to be much easier than SQL, especially ini files.

From experiencing both, I think I'd have to go with Jerrets suggestion though, I'd use ini files for item data, and SQL for individual player data.

I personally think SQL is being way over estimated by everyone lately. It surely is very useful, especially with nice tools like Chris Vimes SQL Explorer, but it's not the perfect, beat all solution.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #19  
Old 12-23-2009, 08:55 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by coreys View Post
but it's not the perfect, beat all solution.
I'd actually say it is.
Reply With Quote
  #20  
Old 12-23-2009, 08:57 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
On Era Dev we're using files for storing item data (items/weapons/guns/ak47.txt, for example), and then using SQL to store individual player data, e.g. the items the player has and the quantity of the item they have. If you index it properly, it's pretty fast.

It seems to be working quite well, though we hope to find out just how well with the iPhone server.

EDIT: I should mention that we're caching the items into a DB NPC to prevent tons of file I/O and slowdowns.
__________________
Reply With Quote
  #21  
Old 12-24-2009, 03:33 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Immolate View Post
It would be really handy if you could provide tips and examples on how to properly work with it, since all I know is the basic syntax.
Quote:
Originally Posted by SKJF91 View Post
Just simple queries, inserting, selecting etc.. - and I know how to use proper queries such as JOIN etc although i'm unsure if sqlite supports all of that like mysql does.
http://www.sqlite.org/lang.html
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #22  
Old 12-24-2009, 05:17 AM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
Quote:
Originally Posted by Switch View Post
And why are you sending this to me..?
Reply With Quote
  #23  
Old 12-24-2009, 07:26 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by SKJF91 View Post
And why are you sending this to me..?
Hmm...
Quote:
Originally Posted by SKJF91 View Post
although i'm unsure if sqlite supports all of that like mysql does.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #24  
Old 12-24-2009, 01:28 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by SKJF91 View Post
And why are you sending this to me..?
I'm thinking the same thing. I did say I knew the syntax but what I was asking for was tips on optimization from scripters who know how to use it properly.
Reply With Quote
  #25  
Old 12-24-2009, 06:49 PM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
Quote:
Originally Posted by Immolate View Post
I'm thinking the same thing. I did say I knew the syntax but what I was asking for was tips on optimization from scripters who know how to use it properly.
Well I see why he was sending me it, so I retract my statement .
Reply With Quote
  #26  
Old 12-24-2009, 06:53 PM
Immolate Immolate is offline
Indigo
Join Date: Dec 2009
Posts: 322
Immolate is on a distinguished road
Quote:
Originally Posted by SKJF91 View Post
Well I see why he was sending me it, so I retract my statement .
I get the feeling he was trying to be a smart arse.
Reply With Quote
  #27  
Old 12-24-2009, 07:56 PM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
Quote:
Originally Posted by Immolate View Post
I get the feeling he was trying to be a smart arse.
Possibly.
Reply With Quote
  #28  
Old 12-25-2009, 12:55 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by Immolate View Post
I get the feeling he was trying to be a smart arse.
No, he would have been if he send you this:
http://lmgtfy.com/?q=sqlite
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #29  
Old 12-25-2009, 01:03 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by coreys View Post
No, he would have been if he send you this:
http://lmgtfy.com/?q=sqlite
Aha, that's awesome.
__________________
Reply With Quote
  #30  
Old 12-25-2009, 01:40 AM
cyan3 cyan3 is offline
Registered User
cyan3's Avatar
Join Date: Nov 2005
Location: England
Posts: 2,919
cyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant futurecyan3 has a brilliant future
Quote:
Originally Posted by coreys View Post
No, he would have been if he send you this:
http://lmgtfy.com/?q=sqlite
I've been looking for that link for a while
thanks.
Reply With Quote
  #31  
Old 12-25-2009, 01:41 AM
SKJF91 SKJF91 is offline
Registered User
Join Date: Dec 2009
Location: United States of America
Posts: 89
SKJF91 will become famous soon enough
Quote:
Originally Posted by coreys View Post
No, he would have been if he send you this:
http://lmgtfy.com/?q=sqlite
rep+
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.