[Tutor] how to build a multiplayer game?

Alan Gauld alan.gauld at btinternet.com
Wed Apr 11 19:42:19 CEST 2012


On 11/04/12 14:30, Surya K wrote:

> Don't you think DNS is required as IP addr may be same for some people
> in this world.. after all, we only have limited number of combinations.

DNS only translates a names IP address into a numeric IP address. It 
does not create any extra addresses - thats why we are running out of IP 
numbers!

You may be thinking of NAT which translates a public IP address into
a local network address and thus allows many computers to share the same 
set of private IP addrewsses - 198.162,x.y for example can be
used on any LAN and the LAN will be seen from the outside as another 
public IP address.

But all of that would be handled by whatever network configuration you 
and your users have set up. The only exception might be that to get 
through a firewall you need to open up a particular port number.

> * I even got a wild idea, can't we use a IRC channel, create a group and
> we make sure that each user of the game will be a member of the group??
> approx, how much delay would be there??

Yes thats a possibility too. But then you will need an IRC server 
somewhere. Setting up an IRC server is not much different from
setting up a web app server.

Delay on the internet is highly dependant on routing. If your packet 
happens to go the wrong way it can wind up jumping around all manner of 
very busy/slow networks before it reaches you, in which case it might 
take a few seconds to reach you. OTOH it might rout via a direct link 
betwen the two ISPs involved and the delay will be <=100ms...

Part of the challenge of network programming is deciding how to deal 
with those two scenarios. It's perfectly possible for packets to arrive 
out of sync (ie packet two arrives before packet 1 because they were 
routed differently). Do you hold packet 2 and wait for the late packet 
or request a resend as soon as packet 2 arrives? There are no right or 
wrong answers, just different choices for a given scenario.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list