I’ve searched a lot and no solutions has helped me. When I create a BP of any static mesh and let it be affected by physics, once interacted by any client it goes out of sync. The client who pushed the object can see it pushed much further than other clients. How do I fix that using BPs?
You need to replicate the position of the mesh to all clients.
If you know about replication already this’ll be easy… Lemme know if you need more info
It’s my first take on the networking in Game Dev so I’m probably missing something. I thought that checking “Replicate” and some of the related checboxes in the blueprint of the affected object. Could you help me further?
Well, first let me say that you should check out the networking videos made by UE4, and start messing around. MP physics is easy, but only once you really understand networking, imo.
The issue you’re having is that physics is being calculated only on the client who pushed the object… For them to be all in sync, you need to send the new position data to all clients.
Here’s a BP I made real quick to show you. It’s just right click to add impulse, and everything is ran on the server. There could be many improvements you could make yourself… This is bare bones. And of course once you understand how this works you could make your own way of doing it:
And here’s a video showing it in action:
Thanks, I’ve watched all but last networking videos already and I thought that built in replication would take care of physics as well. Then I tried to do something like your BP but it didn’t work. Great thanks for your example and time!
I also assumed there was some way the engine would handle physics… But I couldn’t find a way, so the solution for me was to just update the positions to all clients.
What didn’t work exactly when you tried it?
That’s a difficult question to answer, I set it up according to my logic, and I just didn’t get any results, it didn’t update. I don’t even have the blueprint already.
Could you tell me what should call your AddImpulse event so that it receives Impulse variable?
And also what could call UpdateObject?
Add impulse is setup like this:
Right click → get physics component of actor I am facing (in this case sword) → add impulse
Both CamHit & UpdateObject are fired by Event Tick
I see now, I wish I could come up with such a solutions myself, I’ll try to do it my way basing on your concept.
Hey, Does anyone have a tutorial for doing this? I know that the replication topic after understanding could be really easy, but I just can’t do the Physics handle replication :C. Please if you can help me!!