Using TCP means any minor network hiccup will result in lag spikes that you can't really do much about - the lost packet / retransmission / reordering logic is handled by the OS, not you.
Using UDP means managing it all is up to you. Like Secrets said, it is obviously a lot more work, but you get to adapt the netcode to the precise needs of your application.
For anything even remotely ressembling an FPS or a 3D MMO, UDP is IMO the only reasonable approach.
You can look at the ioquake3.org project. The project is opensource and the netcode is done by John Carmack who is basically a demigod as far as 3D multiplayer gaming is concerned. Suited for fast-paced FPS. Very efficient, and fault tolerant on bad networks. Hard to scale past 64 players (will require a lot of reworking).
EqEmu is also opensource and also relies on UDP netcode. Better suited for larger scale games, such as *surprize* Everquest, but has nowhere near the efficiency of the above.
It might be worth checking the iodoom3 project as well. Basically it's the next generation of the ioquake3 engine. I think it's in C++ and not in C though (like ioquake3). Not sure how much better it is, if at all.
|