Jump to content
  • Advertisement
Sign in to follow this  
Artur Litau

Saving player data

This topic is 1516 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);

int GetCharacterId() { return characterID; }

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".
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.

Share this post

Link to post
Share on other sites

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)

Share this post

Link to post
Share on other sites

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.




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

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!