Smooth Sync: Sync your Transforms Smoothly across the network

Hi @. It seems like your plugin can be really helpful for me, but i want to be sure whether it actually fits the issue.

I’m developing a racing game. Pawn is represented by a simple physical object (static mesh). Control is physic-driven. Throttle and steering are implemented by applying of impulse and torque to the mesh correspondingly. There is no something like “movement component” so it’s quite similar to UE Flying example. Actor and mesh component are replicated and “Replicate Physics to Autonomous proxy” is also enabled for mesh. This setup seemed quite straightforward, but when i’ve tested it on dedicated server the actual problem have appeared.

There are recordings of how it works on bothserver. Dedicated server is built from source without any custom options and hosted on my pc where i run clients.

Movement on listen server is ok, but on dedicated server it looks quantized a lot even for owning client himself due to the physics is server-side simulated. I’ve tried to tweak Net Update Frequency - decreasing gains quantized effect (as expected), increasing to 1000+ takes no visible effect (and it’s impossible and wrong to increase this very much).

Can this plugin help me in solving this issue?

PS. However, it feels suspicious that such “simple” physics cause problems (and works different depending on server type). Maybe there are some hidden options for server must be tweaked?

[USER=“3644634”]Jeremie Boga[/USER]
I’m going to say no just to be safe. I think the main reason your dedicated server looks bad is the low and highly variant fps you have happening.
Smooth Sync also wouldn’t work well unless you are only applying the forces to the owner (or server if no owner). Your collisions wouldn’t be good with Smooth Sync also unless you wanted to RPC over some AddForce() or something similar to the owner (or server if no owner).

Let me know if I didn’t answer anything or if you have any questions.

Why are the component transforms so inaccurate? I’m sending locations and rotations for a few components and compression is not enabled, yet the differences between clients and server are offset enough to notice.

@Trandana
This could be for a few reasons:

  1. Networking can’t be perfect. Play a game like Fortnite next to another instance of that game and you will see the differences are offset enough to notice. This is just because of the nature of how the internet is physically not instant.

  2. You aren’t syncing anything. Are you using SetSceneComponentToSync() to sync your components? If you want to sync not the root, you’ll need to use this. Removed ReplicatesMovement? Put on Smooth Sync? There’s not many steps but it can be confusing if people are new to Unreal.

  3. If the above doesn’t answer your question, about how far off would you say it is? If it’s easy for you, can you make a short video showing the issue? I typically use OBS and an unlisted youtube video for quick and dirty videos like this.

I’m having a problem with smoothsync working with clients, it works fine when I run in simulation, but when I try to connect and play in an actual build none of the clients can move around, which suggests to me that they dont have ownership in some way causing this, any advice?

I did the normal, disabled replaces movement, enabled replication on the smooth sync component, not sure what to do now.

@SteamPunkProgrammer
I don’t think you enable replication on the Smooth Sync component. Isn’t that on the parent or something? Check out the video on the Marketplace page for the few steps to make any of the templates work with Smooth Sync.

You can use SetOwner() to change owner too if you don’t think owner is set up. I’d make sure that your movement is only happening on the owner as well.

Let me know how it goes.

***DISCLAIMER: This is my own bug experience, and Smooth Sync is amazing. I can in no way guarantee this will help you

Not sure if this will help anybody, but after countless hours of testing…SmoothSync still works amazing as intended, but I have discovered a horrible bug that may be hard for people to find.

This bug is also ONLY relevant if you made a mistake and are trying to use SmoothSync incorrectly.

The bug scenario:
-Empty map with only 2 static meshes on it.
-Both are just static meshes with SmoothSync enabled.
(the real issue) - Both are set to “Static” (yes Static. It makes absolutely no sense to use Smooth Sync on a “Static” actor, but I did -_-)

SmoothSync seems to lower FPS consistently over time if a static mesh is set to static.
Even with only TWO static meshes, both set to Static with SmoothSync, I start at 500+ fps. After 30 seconds, 400 fps. maybe 2 or 3 minute later, 200fps. keep going. 90fps. Until it eventually reaches less than 1 fps. Undetectable by Stat.Scene Rendering. Everything checks out at 0ms for Server and Client.

In our full map, the bug happens much faster. It’s 500+fps to less than 1 fps in probably 30 seconds. It just drains FPS.
**The interesting part is that the FPS drop is ONLY for Clients. The server is always 100% fine. **

Anyways, I hope this helps someone out there. I made a bunch of levels for our game as we are about to go into Beta testing, and of course, I only tested as the server so the bug was invisible.
My dumbass set a bunch of actors to Static despite them having Smooth Sync on them…

