Server for online game

221 Views Asked by At

I want to make a multi-player online game which will require some fast data exchange between users (that's why i need UDP). So, I probably need to have an UDP Socket Server that will receive data from a player in a game room and send this data to other players in that room. Am I right? What should I use for this server? Probably I must put there some script that will run all the time and serve the clients. Should this script be written in Java, Perl, Python, ...? I just don't want to waste my time and choose completely wrong direction, so I need some advice.

Thanks :)

1

There are 1 best solutions below

0
On

If you want something fast to relay UDP packets between clients, I'd actually go with a C implementation. No memory management overhead in the runtime, and less overhead in parsing the data.

If the data is primarily fixed length, it makes parsing very easy. Rather than going through a heavyweight serialization / deserialization process, all you would need to do is define a struct that represents you data and have a pointer to that struct point to the beginning of your data buffer. And boom, you're done. Just make sure to use ntohs and ntohl to properly read integer fields.