Multiplayer movement using Dynamic Rigidbodies (Photon)

I’m working on a multiplayer project that uses very basic movement (only strafing, no jumping). I come from the Unity side of things, where usually it’s not a good idea to have a dynamic Rigidbody (RB) to handle movement, especially for multiplayer (jittery, lag when following objects with a camera, etc.).

In PlayCanvas, it seems like dynamic RBs are a viable, recommended solution to handle player movement and collisions, so I was wondering if going for dynamic RBs on a multiplayer server would be good? More specs are below:

The project will use Photon with 40-60 concurrent players, and collisions will only be handled between individual clients and walls (no player-player collision). I’d much rather let PlayCanvas handle all collisions than build a bespoke Kinematic solution.

If anyone has already come up with a kinematic movement + basic collision system for PlayCanvas though, that’d be good too. I just don’t want to reinvent the wheel.

I cannot really offer a huge amount of experience yet with multiplayer. I am working with Photon but really just experimenting with a game that I am working on. What I can offer is what I have experienced so far with Playcanvas. In my single player FPS games I usually spawn a few bots/characters using a path following algorithm I discovered. So basically something to hit with an object or some type of animated object. I usually grab something from Mixamo with animations. In order for everything to work hand in hand together I create a slender pill shape collision object and add a rigid body. From within the rigid body settings I select kinematic. What I found is that you need to do this so the collision and rigid body follow along with the entity. When I raycast to these objects and fire a shot they basically execute a fall animation. So far I have had maybe three of these bots romping around my scene and not seen any frame rate drop. Maybe if I did a procedural creation of bots spawning 40 I would see this.

So my gut feeling is that you should not really have any issues in your case since your players will only be colliding with walls. I think that all of the collision and rigid body will be handled in the players local web instance and should not affect game play or show jitter.

Your latency… I think, will really come from the handling of the player movements from a large amount of players like 40-60. For each player your handler not only has to keep track of your local player but the up to 60 other broadcasts of position from each of the others. That’s a lot of transactions and movements.


Hey @timrodz, I don’t have rich experience with Multiplayer but I did integrate 5 characters in a visualization using socket IO. Firstly I was trying to work with rigid bodies for all the characters within one instance but that caused a bit of lag on android devices.

Then i changed it to have a single rigid body in each instance which will be for the player itself and all other players would take the movement data from their respective instances and will simply update them in each instance. This helped me in performance improvement so I think you can try a similar model.

The other issue you would face with 40-60 players within a single instance is the bottleneck issue at the server side where there would be more messages to send/receive for the server at a given time which would put many messages in the queue and result in lag/ desynchronization. So you would also have to take care of the messages sent across the server should be manageable by the server at a given time. To solve it, I was sending the movement messages after 50ms and was syncing it using lerp on the other side but it may vary in your case.
Best of luck!