-
writing a server app
Hi,
I've had an idea for an online game for quite a while now and wanted to start working on it. it works on the client/server model with users logging in and being able to chat and mesage each other etc. They can then challenge eachother to a game which is RPG based. The client code is not really a problem but the server software, I'm sure I could do it, but I want to get it right, not just working.
I've decided I'm going to use mysql and the C mysql API for fast data retrieval rather than flat file which would probably be more work anyway. The problem (issue really) I have is deciding which data to hold in the database and which to hold in variables. My question is this really....
Is it good practice to hold session specific data in the database or should it just be held in memory (variable of some type)?
To explain it a bit more...Obviously data like account information, scores, league tables, items, and the like should be stored in the database, but what about a health of a player in a particular game which is going on? This would change often and would be dumped when the match ended (typically only a few minutes per match). Would this be a candidate for database data? My guess is that short lived data that changes often would probably be a candidate for server memory, but I'd really like to ask other people's opinion.
I really don't know....
What's everyone think? Any help greatly appreciated.
-Dan
-
hi im also working on a network game.
about your health-problem, the best way to do that
is to use something called prediction try searching on it in google.
it goes something like this:
in the game say that a player would shoot at his aponent
then his side, the client should send only the necessary data
like speed of bullet, distance,angle etc.
to the server and the server would then check if these are valid
if they are the server sends what its calculated would hapen (it
predicts the future of the game)
like a headshot or something like that.
this method is used in all new multiplayer games like Counter strike medal of honor etc.
if youve played these games you can notice that sometimes when you get a lag or a connection problem your player starts
to move choppy. that is because of the prediction.
me myself dont use this method as its harder.
I just have a server and a client, and the game is a school-project
so i send the data directly to the other side and the other side
would the trust on his partner that he isnt cheating him:)
btw i use winsock.