Network game

Hello all,

I'm planning on building a network game for use over the internet. Now I'm working on the network communication but I'm running into difficulties.

I need a way so that when player 1 on computer 1 tells the game my character is going to move here, this is send over the internet to the server. when the server receives that, it needs to send the move over to player 2 on computer 2.

I know I can do this by simply broadcasting the move action to all connected players, but this has some difficulties as I have to take into account that player 1 might have a faster internet connection and thus will move faster on his comp then the same character would move on the comp of player 2.

If you understand what I mean.

Mark

[768 byte] By [ractoca] at [2007-10-3 0:23:09]
# 1

i'm new to java, but why should the internet connection determine the speed of the movement, it only could have effect on the updateSpeed of the player with a choppy iNet connection ?

My idea would be,

both players have the same clients with the same moveSpeed, every 0.x seconds the client sends his position to the server, when both positions are in, the server sends the positions back, and the client updates the position of the other player ?

hope this isn't complete wrong ;).

regards,

chillum

chilluma at 2007-7-14 17:15:21 > top of Java-index,Other Topics,Java Game Development...
# 2

well yes, this would probably work with a small number of players. But it would also generate excessive network trafic. It would be much more efficient to have the players send their move (I want to go there with this speed) to the server. Then let the server calculate their path and send their positions to each client every x seconds. All the clients need to do then is have some piece of code to interpolate the trajectory in between the points send by the server.

This would cut network trafic significantly because only the server is needed to send the intermediate positions to the clients.

ractoca at 2007-7-14 17:15:21 > top of Java-index,Other Topics,Java Game Development...