User avatar
Posts: 2
Joined: Wed Jan 23, 2013 3:08 pm
Location: Rochester, MN
Contact: Website

Networked physics (node.js,, Box2D)

Wed Jan 23, 2013 3:38 pm

Here's a simple networked physics engine demo you can take a look at (any recent browser should be ok; certainly works in Chrome, Safari & IE10): ... pberry-pi/

It's just Box2DWeb running in the browser, but uses websockets to send user interactions to the server (Raspberry Pi running node.js and, which then broadcasts them back to other clients. It can get out of sync easily, but kinda fun to open two browsers and attempt to retain control...

Once objects reach a standstill, their position gets sent back to the server. If you hit F5 / refresh, you'll get the latest state as the server (Pi) sees it.

I've no idea how many clients / connections it'll cope with (also, not sure how long I'll keep it running so try it asap).

Will add source code (there's very little of it) soon :D

Return to “Networking and servers”