iwiwis

Multiplayer with nodeJS server-side physics

Recommended Posts

Hello everybody,

I want to make a multiplayer game using pixiJS, and I need advice.

I'm trying to make it using pixiJS since it seems to be a good choice for simple 2D "top-down" view real-time games.
I've made a prototype without pixiJS, but using native JS and Canvas (with nodeJS and socket.io for the server and multiplayer part). I want to use a game framework to handle the rendering and collision parts.

From what I read, pixiJS can handle both parts, but I'd like it to handle the collisions in the server and only the graphics in the clients. This is where I get 2 problems :
1) PixiJS seems to need the browser window to run properly, and does not decorrelate its physics from its graphics, so the rendering would slow down the server.
2) I'm not sure how to make the clients do only graphics (not physics) without duplicating object-types for the clients.

 

I've found threads about "pixi-shim" that could help me handle the back-end problem, but most discussions ended 2 years ago, so I'm not sure it's still up-to-date ?

Most multiplayer tutorial simply make the physics run on every client, but that's not something I'd like to do (for "cheating players" reasons).

 

Thanks

Share this post


Link to post
Share on other sites

You can install Matter.js on server side using the command:  npm i matter-js

This article describes how to create authoritative server with client prediction: http://buildnewgames.com/real-time-multiplayer/

You should use physics on server and on client sides with the same update rate and synchronization with server on client side for correction of mistakes of client prediction.

Edited by 8Observer8

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.