Archived

This topic is now archived and is closed to further replies.

Warvstar

DirectPlay: Storing Information

Recommended Posts

Hello, iam just starting Directplay coding, iam working off of the MazeServer/Client source in the DX9 SDK, it seems to be a good starting point, i understand most of it, but heres my problem, when a user joins he just automatically loads into server, and he is identified by a DPNID, wich seem's to be fairly random, i'am wondering if anyone had any tips on getting all the user's info to save at the server under a name, so when i add a login feature to it, a user could login, and his information weapons, location and what not, would be accessed from server, mainly what im asking is how to make a user be able to login then leave, then login again and still be in same location he logged out at. Any help? thanks. [edited by - Warvstar on March 20, 2004 2:30:56 PM]

Share this post


Link to post
Share on other sites
You could keep all the necessary data in a class, i.e

class Player
{
DPNID id;
Vector3 pos;
WeaponList weapons;
...
};

Then you could save the information stored in the class to a file/database on the server. When the user logs in the second time you search for the file that matches the users login information and simply load it in. You''d probably want to save the player information pretty often so that the user won''t lose all his stuff every now and then.

Share this post


Link to post
Share on other sites
I dont know if that is what i was looking for exactly, sorry, but i have not had much training with .NET, i can get around but im not too good, but ill explain my problem i little better.

Steps user takes to connect to get logged into server and recieve information now:
1. Open Client.exe, 2. Client.exe Connects to Server.exe with just a Number (DPNID), 3. Information is Created from scratch and stored locally, when client.exe quits, users info gets lost.


Steps i would like a user to take to connect and get logged into server and recieve information :
1. Open Client.exe, 2. Client.exe Asks user for login credentials, 3. User Authorized then Connects to Server.exe, 4. Information is Loaded from file or database, when client.exe quits, users info remains safe.

Now i know this is probrally not that simple, but i would appreciate any help thanks.



[edited by - Warvstar on March 20, 2004 10:27:46 PM]

Share this post


Link to post
Share on other sites
you are probably looking for a "user account and information mapping" machanism for your MMORPG. yes, for DirectPlay, you cannot rely on DPNID to do the mapping, because it only identifies the current connection, and it is, yes, random. so basically you assign each human player an account name (which must be unique); and on your server, you have, for example, a std::map< std::basic_string, cPlayerInfo* >, the first type (the key of the map) is unique accounts you assign (or user applies) when users first play your game; so on the server, this map is maintained persistently (probably the player information is periodically saved to a remote database), your users are identified by their unique account names (NOT DPNID, DPNID is only valid for the current connection session for DirectPlay to send or recv information throught the connection); when your user logs in, they can play, and the matching cPlayerInfo of the user is updating as necessary, and when your human player logs out, the cPlayerInfo would best be saved to a remote database; next when your human player logs on again, his unique user account is used as a key to search your remote database to get the information and a cPlayerInfo object will be constructed, and this cPlayerInfo object will be added to your std::map, so your player''s state will be the same as he/she last logs off.
hope it help! cheers!

Share this post


Link to post
Share on other sites
quote:
Original post by AI_the_rapman
Hi,

you want me to modify your own code of the mapping mechanism or to setup a DirectNet solution under vs.net 2003?



Well its abit of both acually, if you gave me an email address i could send the code to you, see at the moment i have a DPlay server/client, clients can join at any time, but when they leave they lose information, so i think i mainly need a mapping mechanism.

Share this post


Link to post
Share on other sites