[MUD-Dev2] [TECH] Client time-server time sync

John Buehler johnbue at msn.com
Tue Apr 24 22:39:50 CEST 2007


Roger D Vargas writes:

> Yesterday I was talking to a friend and he insisted in the need of
> having perfectly synchronized server and client time, among other
> things, to calculate movements. I had thought that such thing was not
> needed, as I just need the notification of move start and figure out
> every certain time the location of player until a move stop notification
> arrives. Am I wrong about this?

You are correct about this.

I would strongly suggest that you create a very simple 2D movement
client/server application to find out what you're up against.  Just
something simple that lets you move a circle around a window by using the
arrow keys.  The client processes the keyboard events and sends messages to
the server, which sends movement or position messages back to the client.
Make sure that you put in something that will ensure that there is some
latency between client and server.  If you have to, put in a timer that
delays the server processing of messages from the client by some number of
milliseconds (start at 0 and work up to 300 or so to see what happens).

Run that simple application with two clients and see if you can move your
circle in unison with another user's circle.  See if you can get crisp
response from the moving circles on each client.  If you implement
character-to-character collisions, see if you get any kind of logical
behavior when the two circles meet in the window.  Just remember to include
some kind of latency between client and server to simulate variable ping
times between your clients and the server.

The design you choose may end up based on the network latency that you
demand from your player connections.  If you're on a LAN, you can do certain
things that you can't do on the internet.

JB





More information about the mud-dev2-archive mailing list