Physics on the server-side?

Hi.

I’ve been working on a simple real-time multiplayer prototype for some time now. I’ve reached the point where I’ve integrated the NAPE physics library on the client side… however, since you’re never to trust the user I need to emulate the physics on the server side to always verify what’s being processed.

The server is written in NodeJS… How would you approach this?

There’s a NPM module for Nape, would the implementation be the same on the server-side, like on the client side?

Hello Tej,
to get same deterministic result of physic-simmulation on different CPUs, there is need of fixed-point version. (https://en.wikipedia.org/wiki/Fixed-point_arithmetic)

Personally, to me, “never trust the user” does not extend to matters of physics.   Let the client-side code resolve the moment-by-moment game play as seen by that user, and report outcomes to the central game server.   Presume that the player has not hijacked your client-side code.

with “portal” feature of Nape (http://napephys.com/samples.html#swf-Portals),
every client-cpu could be render small part of game-logik (?:)=