Hi,
I'm looking for an efficient and practical way to store player account data. I'm working on a server for an online game where players will accumulate "rank points" depending on how well they play. I want players to be able to see their rank in the game compared to other people's: The player should not only see how many points he has, but also see how he compares to other players, much like a Top Scores table.
What I know (or think I know):
Using INIs would make it easier to manage accounts, since there's a file for each account (bob.ini, agent.ini, ...), therefore deleting an account would be simple, and editing an account would also be simple. But how would I make a rank table from many separate files?
An array would read/write faster than an INI, but maintaining it would be difficult, since it's all one file (or so I think..). However, making a highscores table from the data in an array should be easier, or so I'm guessing...
I'm pretty confused, I'd rather use INIs, since speed isn't an issue as long as the INIs don't load/save often (which they will not, since they will only be loaded when someone logs in, finishes a game, or views another person's stats). However, I'm afraid that an INI won't allow me to do everything I need. I really need some advice,
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
29th July, 2004 at 01:25:46 -
I think the best option would be to use inis. Firstly in one list file load all of the ini files in the directory. Then run a loop that loads them, saves the ranking into another list file and then closes. It could look something like this:
On Loop "Check" > Load ini (List object[loopindex "check"]), set group to score, add a line to list2 (value of score(ini file)) + (filename of ini).
Assault Andy, that is one weird arvatar, you don't really want more then one ini file on the server for your game, it could get messy if you had them every where
Can the Magic Deque be used for this? It seems like a rather useful extension, but I've never used it. If I was to create an array similar to this one, would it be possible to sort the arrays by "rank element", which would be element #3 in every array?
I believe there is a built-in function for this, not sure how to use it, though. If done like that, I think it would be quite simple to cycle throuugh the arrays to display the Usernames and their respective Rank points. Did anyone try doing something like this? It would be cool if someone made a quick example of how to use the Magic Deque.
As for using INIs, I'm not sure, but I think the Magic Deque lets you delete arrays from the main array, but are the other arrays "moved" to fill its place? If yes, I don't really see an advantage in using INIs anymore.
Thanks!
Evil omg~!
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
24th September, 2004 at 00:06:42 -
No, you really do need more than one ini otherwise thing's get messy. Having multiple files is alot easier because it makes things like account deletion and duplication easier. And there would be no size limit like there would be if you only have one.
A database and PHP/ASP script is, if you can get it working, by far the best solution.
- No size limit
- "Tidy" - only 1 file (IMO loads of INIs is a messy method) plus tables, record names etc to organise things.
- Fast
- You can query the database to find detailed statistics about player accounts easily, plus things like sort by score descending to make a top ten or whatever.
- Easy maintainance (just execute a bit of SQL to fix any wrongly entered values)
However, disadvantages could be:
- If you don't know what you're doing, it's easy to make it very insecure. People could spam the signup pages and even retrieve people's passwords if you don't one way encrypt the passwords. Thus security codes should be passed to every page, plus value encryption.
- Databases can sometimes crash, especialy large Access databases.