🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

beginning networking

Started by
16 comments, last by a2k 23 years, 9 months ago
TCP is NEVER a better choice. You don''t "reimplement" TCP when you make a guaranteed UDP protocol. Why? Since TCP is stream oriented, you will never, ever, ever, get data out of order. More to the point, your application will not see the freshest data the networking layer has received if ANY of the old data has not arrived yet. Why would you want to not immediately be able to process new data? Especially if you don''t even care about old data, because the new data invalidates it. There is no way to turn this behavior off in TCP, because it is stream-oriented. This is a major reason to choose UDP.

To my knowledge, no modern commercial game is implemented using TCP. The one exception I am aware of is Ultima Online -- and witness their networking problems. :^)

To the original poster, don''t even think about TCP. It''s a waste of time.
Advertisement
"TCP is NEVER a better choice"

Sorry, but anyone who makes a blanket statement like that is obviously either not thinking things through or doesn''t know what they''re talking about.
They tried using tcp for position data updates

If you madly broadcast data updates, then udp is what you use; for files, or events you use tcp. Chatting or purchases should probably use tcp. Thats the type of data broadcast they were designed for.

What would you do to send a file with udp? Serialize it and re-order it on recieve? just use tcp

There''s no reason why you can''t use both in a game.

- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Right, each has a place that it is appropriate for.
okay, now, where can i get some good udp tutorials or good books on udp using winsock, or directplay, whatever...

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
there are 2 well respected books on Winsock:

Winsock 2 by Lewis Napper
Windows Sockets Network Programming by Bob Quinn
I see. Really thanks all of you that answered my questions.

But I have another question about my game:

1. For the single player game, it is obvious that all AI should be handled by the player''s computer, but for the multiplayer game, would it be better to randomly select some players(clients) to handle the AI of computer players?

2. If one of the human player is disconnected from the network, is it good to replace the disconnected human player with AI of computer players which is handled by a randomly selected player from the rest?

Thanks for your help.

Longbow.
A good idea would be to figure out which computers have the fastest processor / most ram / best network connectivity and have some kind of ''election'' based on that whenever anyone joins or leaves the game.

I''d probably just run my AI on the server for simplicity, but I can see a few cases where there is just too much AI to do on the server.

This topic is closed to new replies.

Advertisement