Network message serialization for game

Posted by George R on Stack Overflow See other posts from Stack Overflow or by George R
Published on 2010-12-26T23:39:08Z Indexed on 2010/12/26 23:54 UTC
Read the original article Hit count: 203

Exit-games make a network library product called photon, and they have and actively develop a limited mmo demo. Rather than shooting off json or XML, etc. saying "MovePlayer" (with associated params), they nut that message down to a 2 digit int, via an enum - something like Operations.MovePlayer. There's no denying that a 2 digit int is smaller than a longer string, however I really hate the idea of statically burning each and every message into an enum.

Would there be an alternative way to have a MessageID property assign itself a unique 2 digit int based on a lookup table or something? Has anyone dealt with this kind of thing before?

© Stack Overflow or respective owner

Related posts about c#

Related posts about networking