multiplayer: send and receive coords and angles

Started by ollioikarinen, May 27, 2007, 10:11:24 PM

Previous topic - Next topic

ollioikarinen

Hi!

After about 5 years I'm back - things have come and go but JPCT stays and stays strong! ;)

I have a question about multiplayering, how to send and receive object's coordinates and angles. I have a game (an applet) with a planet and 2 ships. The applet creates a socket connection to my GameServer.java which receives strings and sends them back to both.

I manage to send a string like this:

out.println(id+"|"+shipMe.getTranslation());

...where id is an unique int (so you don't deal your own coordinates). But I have a trouble to find a way to "set" this translation to the other ship. And the same for the angles...

Any help - a code-snipplet with Float.valueOf(thewholemessagewhichneedstobeparsed.trim()).floatValue(); parsing examples - would be great!

Thanks everybody, especially Helge!

P.S. It's late and too many lines of code, maybe I'll figure it out tomorrow by myself. ;)

EgonOlsen

Hi and welcome back! In the news-section, you'll find a new example for downloading that does client-/server-stuff. Maybe it contains some helpful stuff.