I am trying to make a small multiplayer game in Java. I got the tpc connection working, but for now i can only transmit strings. I would like to transmit more sophisticated data in packets, which would contain all the necessary data for synchronizing the game. Is it possible to transmit some kind of custom structures, or data from class instances in one tcp package? Or what would be a good way to do it(i googled but i couldn’t find something that would fit my needs)?
Share
In general, the keyword to look for here is serialization. That is the process of converting a data structure to a chunk of bytes that can be sent across a socket or other transmission medium.
One way to do this is to use the Google Protocol Buffers library, which has bindings for use with Java.