packets, graphics, and online games

This is a discussion on packets, graphics, and online games within the Game Programming forums, part of the General Programming Boards category; Ok, this question is directed towards more advanced programmers. I'm still a little green when it comes to transfer protocol, ...

  1. #1
    Registered User Invincible's Avatar
    Join Date
    Feb 2002
    Posts
    210

    packets, graphics, and online games

    Ok, this question is directed towards more advanced programmers. I'm still a little green when it comes to transfer protocol, and it boggles me when I try to conceptualize the mechanics behind massively multi-player online games. Well, maybe it even boggles some professionals. Just look at Funcom's AO disaster.

    Anyway, by chance, is there anyone here who can explain some basic theory, offer some pseudo code, or point out a document that might answer some of these questions (I'll try to be as clear as I can):

    1. How are the routines and memory usage divided between the user and the game server?

    2. Using packets, how are the locations of other players kept track of and displayed on the users screen in the proper location?
    (this is the one that keeps me up nights)

    3. Back to question one, assuming it would be impossible for one user to store information for 3000 users in memory (not to mention NPC's) how does the code determine which information to keep, and which to destroy.

    4. This one may be a bit more general, but how much memory would take to host three thousand users playing such a game, how much of the information gets written to hard disk compared to how much actually resides in memory, and how how are the packets sent between users so seamlessly?

    Whew, I know that's a lot. Any information would be most appreciated.

    Thanks.
    "The mind, like a parachute, only functions when open."

  2. #2
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    1. How are the routines and memory usage divided between the user and the game server?
    I will use my favorite online game to help you. Tanarus

    You have 4 teams. 5 tanks on each. (Red, Blue, Gray, Green)

    Then you have different types of tanks (Mag, Van, Cham, Lite, Dev)

    Different Weapons (too many to list)

    Each tank (player sitting at home) simply store only their information.
    team, weapons, armor/crits, and location.
    They also store the needed information about other tanks.(what team, tank, and location.)

    When you are hit it goes something like this.

    1.They fire and hit.
    2.Packet is sent to the server then routed to you.
    3.Your computer handles it from here on.


    2. Using packets, how are the locations of other players kept track of and displayed on the users screen in the proper location?
    (this is the one that keeps me up nights)
    Ok. Online gaming means data stream.
    Each player (meaning their computer) sends its information to the server. Lets say armor/crits, location/direction/speed.

    The server simply routes the information to other players.
    Code:
    Lets say this is our data stream.
    ----player id, location/direction/speed, armor/crits, other stuffs---
          string       int x,y,z   angle,  int          int     int     string
    
    player id = Who the player is.
    
    location = Just that. Note the three int. Remember we are in a 3D world.
    direction = which way you are traveling. I think its two int which tell the horizontal and vertical angles, but I don't recall
    speed = you already know.
    armor/crits = nm
    
    other stuffs = here is the fun part. This is the core of the data stream.
    Any thing that you do that other players can see is here.
    i.e. fire weapons, missiles, mine sweeps, etc.

    3. Back to question one, assuming it would be impossible for one user to store information for 3000 users in memory (not to mention NPC's) how does the code determine which information to keep, and which to destroy.
    Sorry but thats the programmers job.

    4. This one may be a bit more general, but how much memory would take to host three thousand users playing such a game, how much of the information gets written to hard disk compared to how much actually resides in memory, and how how are the packets sent between users so seamlessly?
    It just deponds on how powerful the server is.


    owwww. After all that here is some design.
    Code:
    class cArena
        {
            array<cTeam> team;
            someType battleField;
            int timeOfDay;            //just to add effects
        }
    
    class cTeam
        {
             array<cPlayer> members
             color thisTeamsColor
        }
    
    class cPlayer
        {
            string name;
            long bounty;              //how much you get for killing them
            long score;                //How many point you have collected
            int[3] location;
            int[2] direction;
            int speed;
    
            cTank playersTank;   //Configs on the players tank
    
       
        }
    
    class cTank
        {
            int bays;                       //Spots to store weapons
            int maxSpeed;
            int armor;
            int crits;
            array<cWeapon> weapons;        //list of weapons  
            cTankType myTank;
        }
    
    class cTankType
    {
            void draw();                        //your draw method
            void specialWeapons();      //places whatever weapons that 
                                                       //come with the tank in the 
                                                       //cTank.weapons
    }
    the rest just depends on what you want to be able to do inside the game.
    mostly methods. there is alot more but its 4:20 a.m. and I have to go.


    Hopefully you will have more questions. So just post them.
    I will hit you back.

    BTW
    All that, I just came up with.
    I love programming off the top of my head.
    But thats how I would design it.
    Last edited by Nor; 04-14-2002 at 02:24 AM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  3. #3
    Registered User Invincible's Avatar
    Join Date
    Feb 2002
    Posts
    210
    Sorry for the delayed reply. I can see you spent a lot of time on this and I greatly appreciate it. Although most of it made a lot of sense, I do have a few questions if you're still following this. They all tie into each other.

    You say that a data stream sends and recieves information regarding the players and and their attributes.

    Some of these values sent over the stream would be constants as long as the opposing player is in view (ex. player ID, team color, tank type) -- things that can't possibly change while the the other player is in view. Then there are the other aspects that change constantly -- damage, projectile type, location, speed, direction ect...

    So getting back to the intense memory management that would be involved in maintaining a data stream like this, is it safe to assume that the constant variables are destroyed when the players leave each other's viewable sphere?

    Also, are the constant variables sent repeatedly along with the dynamic variables, or only when the players first enter each other's viewable sphere?

    Whew... I know that's a mouthful and you may not have all the answers, but you seemed so anxious to share knowledge

    Thanks, Invincible
    "The mind, like a parachute, only functions when open."

  4. #4
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    So getting back to the intense memory management that would be involved in maintaining a data stream like this, is it safe to assume that the constant variables are destroyed when the players leave each other's viewable sphere?
    Yes. But Even if the other players are not in view, you should still keep the data.
    Once they leave the game (Or arena in my previous example) it would be efficient to destroy the data.

    Also, are the constant variables sent repeatedly along with the dynamic variables, or only when the players first enter each other's viewable sphere?
    The examples I given was just to illustrate a design outline which could solve many of the problems concerning data management.
    Now sense this is for a multiplayer game, you will have to distinguish between the different players information. So it would be logical to include a constant(i.e. playerId) with the data stream.

    Anything else?
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  5. #5
    Registered User
    Join Date
    May 2002
    Posts
    132
    Well most of these questions are too general to be explained just by the examples you have been given. I currently am on a team that is designing an MMORPG game, and its not as simple as all this. There are many factors to begin with, but for memory management. Only the server needs to really keep track of all the player's information + NPC's information. The clients only need to keep track of information that relates to the drawing environment at the time.

    For example, say that there is a person in front of your character and one behind. Why keep track of the person behind? Now it all depends on your environment, as I've stated. In some cases you may want to keep track all characters that would be within sight of your character (even if your not looking in that direction, but as far as your character would be able to see if that character were looking in that direction). This way if your being attacked from behind, and the person behind's gun moves in front of your sight. You can properly draw this in this case.

    There are so many factors to consider that it takes months of planning, and sometimes months upon months! MMORPGs are so in depth that it usually takes teams of 60 people plus in order to complete them in a reasonable amount of time. One person could possibly finish such a large project but I would suggest years and years of actual experience with actual game programming (on a real team for a game that makes release). And a very good knowledge of the programming language you intend to use. Which means almost every aspect, from basic DOS programming to Windows programming. Furthering yourself into DirectX (or OpenGL if you prefer), sockets, and other aspects. And I would suggest a very good knowledge of the operating system you are designing your project for, and knowing the Assembly language wouldn't hurt either!

    Now all of this isn't manditory, but thats what I suggest for a lone programmer who is attempting an MMORPG project!

  6. #6
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    What is a MMORPG?

    Also I am the a solo development of a 3d gaming engine.
    I have based it on a simple Clint/server architecture, and not anymore complex than what I have described in previous replies to this post.

    Why should a game of any kind be complex when its unnecessary?

    Lets through some ideas across and see if we could help each other.
    What type of design are you implementing?
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  7. #7
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Massively Multiplayer Online Roll Playing Game

    Although, I have actually never played one.

  8. #8
    Unregistered
    Guest
    Wow Tech, you don't know what you're missing out on! They're amazing. Try one. I suggest EverQuest or Dark Ages of Camelot.

    Thanks for the insightful post tyouk. I'm sure the process is overwhelming for just one person. Maybe even crazy and implausible. Especially when I'm not much of an artist. The server technology alone is probably too much for just one person. Although, I do suggest (to anyone else looking into this subject) taking at look at some of the source code for MUDs that is widely available acrsoss the net.

    Nor, I'm not implementing anything. I was just hungry for knowledge

    I'll probably end up begging for a job at SOE or some other online game development studio.

  9. #9
    Registered User
    Join Date
    May 2002
    Posts
    132
    The server technology of a game such as an MMORPG is quite a feat., and actually looking at the source code for a MUD is a great place to take a look. A MUD is a basic-level design for what could possible lead to an MMORPG server.

    However, you usually tend to need a lot of resources for your server. No desktop computer, that I know of as of yet, can handle such a feat. Our server right now isn't too bad, but it has to keep track of about 3000 NPCs (plus maybe more), and also will have to keep track of about 3000 players (or more for these as well). It also has to keep track of account information, for login purposes, and whatever other features you plan to add to it. AI is probably one of the bigger ones on memory because it has to deal with the actions for all those 3000 NPCs. Then there is the code that deals with all the data streams to all the 3000 clients or so. (Smarter servers will determine which information deals with which clients and then sends updates to the proper clients only so then the clients don't have to weed out the updates that they don't need.)

  10. #10
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    For anyone still following this thread, this is the data stream i've been working on.
    Please give constrictive criticism.

    Also looking for anyone that is good at 3d graphics to provide free samples.
    any "true space" format please.

    NOTE: This post can be used by ANYONE whom wishes to use it.
    Please email me if you do.


    OUTLINE:
    Each gaming area logically has its own Data Stream
    The DS is broken into 3 multi propose segments -- here referred to as packages--
    All packages are sent on a need to know base to limit bandwidth consumption.

    The only section I will leave out is the one concerning package filtering.
    My method has not been stress tested. In two weeks I will post the results. see Section 4

    Section 1
    There are 3 types of packages. (names subject to change)
    1.) protocol
    2.) universal data
    3.) specific data

    1.) protocol :
    Handles login and other startup task (passing needed variables to the client).
    NOTE: Based on http
    2.) universal data :
    Contains background data. (player id's, rank, etc.)
    see section 2.
    3.) specific data :
    Projectiles, player stats (location, directions, score, etc.), chat.
    also see Section 3.

    Section 2
    Uiversal data
    This includes all constancy information. Things that can/will change should use package type 3 (specific data).
    For purpose of example I will use my game. Under development. No name.

    All player information.(name, rank, score, exp level, racer type)
    Also dynamic arena information such as weather, black ice, and npc raiders.

    Section 3
    Specific data
    Location, projectiles, stats, and the chat. This also includes administration commands for peoples names I don't need to state. caugh--mike--caugh


    Section 4

    Here is the Simulation's stats.
    200 school computers over a 100mbs LAN.
    (Using DirectX packetloss and lag
    simulation on all clients. 2.8k sec. 180 - 1200 lag 0-100% loss)
    Trying to make a connection like this simulate a 56k
    is making me have dough's about the results I will get.
    There is no plans for a real Internet simulation as of yet.

    This is just more detail then what i've stated before. I will add to this next chance I have.
    This design does work well for me, but as stated above. It has not been given a good stress test.

    Posted in hopes of new ideas. b/c i'm running low.

    Almost forgot.
    please rate this design. good, ok, bad, or give-up
    Last edited by Nor; 05-27-2002 at 05:19 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  11. #11
    Registered User Invincible's Avatar
    Join Date
    Feb 2002
    Posts
    210
    Guess I'm still subscribed to this thread. It looks good Nor, its confusing to me so it must be somewhat advanced. I guess what I really don't understand is how you can be selective in what data you send, and how you can open a new stream for each data set. Does it involve opening 3 seperate sockets, or how does it work? And how do you determine what information the client "needs to know?"

    I just wrote my first winsock server (non-blocking) last night so I don't understand data streams very well yet... (I haven't even written a client for it yet!) For anyone who wants a thourough, yet simple, tutorial on creating a non-blocking server with winsock (the kind they use in MUDS and MMORPG's) here it is:

    http://www.gamedev.net/reference/art...rticle1494.asp

    Great thread Invincible, oh wait I am INVINCIBLE.
    Last edited by Invincible; 05-27-2002 at 08:27 PM.
    "The mind, like a parachute, only functions when open."

  12. #12
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    If its confusing its b/c I have a hard time explaining things.
    Now i'm just writing my ideas down for fun and future reference.

    I only open one socket.
    Each packages is sent at different steps in the game.
    The first 2 are only sent once. Then all updated information is sent using the type 3 package.

    In reality my design and application have their differences. This is how I look at it.
    Each package is a conversation in which information can travel both ways. Once everything has been said the next package starts.


    The only thing which needs to be updated is package type 3. The way I worked it,
    each client sends 1 package at intervals to the server. Same for the server. Once every second the server sends updated packages to all the clients.

    max. of 20 players and 5 ghost + cops.
    Each Specific data package is about 6 int s long plus projectile objects (5 int) and chat.


    These are the steps that my clients take when entering a race.

    Step 1.) First the user has a few options.
    1 of 5 ships to race in. (hoping for more)
    Different racing areas.
    And weapon configurations.

    Step 2.) The user waits for the arena to open.
    Once the arena is open, the socket is created and the datastream starts.
    The first package sent is the protocol. The username and password is sent to the server. If the players rank and exp. level meet the min. then they are allowed to play. If they do not then they can only watch, and are ghost to anyone playing.

    The other information passed once the player can play includes:
    Player type (ghost, active, or cop)
    client reported rank
    ship
    weapons
    limited items
    time limits (5, 10, 15, 30 minute sessions).

    All information packages, passed between the server and client uses http protocol. (why redesign the wheel)
    All packages are encoded and warped for security. Every time the client starts talking to the server, a new code key is used. This helps prevent the use of packet editors. I'm trying to make this game hacker free.

    Step 3.)
    Universal data packages are sent.
    These mainly consist of information about other players, arena conditions, and NPC.
    Sense no new players can enter the arena, only logout (leave) then the information gathered here is used for the in play chat. This may change in the near future.

    Step 4.)
    Specific data is the core of my design. It reports all the updated information about players and chat.
    This is the only package type that is sent more that once.
    It is make up of a 3 objects.
    Object 1 is the player information. 6 unsigned integers in length.
    Object 2 is players projectile information. 5 unsigned integers long for each shot fired.
    Object 3 is the chat. A 45 char Max string. (This i'm going to change soon.)


    I'm reading the site you stated now.
    It looks good, but i can open listening ports. I'll read it anyway.
    I wish I had a couple of screen caps just to show off, but I need to make the graphics first. My wire frames don't look that enticing
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  13. #13
    Registered User Invincible's Avatar
    Join Date
    Feb 2002
    Posts
    210
    I understand about graphics, I'm not much of an artist either.

    I have a suggestion, instead of doing the usual thing and making the non-playing users ghosts, why not turn them into spectators? Then they can get naked and run around the arena when they're excited

    Anyway, I told you this is all very advanced at my level of understanding . First of all, I have no idea how the code would actually look like for warping and encoding the packages and generating new code keys. If you'd care to explain the process I'd be greatful.

    I'd really like to see any source you have for your server if that's possible...

    Invincible
    Last edited by Invincible; 05-28-2002 at 01:02 PM.
    "The mind, like a parachute, only functions when open."

  14. #14
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    Originally posted by Invincible
    Then they can get naked and run around the arena when they're excited
    LOL i love it.
    Code:
    class cProject    //Projectile Information
    {
    	int directionH, directionV;
     	int locationX, locationY, locationZ;
    }
    
    class cPackage3   //Specific data 5int's
    {
    	int directionH, directionV;
    	int speed;
    	int locationX, locationY, locationZ;
        vector<cProject> projectile;
    
    }
    
    
    char* encode(cPackage3 pack,String key)
    {
    /*
    Convert all values into a http header. This header is a string.
    Then apply basic encryption.
    */
    }
    Sorry about the source. I talked to my p and he says "|-|3l| no".
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  15. #15
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    Each Specific data package is about 6 int s long plus projectile objects (5 int) and chat.
    TYPO:
    In the outline code, my commints are outdated.
    The size of the Data Stream object is wrong.
    cPackage3 is not 5int's! It is 6int's + any cProject

    - Nor
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming opportunities! (Midway Games, Inc)
    By Midwayrecruiter in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 08-20-2008, 11:02 AM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  4. Starting games - books? api?
    By SeanMSimonsen in forum Game Programming
    Replies: 22
    Last Post: 11-27-2002, 08:09 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21