Thread: multi user connections?

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    multi user connections?

    Best way to handle multiple users with different connection speeds. Graphic type game. Lang c. win.

    Meow.

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    TCP or UDP? Little more details...

    Buffer your data and send as much as you can when you get the opportunity - don't wait for a client. (Let no packet go to waste...) If a client can't keep up, assume network failure and kick them. (Or reduce the data you're sending, if this becomes problematic.) Consider an ability to remove out of date data from a buffer before it is actually sent.

    Do you need details on handling multiple sockets in general? (select(), poll(), multithread, there are tons of approaches, all with pros/cons...) Since you mention Windows... select(), or WSAAsyncSelect() if you have GUI.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    You should define your undestanding of the term "best way"
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  4. #4
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Do you need details on handling multiple sockets in general? (select(), poll(), multithread, there are tons of approaches, all with pros/cons...) Since you mention Windows... select(), or WSAAsyncSelect() if you have GUI.
    i can do that. Ok with sockets. Question is more connection configuration for game setup. Ie one tcp connection per player or one connection per turn then next player connection .

    Some options of consideration."best way"

    1 one turn per player. Sit and wait for each player to respond.
    2 ten turns for faster connection and one turn for slower connections.
    3 let slower connection user game piece idle while waiting for responce
    4 kick timeouted slower user.
    5 only move piece with user input.
    6 move piece based on previous input while waiting
    7 give slower player connection more armor so that when they are “picked on” by faster user with faster connection they can survive until their input comes in.
    8 deal with only one player at a time per turn then make next player connection.
    9 deal with few players at time then next group of players
    10 deal with all players tcp.
    11 best for games udp or tcp.
    12 other?

  5. #5
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

  6. #6
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    multiple threads that copy the game state to a local buffer then send the buffer. Once the send is finished, copy the current game state and repeat. with seperate threads a slow connection player cant slow everyone else down, they will just get fewer updates.

    also look into both asyncronous send/receive as well as WaitForSingleObject() as it pertains to a socket.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Add/Delete Remotely a user
    By Scarvenger in forum Windows Programming
    Replies: 5
    Last Post: 03-24-2008, 08:36 AM
  2. Replies: 4
    Last Post: 04-21-2004, 04:18 PM
  3. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM
  4. Multi user domains... How to?
    By Neonpricetag in forum Game Programming
    Replies: 1
    Last Post: 07-17-2002, 12:13 AM
  5. Stopping a user from typeing.
    By knave in forum C++ Programming
    Replies: 4
    Last Post: 09-10-2001, 12:21 PM