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
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 09:46 AM.


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