www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: ollioikarinen on May 27, 2007, 10:11:24 pm

Title: multiplayer: send and receive coords and angles
Post by: ollioikarinen on May 27, 2007, 10:11:24 pm
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. ;)
Title: Re: multiplayer: send and receive coords and angles
Post by: EgonOlsen on May 28, 2007, 12:07:01 pm
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.