0
\$\begingroup\$

I'm making a 2d multiplayer html5 game that needs client-side movement, collision etc.

Client sends active cursors to the server (w,a,s,d), server updates cursors on all clients and clients handles movement for each other. Every client sends server it's x,y every 100ms and server updates sender's x,y on all clients.

It works perfectly if player's latency is <1ms but even if player has 40ms latency everything seems like teleporting.

How can i make everything smooth without handling movement on the server? (like transformice.com do)

Sorry for my grammar.

\$\endgroup\$
  • \$\begingroup\$ You may want to start here: gafferongames.com and specifically at the networking sections. Even if you're doing a simple concept at least you'll know the networking territory that you're working in. \$\endgroup\$ – Patrick Hughes May 26 '17 at 16:18
0
\$\begingroup\$

The general answer is to do movement on the client but correct it when you get server updates. So like move the player to where the server says he is (probably interpolate rather than jump to that position.)

\$\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.