Sign in to follow this  
Haytil

Preliminary Multiplayer Questions

Recommended Posts

Hi, I'm thinking of implementing multiplayer (two computers, not split-screen) in my next game. It's a sidescroller, similar to a Super Mario game. Multiplayer would allow two players to play together in co-op mode, or to fight each other in deathmatch. Multiplayer would ONLY be designed for LAN play, so I won't have to deal with issues related to internet play (like longer delivery times and greater packet loss). I've read the FAQ and checked out some tutorials, but I have a few unanswered questions. My idea for multiplayer is to have the "server" computer act as the authority on everything. Every frame (multiplayer input would be strictly held to 30 FPS, or any other reasonably high number), the "client" computer would send its keyboard input values. The server would respond by doing the same, so both computers have all the input data and calculations will result in both computers and players seeing and believing the same thing. Is this feasible on a LAN? What is the typical delay for packet delivery? Would this allow data to be sent one way, received, and then the other data to be sent back and received, and then all relevant calculations made in such a timely manner that a decent frame-rate would be possible (something like 30-60 fps)? If a packet isn't received after a certain amount of time, it is resent. This way no calculations are made without all the relevant data, and hang-ups woudl only occur when packets don't make it or take a long time. Am I correct in thinking that this wouldn't be much of a problem on a LAN, and that such stuttering would only happen with a frequency of once every few minutes? Any other implementation seems ridiculous to me. Because this is a fast-action game, both computers need to know everything for the user to have an experience that isn't frustrating. It would suck to not see your friend jump when he does, only to see him stand there, and then suddently have him up in the air because your computer finally got updated information (in other words, synchronization in a fast action game where both players are both on the screen for most of the time seems impossible). Does my idea make sense? Any answers to my questions (specifically regarding LANs), or suggestions, would be appreciated. -Gauvir_Mucca

Share this post


Link to post
Share on other sites
So if I'm making my program depend on packet's being delivered (the game won't proceed until it has input data from the user's keyboard AND the keyboard of the other computer), and since I'm restricting myself to LANs, am I correct in believing that TCP makes more sense than UDP in this case?

-Gauvir_Mucca

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this