HTML5 - Synchronized realtime multiplayer networked physics

Hi this is a demo of an opensource Node.js / Javascript framework I created called RealtimeMultiplayerNodeJS

RealtimeMultiplayerNodeJS is a framework specifically for building HTML5 multiplayer games with the Client / Server model. In this model, connected users send only input and the game itself runs on the server.
Clients are interpolate between two known world snapshots based on the current synchronized time.

This allows for networked physics games using the javascript port of box2d

Not sure how to embed the video on phpBB:
http://vimeo.com/24149718

Image



Here's the repository which contains this demo and a few others:
https://github.com/onedayitwillmake/Rea ... ayerNodeJs
Looks really good. How does it perform across the internet though?

In what kind of format is the snapshot given to the clients, and how regularly? eg. a list of body ids, with their current pos,vel,angpos,angvel, every 0.5 seconds... or something? This would mean each player doesn't see the result of their action for at least 0.5 seconds I believe. How about when adding/deleting bodies, some kind of add/delete instruction? Just guessing 😀
It performs well over the internet.

Clients are sent snapshots at discrete intervals about 20-30 times per second (it's a variable).
The information that is sent is only:

entity_id:
position:
rotation:
---

Each client stores these worldDescriptions in an array, and the key element in the puzzle is that all clients render back 100ms in time from their current time. They loop the worldDescriptions find the two that the renderTime falls between and interpolate between the two. I borrowed the idea from reading about quakeWorld and HalfLife's Souce Engine white papers.

Instead of using the last known position and instantaneous velocity to try to extrapolate where the objects will be, and being constantly wrong. We just simply side step these problems altogether by rendering everything 100ms back in time, and always interpolate between 2 known worldDescriptions

Here's a screenshot of a presentation I gave where I discuss that in more detail:
Image

It's not really an original idea, it's just a Node.js / javascript / websocket implementation of a concept that's been around for a while.

Original thread: https://box2d.org/forum/viewtopic.php?t=7024