Multiplayer Player Physical Interactions?

I am developing a game using physics-based character controllers. In short, if the players interact with each other with hitboxes, each player would act as an immovable wall (as they would be casting their positions to all the other players in the form of a static body), and without would just make players float through each other. is there a way to make players interact with each other without making each client render everyone else’s physics?

Example:
We have players 1 & 2
Both players only render physics for their own bodies and render everyone else as meshes that are teleported to each frame to simulate movement.
Player 1 casts position to Player 2
Player 2 catches it and teleports their visualization of what Player 1 looks like to the new position
But since they both cast positions, they are both rigid to one another, and cannot move each other

An idea to fix this is for everyone to render everyone else’s physics, then the server averages everything and updates it for everyone else, but I know this is extremely taxing…

Hi @SkooterBahgs,

So what you are looking for is players to be able to push each other and that to be networked to everybody else? Or just a simple moving collider that a player can stop/collide with but can’t push around?

For the latter if you keep all players as dynamic rigid bodies, and you use teleport for positioning the remote players I think it will automatically happen.

@Leonidas, I hope to have players be able to move each other around and collide normally.
Here is my project:
https://playcanvas.com/editor/scene/1113377
WSAD and SPACE to maneuver.
As you will soon see, fun physics-based characters would be fun to mess around with, and that fun experience just wouldn’t be complete if the players cannot interact with each other.
Although I did not set up the multiplayer yet, it is just a concern that I foresee in the future.

Then I don’t see any other way than running a centralized instance of physics on the server. It will have the final say on where everybody should be and can resolve any conflicts that occur due to latency.

You could try and keep this client side, but quickly can turn into a sync nightmare trying to see who has authority over the sequence of each action.

@Leonidas, good point!
I will leave the conversation here for now until I figure something out.
Thank you for your time.

1 Like

I was facing a similar issue though it considers the physics of dynamic rigidbody entities/objects in the scene instead of players. I haven’t solved it quite yet but things are getting warmer thanks to an approach I dug up in the forums last night.

I’m using an approach found here which utilize’s an entity’s unique Guid value. I find the entities I want by setting a tag on them and loop over all items with such tag. With that you should be able to send the name of the entity and it’s position or any other state you want to the network.

this.entity._guid;

Like @leondias stated, physics stuff should remain on the client, though utilizing the tutorial realtime multiplayer example this physical player interaction happens naturally yet has room for personal tinkering.

Hope this helps in some way!

2 Likes