Author Topic: multiplayer: send and receive coords and angles  (Read 3415 times)

Offline ollioikarinen

  • byte
  • *
  • Posts: 12
    • View Profile
multiplayer: send and receive coords and angles
« 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. ;)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: multiplayer: send and receive coords and angles
« Reply #1 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.