Converting Slime Volleyball to online play?

Hi, I am new to java programming, but I was wondering if there would be some (potentially easy) way to convert a game which is multiplayer on the same computer into a game which could be played between two computers? The game I have in mind is slime volleyball, which can be seen here:

http://www.fetchfido.co.uk/games/slime/slime_volley_ball_game2.htm

How would I go about turning this into a network game? Thank you for any help or advice you can give me.

This is similar to the following question:

How long is a piece of string?

Hard to answer, isn’t it? :wink:

There’s probably no really easy way, but this is what you might do: During the update of each frame in the game you now need to have data arrive over the network regarding the other player, and you have to send your data to him. Input no longer comes from the keyboard for example, it comes in on a socket. It might take a little work figuring out the most efficient way to send the data.

Regards,

Bill

Hi

I've had a similar problem with a game i made. My solution was to send the new position and the angle trajectory every time that a player interact with the ball. By this way, you only will send the information needed when the ball is changed by your players. 
Also I recommend to use UDP(DatagramSocket,DatagramPacket) protocol for this game because you will need speed comunication protocol.

This game is very funny, but, Is there some option to play against the machine?

There’s a link to the 1player version at the top of the screen on the link given above :slight_smile:

[quote]Hi, I am new to java programming, but I was wondering if there would be some (potentially easy) way to convert a game which is multiplayer on the same computer into a game which could be played between two computers? The game I have in mind is slime volleyball, which can be seen here:

http://www.fetchfido.co.uk/games/slime/slime_volley_ball_game2.htm

How would I go about turning this into a network game? Thank you for any help or advice you can give me.
[/quote]
I don’t know how the game handles it’s player input, but here’s how I’d go about it. I’d remove the player i/o into a separate component. Then I’d hide it behind an abstraction layer. Sort of a “black box” operating through an interface. Then after it works fine, I’d modify the component hiding behind the interface. Only one player’s input is read from local device. The other player’s input is received from a network socket. Then the local player’s input is sent to the socket. As long as you can stay “black boxed” behind the interface, you don’t have to touch the game code. Hopefully! ::slight_smile:

Of course it’s not as simple as that but you’ll figure it out when you’re doing it. First step is to completely remove the keyb/mouse/pad reading from the actual game and hide it behind an interface.