Saturday, May 31, 2014

Sending Game Data to Server




Hi! I've been doing some work with Java Networking, specifically a Chat that sends a string to a server which then broadcasts to the other clients. I would like to create a game, but I am wondering how I would send data to the server in such a way that when it goes to the other clients, it doesn't confuse information.




For instance, how would I send the x and y coordinates of an object to a server. Please note that I would have other variables that might not be integers/doubles/floats, but maybe booleans, chars, or strings.




However, one thing that I was thinking is, would it be better (and possible) to send a whole class, such as a "spaceship" class or something like that. That way, the class would already contain all the variables.




In any case, thanks in advance!







No comments:

Post a Comment