There’s a lot of nastiness when designing client-server networking for games. Consider how you would solve a few problems: How do you update player positions? How do you compensate for lag? How do you prevent players from appearing to teleport? How do you prevent cheating?

Luckily, benevolent programmers have documented a lot of this information (1, 2, 3), and careful research can answer these questions. Unfortunately, that still leaves the task of coding up the solution, and there never seems to be a game development library that suits your needs. If your game is JavaScript, however, you might be in luck.

motion.js “provides a platform for realtime synchronization between multiple clients and authoritative server(s)”, according to its GitHub page. It is still alpha-quality software — the author mentions that it “is very much a work in progress” — but it appears to be an attempt at handling hard networking problems for you, such as updates, latency compensation, input prediction, delta compression and more.

There’s not much to the project right now, unfortunately, and the project hasn’t been updated since late May. At the very least it’s worth noting that this sort of functionality can be bundled into an open-source JavaScript library and that someone, somewhere, expressed a need for it.

motion.js is licensed under a BSD-style license.

See: motion.js on GitHub“What every programmer needs to know about game networking”.

Article image derived from

Tagged with:
About The Author


Ian Langworth has been making web sites since before HTML had tables and Photoshop had layers. He wanted a single place to go for news and information related specifically to HTML5 and game development, but one didn't exist, so he started the HTML5 Grind.

  • Poetro

    I dont really see any usable code on GitHub. There is no networking, no anything. Not any usable examples on how you would use this code.

    • PubNub

      So you would use Socket.IO for hobbyist Networking Layer or PubNub for a serious business.