Reputation: 197
I'm working on a relatively small shooter game project in C# that has to send over map data in chunks of voxels, together with player movement data, combat data and probably other stuff in the future. I already decided on using protobuf-net for serialization/deserialization of data between server and client but I don't know what way I should send the packets themselves. The example given by protobuf-net uses TcpListener.BeginAcceptTcpClient but warns that the example is in no way best practices. I'm aiming for supporting at least 30 users on a single server but of course I would prefer going up to 64 without it becoming too slow for the shooting gameplay to be even remotely practical. What way should I set up the TCP connection and handle packets?
Upvotes: 2
Views: 3129
Reputation: 2769
It seems kind of strange to use TCP for real-time high performance data exchange (although in some situations and depending on your network skills, you can make a case for it). Since reliability is not a core requirement but rather getting real-time world data, it makes much more sense to use a UDP connection (e.g. using Lidgren), specially when you're in a LAN setup.
Finally, here is an interesting article on the difference between TCP and UDP from a Game point of view.
Upvotes: 2