1
\$\begingroup\$

Suppose I am making a co-operative multiplayer music-based rhythm game -- two players, side by side, move their cursor/avatar left and right with their mouse and attempt to hit or dodge obstacles that are coming towards them.

The problem here is that if there is latency in the connection, say 200ms from player B, then by the time player A receives the movement from player B, it will have been too late -- the players' position on the track will be ahead of where it was when it was sent.

There is also a problem with running them in a sort of lockstep where the two players wait for each other to acknowledge their respective inputs -- the music must continue playing without delay on both players' clients, otherwise it will sound very choppy and the player actions might not line up well with the rhythm, which isn't what we want.

How can we deal with this latency?

\$\endgroup\$
1
\$\begingroup\$

I would suggest first reading this great article about networking. It explains fairly well the kind of lockstep issues that you are experiencing.

Here is a great series of articles explaining fast-paced networking. These are actually the same techniques that I employ in my own game engine.

Now I cannot suggest one solution over another for your exact implementation. It is up to you to decide which technique works for you.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.