Ok, I know I'm trying to become a master of all things in game programming, but what can I say? I'm obsessed. I've finally got a nice network engine going for my game http://www.tommytwisters.com/spaceops/spaceops.jnlp
. And it works great up until you get around 4 people connected. Literally, it'll go from smooth as butter action to jumps and warping as soon as a 4th or 5th person hops on. I've tried to minimize my # of packets sent and received, as well as packet size (I don't know how to make them any smaller). This is my packet breakdown:
Header (12 bytes) - includes client ID, gameID, and Packet size.
Subheader (16 bytes) - includes attachment size, time sent, playerID, and type of event.
Attachment (variable, but usually no more than 12 bytes) - depends on type of event.
I only send changes through the network, with an occasional update (every 10 seconds) of all player information to verify synchronization. Packets sent from client range from 0 to 40 packets per second. The server grabs the information it tracks, and then sends the packets on to the other clients. It ends up being about 1500 bytes per player per second to each client. It's an action game, so I don't know how to send any less without it getting the jitters.
I've also written a dedicated server to run on a separate box in case it was just processing power, but the problem still occured.
Any ideas? Finding a good network engine optimization tutorial seems near impossible.
P.S. I'm using Java NIO, and the initial connection is made via TCP (in order to establish a tunnel over NAT if necessary), and then mostly UDP for everything else (I do an occasional ping from the server to determine client latency in the form of a TCP packet).