After using this plugin for 2+ years now, I can assure you the plugin works amazing when you use it as it’s intended :slight_smile: Don’t be dumb like me and put it on actors set to Static!!!

Edit: Even on an empty map, our game has a lot of code in it. It’s quite possible it has nothing to do with Smooth Sync but I was running out of ideas and found my own fix, so decided to post this

I have objects which need to be picked up by one player and owned by them, and then dropped or passed to another player, transferring ownership. But when this occurs it always breaks things. I get offsets and weirdness everytime. Do you have a good flow for transferring a SmoothSynced object to a new player?

I have tried clearing the buffer both before and after setting the ownership. I have tried teleporting to the new location upon ownership change. I have tried disabling the SmoothSync and re-enabling it after ownership change. Nothing seems to work.

@Sebatnik
Thanks for the write up! I’ll look into it and see if I can stop that from happening anyway. :slight_smile:

@Trandana
After ownership change, calling SmoothSync.ClearBuffer() on the non-owners (or clients if no owner) is supposed to work.

About how long do the offsets and weirdness happen after ownership change?
Are you changing the owner on the server?
Using SetOwner()?

Maybe also search here and on the discordif you want a quicker resolution as this gets asked a decent amount and as far as I can remember, none of them had outstanding issues by the end of the conversations.

I’m trying to search the discord since I am trying to accomplish something similar but can’t seem to find a good keyword to search that comes up with anything related. Any chance you know of someone you’ve helped with this issue so I can search and find the solution in there so you don’t have to repeat a bunch of stuff?

@DOHayes
Try searching Owner, Authority, maybe Ownership if the searches don’t do partial words. Maybe try “ClearBuffer” as well as that’s what I tell people to call after ownership changes.

If I remember correctly, most of the time I just tell people to make sure they are actually changing the owner and to use GetOwner() to confirm owner has changed.

If somethings not working for you, let me know though and I’d be happy to try to help. :slight_smile: I just said the above earlier because I knew I wouldn’t be at my computer for some days.

Unreal 4.26 support is now live!

There is a problem that’s preventing me to package game on 4.26.

I get this same issue - I even tried setting it up on a fresh project with no luck.

EDIT:

I found within the source SmoothSync.h on line *472 *there is a UPROPERTY without a category defined.



**# SmoothSync.h:***472*

UPROPERTY(BlueprintReadOnly)


Adding a category parameter seems to resolve the compilation error.



**# SmoothSync.h:***472*

UPROPERTY(BlueprintReadOnly, Category = <CATEGORY NAME>)


Thank you man, you saved my day! :slight_smile:

@ I had mentioned awhile back a problem where there is a sudden jump when going from client owner -> server owner. I was never able to get this problem solved. I tried using ClearBuffer on all instances before and after SetOwner(nullptr), but it doesn’t seem to do much.

I’m beginning to wonder if it has to do with the way I’m simulating physics. Here is exactly what happens:

  1. Level starts. My Smooth Sync Actor is owned by the server. Physics for this actor only simulates on the server, not clients.
  2. Client grabs actor with a physics handle, which disables server physics, and enables physics for that client. The owner is set to that client
  3. So far everything works smoothly. Client can move around actor with no problems
  4. Client drops actor, releasing it from the physics handle. After 1 second of the actor having 0 velocity, the owner is set back to nullptr (Server) and physics is disabled on the client, and enabled on the server. I overrode SetOwner and called a function before and after Super::SetOwner(NewOwner) that clears Smooth Syncs buffer.
  5. The actor teleports to it’s last server position and then teleports back to where it should be.

I’ve tried many different things to get this working properly, but to no avail. Let me know if you have any ideas, or ways to debug this further. Thanks!

@Emrehan
[USER=“179073”]Syntax Alex[/USER]

This fix is now up on the Marketplace. Thanks for letting me know about it and for helping each other out. :slight_smile:

@GuacFrog
I’ll take a better look at this after the upcoming holidays but I wanted to tell you about something that was recently found with physics and Smooth Sync.

Look at the attached image where Smooth Sync’s tick group is set to PrePhysics. Maybe this is the issue and you want to set Smooth Syncs tick to this? It doesn’t seem like your issue but I figured I’d reply while I had time before I’m offline for the next some days.

Hey I have a very simple cube pawn with movement forward and backward using set actor location in tick based on input * speed. Anyway anytime i change direction from forward to back smoothsync stops syncing until i stop moving. This happens on both server and client (only tested in pie). Any idea what would cause this?

Using 4.25.4 and latest plugin.