EDIT: SORRY I POSTED IN THE SUPERHERO FORUMS, PLEASE MOVE TO THE SOURCEMOD (or any other appropriate) FORUMS
My situation is as followed:
I have a synergy server and i have the following SQLite database tables:
XPmod_Supplies (fields: 8 )
XPmod_WeaponS (fields: 10)
XPmod_Messages (fields: 8 )
XPmod_PropsS_Organic (fields: 3)
XPmod_PropsS_Boxes (fields: 3)
XPmod_PropsS_Weapons (fields: 5)
XPmod_PropsS_Cars (fields: 4)
XPmod_Kills (fields: 25)
XPmod_Achievements (fields: 25)
In all of the tables the first 2 columns are the steamid and the playername, the rest is the data
In total I have 8-2+10-2+8-2+3-2+3-2+5-2+4-2+25-2+25-2 = 91 different data variables
All of the data is viewable by menu's in-game. The menus are populated by variables wich hold the data. The data is stored in a set time interval (10 seconds or so) using queries
I have done a bit of research and have come up with the following ways to manage these:
- Every data variable is stored in the script as individual variables (wich looks like this for example: Killed_zombies[index] would return a number like 233). My main objection to this one is that I have so many variables and there's no looping involved, every line has to be coded seperately for every data variable.
- A collection of 2 dimensional arrays grouped by tables (where I store the data using for-loops for example) (would be easyer if there were dictionaries or 3 dimensional arrays)
- no global variables, I read everything directly from the SQLite database using queries
- Make a Keyvalues handle. Not to store the variables in a text file, only to keep the keyvalues handle globals so I can access the data. The sections would be arranged by player index followed by the table name followed by the column name (if that makes sense)
My question is:
What would be a good way to manage the data?
- How many global variables ( if any) are appropriate?
- Would keyvalues become laggy even if I do not read or write to the filesystem?
- Is reading from the database directly a option or would that be too slow?
I want to achieve the following: Manage the data with high speed and low memory and still use a small amount of functions to manage the data.
Can you please help me with this problem?
Last edited by snipercup; 03-15-2012 at 20:17.
Reason: Oops wrong forum