Thread: writing a server app

  1. #1
    sockets mad
    Join Date
    Mar 2002
    Posts
    126

    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

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. c program client server
    By steve1_rm in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-24-2008, 10:33 AM
  2. Server and Client process
    By wise_ron in forum Networking/Device Communication
    Replies: 1
    Last Post: 10-07-2006, 01:11 AM
  3. Client - Server TCP/IP MFC app..... Help!
    By amedinadiaz in forum C++ Programming
    Replies: 0
    Last Post: 10-26-2005, 11:57 AM
  4. Server deadlocks, Nonblocking IO, or Timeout?
    By 0xception in forum C Programming
    Replies: 6
    Last Post: 01-03-2005, 12:49 PM
  5. SMTP Server Not Working
    By (TNT) in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-15-2003, 05:33 AM