The Daily Click ::. Forums ::. Klik Coding Help ::. Data storage for a multiplayer game - advice needed (MMF).
 

Post Reply  Post Oekaki 
 

Posted By Message

Agent_K64



Registered
  17/03/2003
Points
  69
28th July, 2004 at 15:02:30 -

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,

Thanks guys.


 
Evil omg~!

Kramy



Registered
  08/06/2002
Points
  1888
28th July, 2004 at 15:31:26 -

You could put everyone's stats in a single ini. Then it shouldn't be much harder doing things like a highscore table than if you were using an array.

 
Kramy

Pete Nattress

Cheesy Bits img src/uploads/sccheesegif

Registered
  23/09/2002
Points
  4811
28th July, 2004 at 16:44:47 -

ideally you could use Moosock to communicate with a php server and mysql database. if you know php that is

 
www.thenatflap.co.uk

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
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).



 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Mr Icekirby



Registered
  18/12/2003
Points
  846
29th July, 2004 at 10:47:41 -

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

 
Mr Icekirby says so!
OBEY ME!

Agent_K64



Registered
  17/03/2003
Points
  69
29th July, 2004 at 11:01:55 -

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?

[Bob ][Joe ][LeetBoy ]
[bobpass ][joepass ][leetpass]
[50 ][34 ][74 ] <-- rank element

to make something like this?

[LeetBoy ][Bob ][Joe ]
[leetpass][bobpass ][joepass ]
[74 ][50 ][34 ]

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

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
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.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
24th September, 2004 at 09:20:52 -

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.

Image Edited by the Author.

 
- Tigerworks
   

Post Reply



 



Advertisement

Worth A Click