Jump to content

  • Log In with Google      Sign In   
  • Create Account


Saving player data


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Silfro   Members   -  Reputation: 112

Like
0Likes
Like

Posted 23 June 2014 - 02:20 PM

Hello, im currently working on a MMORPG game and I would like to know where/how should I save some player data.

 

With data I mean data like player name, is the playing on fighting mode (boolean), is player online/offline (boolean), is the playing sitting to recover life (boolean)

 

Currently Im saving some data like character name, character id, account id like this:

this->characterID = req->charId(get player ID per packet from the client);

public:
int GetCharacterId() { return characterID; }

private:
int characterID;
 
 
but I need to save much more data like experience, life and much more I thought that would be very bad to do this for everything.
 
So is there any good idea?
 
Maybe something like a create a session"table" for every session(player) ?
 
Once the player log in I will fetch all data from database and put it into the session"table".
 
Example:
this-> AddUser(const char * UserID, unsigned int UserEXP, unsigned int UserLife, CClientSession * pSession)
 
But Im very new to c++ and dont really know how should I do that or what would be the best way.
 


Sponsor:

#2 cozzie   Members   -  Reputation: 1583

Like
2Likes
Like

Posted 23 June 2014 - 05:25 PM

My advice would be to use states, every object in your gameworld can either have a state or not (dynamic).

If you save all states that are not dynamic, you can use this for loading and saving games for example.

 

If you're talking about data on the player itself, well, that depends on what you're trying to make.

If it's a FPS, I'd say something about current health and ammo etc. :)

(maybe items, linking to game objects)



#3 Silfro   Members   -  Reputation: 112

Like
0Likes
Like

Posted 23 June 2014 - 08:25 PM

ok I understand now and know how I should do it.



#4 Eck   Members   -  Reputation: 2114

Like
4Likes
Like

Posted 25 June 2014 - 08:42 AM

If you're at the point where you're just learning how to program and aren't sure how to persist character data, you'll want to give this article a serious read.

 

http://www.gamedev.net/blog/355/entry-2250155-why-you-shouldnt-be-making-an-mmo/

 

If you're just misusing the term MMORPG and just mean a small Online RPG, that might be possible for a single dev (or small team). But you may still want to set your goals a little smaller as you're learning C++ or you'll quickly get discouraged.

 

- Eck



#5 Eruadan   Members   -  Reputation: 256

Like
1Likes
Like

Posted 27 June 2014 - 10:15 PM

I don't do too much C++ programming, but the overall concept is having your client send a request to the server to input data into the database. The server validates the data (makes sure it's not sent via a hack or other abusive way) and then executes a SQL query into the database. The server should also then update all relevant clients connected with the latest data.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS