Original Post
I want to know how a game encodes it's messages that are sent to all the other users playing the game.
What I have is a simple game, with characters and objects. Players, as characters in the world, can pickup, drop, give, receive and interact with these objects. Currently, in the engine, every object and character has a url, more like a code to identify it, a single byte in this case (char).
I have no prior experience with network programming, but right now I have a thin layer programmed over UDP that allows me to send and receive simple packets in a reliable fashion.
What I want to know is, how do I pack all this information, in a generalized manner? What I can think of, is give every function a code, like, dropping can be 1, picking up can be 2, giving can be 3 etc. Then just send the character code, object code, and the function number. This information can be decoded and performed on all the other clients. Is there a more elegant way of doing this?
What I have is a simple game, with characters and objects. Players, as characters in the world, can pickup, drop, give, receive and interact with these objects. Currently, in the engine, every object and character has a url, more like a code to identify it, a single byte in this case (char).
I have no prior experience with network programming, but right now I have a thin layer programmed over UDP that allows me to send and receive simple packets in a reliable fashion.
What I want to know is, how do I pack all this information, in a generalized manner? What I can think of, is give every function a code, like, dropping can be 1, picking up can be 2, giving can be 3 etc. Then just send the character code, object code, and the function number. This information can be decoded and performed on all the other clients. Is there a more elegant way of doing this?