Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm designing an MMOFPS. I'm not sure whether to use one UDP port for all clients or one UDP port per client. Or is there another alternative?

Currently UDP is only being used for position data (X,Y,Z, heading, and pitch).

share|improve this question
    
Do you mean on server? –  Miro Jun 30 '12 at 8:46
    
Wait, why not just have one port for the actual game? –  jco Jun 30 '12 at 17:21
    
@Miro, yes I'm asking about how many UDP ports to use on the server. –  Xavier Jun 30 '12 at 23:56

1 Answer 1

Having one UDP port per client seems complicated an inefficent. The client would need to start by sending a open-port-request so the server opens a new port for that client. Also, the performance for checking ports for available data might degrade with the number of sockets.

As long as the received datagram is handled quickly so the thread can continue receiving new data I don't think you'll have a bottleneck here. A solution would be to have one thread receiving UDP datagrams and just putting them on a queue. Use a pool of worker threads that pop data from queue and perform the actual work. The number of worker threads could be chosen to match the number of cores available on the machine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.