Hi there, I seem to be having a bit of a problem with simulate physics across a network. What I would like to achieve is to have levels like building made completely of static meshes that are simulating physics so that they can be destroyed. This is not working out how I would like it to because there seems to be some kind of syncing issues with simulate physics and player location. On the client the simulation is completely different and the structure will collapse causing the player to die on their screen only whereas for others the player will still be alive and the structure will be intact. There is also a problem with walking on the simulated physics actors where the player will randomly get launched into the sky. Please could someone give me a workaround or other approach I should take? Would really appreciate it. Thanks
Heres an example of what I would like to achieve except replicated in multiplayer and supports players walking on it.
AFAIK ,physics simulation is not replicated on its own , only the position of actors and its components are replicated by default. while physics engines run on both server and client independently so its hard to sync them and have predictable behaviour on both machines.
Even if you sync them both it might be impossibly difficult to take care of what happens in that time until things are brought in sync again.
Apart from that I ** think ** physX works according to specs of your machine so it will always behave a bit differently. If its not something specialised like a Vehicle then rigid body physics are mostly for cosmetic purposes.
Do you have a suggestion at how I could tackle this to get the outcome I wanted? Would I have to code my own gravity and physics into the engine or do you think there is some other way of getting it to work? Thanks for the fast reply by the way
The explosion could expose hidden static meshes or ruins for players to walk on etc…
If the explosion has fire / smoke it can mask you moving meshes into final resting places.
That way they can be sync’d on client / server for players to walk over / collide with after.
But the chunks won’t ever be in sync otherwise, this is down to 101 networking latency.
On a LAN game you may not notice, but creating a net game in MP real-time is an art form.
You can test if the player is based, if so stop simulating physics on the underlying mesh too.
I just managed to get multiplayer simulation to sync properly by making the building blocks into replicated blueprints that have replicated movement. However the problem still comes where I can’t manage to get the simulated item to not flip about or fly up into the sky when the player walks on it. This has always been a problem I had with simulate physics in UE4 even in single player. I think the problem lies with the players mass being enough to flip the simulated item so setting it to 0 might work. Any ideas on how to get the simulated items not to fly up into the air? Also thanks for the advice franktech
Do a looped check / trace to see if the player is ‘based’ on a mesh…
If so disable simulation on that mesh momentarily then re-enable it.
What happens, does the mesh fall away or still push the player around?
Rigid bodies generally oppose each other. So that’s what’s happening I suspect…
It can even happen when picking up physics objects with a physics gun sometimes etc.
Think about adding a velocity to the player to counter the effect, maybe its an option…
Or if you can detect the event, try momentarily disabling physics for the player pawn…
Actually you need to make the object heavy in order for it to react according to newtonian physics. apart from that I think this happens due to depenetration velocity being set too high you can change that in physics settings of box component too.
I recorded what’s happening, I have tried editing the depenetration velocity which didn’t change anything and neither did editing the mass, Not really sure how to get this working except doing the hacky workaround with disabling the physics. Wouldn’t it be quite expensive resources wise to have a forloop running on all of the blocks in a level?
The loop check was a suggestion for pawn / player-controller only, checking if the Pawn is ‘based’ on a mesh etc.
Disabling physics is hacky, its just a working suggestion to get to you to prototype stage to show off the gameplay.
Remember anything built here will need to be rewritten by a pro programmer anyway (Rama etc) to work in Multiplayer.
Observations: the Mass setting is not working and the UE4 equivalent of Limit-Max-Physics-Velocity is also dead, WTF?
Recap the overall goal: Once blocks have come to rest ‘on the ground’ are they meant to fly off like feathers in high wind?