Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ishamael

Peer to Peer Connections

This topic is 6731 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anybody know of any good resources on the Web that''ll help me get started using peer-to-peer networking? I''m thinking of incorporating multiplayer capabilities in my next game, and just thought I should start learning now. I know there are lots of client-server tutorials/references out there, but I can''t find any peer-to-peer ones. Can anybody help? Thanks, Rand P.S. - Before you all start saying how peer-to-peer is aweful and slow and that client-server is much better, I''d just like to say that the reason I''m not using client-server is that I have no money to buy/rent a server ;-)

Share this post


Link to post
Share on other sites
Advertisement
Actually most network applications that seem peer-to-peer (including most games) are actually operating as a client/server architecture. It''s just that one program acts as a server. In practice running a server for a client-server network that replaces a peer-to-peer network doesn''t take that much more processing power/bandwidth than the equivelant peer-to-peer version.

Another reason that you might not be finding that much information on peer-to-peer networking is because there isn''t really all that much to it. Just what kind of information are you looking for? Most of the basics will remain the same. (Unless doing a multicast or broadcast protocol.)

Share this post


Link to post
Share on other sites
Well, I''m basically looking for information on how to structure a p2p game. I''ve never actually done any multiplayer networking before, so I''m just trying to learn the basics. Specifically, how would I find out who else is playing the game so it could connect to their IP address? And how would I handle a connection to lots of other remote computers at once? Are there any tutorials or resources out there that talk about these things?

Thanks,
Ishamael

Share this post


Link to post
Share on other sites
Well, in a peer/peer architecture, there''s no central authority for determing players/active games. So here are some options:

If all the players are on a single data-link segment of a LAN, then you can perform a broadcast on that link saying, "I''ve started a game, join me." in either IPX or IP (or Appletalk if you''re feeling evil).

For IP over the Internet, you''ll pretty much have to make the players enter the IP address of the other computer(s). Hopefully just one host, and if you''re really set on doing a full peer/peer network, that host will tell you the IPs of all the other currently joined computers.

A third option is to register a multicast IP and negotiate games over that. On the downside much of the internet doesn''t route multicast still, so you''ve got a whole mess of people unable to join games like that. Also it''s a pain to get a multicast IP allocated to you.

Otherwise you need to setup a server for negotiating games (which you don''t want to do) or rely on third party methods. Ex: I think you can get ICQ to spawn applications with command line parameters for you. So you can make your program "ICQ friendly" or something like that so you can automatically hook up with people on your contact list.

As for handling connections to lots of other computers, there are several options.

Over a LAN you can use broadcast packets.

Otherwise over the internet, you can either have all the computers form connections with one host, who will then re-send relevent information from the other computers properly (a client/server configuration actually) or you can have each computer send packets to all other relevent computers. (Using UDP or some other datagram method works best for this kind of work.)

Once you''ve got that information is a matter of finding out how to perform each of the kind of operations. If in using Windows Sockets I recommend "Winsock 2.0" by Lewis Napper.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!