Smooth Sync: Sync your Transforms Smoothly across the network

Hello I have a problem with your plugin in terms of collisions between two players, when I activate smooth sync there is almost no collision between the players, (I use the physics integrated into the game)
on the other hand when I remove smooth sync and I put the replication of movements integrated into unreal engine I have no problem with collisions and the collisions are realistic, with you a solution so that I can use your plugin while keeping realistic collisions ? (I did my test locally with no emulated ping)
You can try to reproduce what I describe with the project which presents the smooth sync plugin (youtube video of how to activate smooth sync) and which explains how to activate it, this does exactly the same thing

thank you for your answer

I am facing unexpected crashes while playing as a client in a large map area while driving a car. The crash occurs only in packaged builds and not in the editor.

The map is using world partitioning and the crash occurs when a big building is loaded automatically from the world partioning mechanism.

In particular we are getting the following call stack on a crash (does not happen in editor):

The vehicles are set to IsSpatiallyLoaded = false, so they are loaded all the time in the level and not unloaded.

The setting used in the vehicles from the plugin are the following:

Any help would be greatly appreciated.

@Serfio1
In order to have good collisions between objects, you will need each object owned by the same system, typically this is the server.
A lot of the times with using Unreal’s Replicates Movement, the collisions are great because it’s not really syncing the position and the position becomes off after a collision.

You can try lowering Smooth Sync’s InterpolationBackTime and raising the Lerp Speeds, which may be better, but the main issue will still persist. Another option may be to send over AddForce() RPCs on collisions but is dependent on game type.

@Panmigo
Hey, I think you are maybe the same person from discord that solved a very similar problem.

If not, try putting
stateCount = 0;
inside of USmoothSync::CleanUp().

Unfortunately Unreal makes editing plugins difficult so look at this post on how to make the plugin part of the project until we get a fix out for this:

Let me know if that doesn’t fix your issue and I’ll have to try digging harder. Thank you for letting us know about this issue.

I’m not totally sure I understand your setup. Can you show me some screen shots of the hierarchy or any relevant blueprints.

If I’m understanding correctly, you’re syncing three different things: the helicopter, the attachment point, and the container itself. Make sure you’ve got a Smooth Sync component for each of those, and that Replicate Movement is off for all of them.

The attachment / detachment needs to happen everywhere, so it should be multicast.

You probably also want to enable the “Sync Ownership Change” option as the owner is likely changing from the server to the player when attached and back when detached.

Did you fix it and if so how?

Hiya-- Im sorry if this has been answered already, but Unreal’s forums are difficult to navigate on super long individual threads…

Love the plugin but running into an issue for my use-case.

I’m trying to get the current speed/velocity of client pawns on the server, but it looks like it just returns 0 for simulated proxies when I get it from the pawns movement component…

I tried getting the velocity from the last smoothstate sent through the smoothsync component, but it was returning a value that didn’t actually represent the pawns current movement speed…

Maybe I’m approaching this incorrectly, any help appreciated!

Hi, I’m having trouble setting this up with a physics based movement pawn I’m working on.

As soon as I apply the SmoothSync component to the pawn, the pawn just jitters at the start location (moves slightly in the forward direction then hard resets back to start; rinse, repeat). The pawn is a simple elongated cube meant to represent a glider or plane wings. At the start, the only force being applied to the cube is a displacement force in the glider’s forward direction.

I’m using blueprints in UE 5.1. I have replicates ticked on for both the pawn itself and the cube. I have replicate movement ticked off on the pawn. I’ve tried setting the cube as the default scene root component (just add the SmoothSync component) and setting the cube as a child of the root (using SetSceneComponentToSync() in BeginPlay to target the cube).

Any ideas what I’m doing wrong?

@King_Odysseus

FVector3f USmoothSync::getLinearVelocity()
{
	if (isSimulatingPhysics && primitiveComponent != nullptr)
	{
		return (FVector3f)primitiveComponent->GetPhysicsLinearVelocity();
	}
	else if (movementComponent != nullptr)
	{
		return (FVector3f)movementComponent->Velocity;
	}
	else if (characterMovementComponent != nullptr)
	{
		return (FVector3f)characterMovementComponent->Velocity;
	}
	else
	{
		return FVector3f::ZeroVector;
	}
}

In SmoothSync.cpp Is the logic for how we determine what Velocities to currently send over the network. Then we set them in setLinearVelocity() in the same file.
You may be able to edit this section to sync the specific velocities you are looking for if this isn’t working as expected.
Unfortunately editing engine plugins in Unreal is way more difficult than it needs to be (or at least was in UE4). I typically bring the engine plugin files into my project and make it a project plugin.
If you notice anything wrong with the Velocities Smooth Sync is getting and setting, let me know and I can maybe incorporate it into the next release.

@xuKyosuke
The most likely cause for jitter is that you are trying to set the position on all networked systems when you should only be setting the position on owners, or the server if there is no owner. Smooth Sync will handle all position changing on non-owners (or clients if there is no owner).
Smooth Sync will work with each of the templates provided by Unreal Engine as well. So it may be beneficial to see how those work and then maybe you can see what the difference between your project and the templates provided by Unreal are.

Thanks for the response. Unfortunately, I already tried using SmoothSync with a clean project using the 3rd person blueprint template. SmoothSync seemed to work fine with the default kinematic 3rd person player (using the default character movement component), but I simply cannot get it to work with a physics based pawn. Yes, I’ve tried new stripped down physics based pawns in this new project.

I’m trying to use SmoothSync with physics based pawns and a simple server authoritative setup. The local player simply sends their input to the server and the server uses the input to apply forces. This setup works fine without SmoothSync (minus the obvious hard resets at average or worse pings). Despite my best efforts, however every permutation or adjustment I have tried with SmoothSync results in the pawn locking up or jittering.

Here’s a simple setup I tried (with blueprints if that matters):
I created a basic pawn. I added a cube and set it to the root. I added a camera to the cube. I turned replicate movement off on the pawn. I turned replicates on for both the actor and the cube. I added a move forward boolean variable in the pawn.

I created a player controller. The player controller sets the pawn’s move forward boolean if the W key is pressed. I added a run on server RPC in the pawn to pass the state of the move forward boolean to the server. The RPC uses that state to set the move forward boolean on the server.

In the pawn’s tick, if the pawn is running on the local player, it simply calls the RPC and passes the state of the move forward boolean. If the pawn is running on the server and the move forward boolean is true, it adds a force in the x-direction.

I believe this is as simple as I can make this setup and the methodology works without SmoothSync. With SmoothSync, the pawn locks up or jitters. I have watched the flow in the editor, so I know the blueprint logic is still executing as expected. I can see the server adding the force when I press W and stopping when I release W.

I have tried adding SmoothSync directly to the actor in the editor (exists on all instances of the pawn). I have tried adding SmoothSync only to the server’s instance through BeginPlay. I have tried turning simulate physics on for all instances. I have tried turning simulate physics on for just the server (also in BeginPlay). I have tried making the cube the root object. I have tried making the cube a child of the root and using SetSceneComponentToSync() to target the child cube (in BeginPlay).

I’m at a complete loss on how to make SmoothSync work with physics based pawns. Please advise.

I forgot to mention, I also tried this cube pawn without the player controller or inputs (the cube pawn just adds a force in event tick). If I spawn as the cube pawn, then the result is the same (the pawn just jitters in place). Meanwhile, if I drop this cube pawn into the scene/map (I’m not controlling it in any way), then it does move (even with the SmoothSync component attached).

@xuKyosuke
It sounds like you are moving the player controlled pawn on the server. It looks like it should only be moved on the client in your case.
Does your scenario work when you move the pawn only on the owning client?
Let me know if I seem to be misunderstanding and I can try re-reading. Cheers.

Thanks for the response. Actually, in my case, I do want to move the pawn on the server (true server authoritative). I have considerable reason to believe this won’t work in the long run, but that’s what I’m trying for at this time.

I experiment with client authoritative, however. I created a separate pawn blueprint to keep the server authoritative and client authoritative setups in completely separate blueprints.

As with the server authoritative blueprint, I simply apply a force in the x-direction (just on the owning client rather than the server). In this case, the pawn does move, but it produces this horrible jerky, teleporting behavior. The pawn jumps forward a bit, jitters in place for 3-5 seconds, then jumps forward a bit, rinse, repeat. I’m not using network emulation, btw.

Additionally, I tried removing physics altogether and just moving the pawn by incrementing the pawn’s world location in the x-direction every tick. Same jerky, jittery, teleporting behavior as with physics.

As with the server authoritative blueprint, I tried both of these approaches with the client authoritative blueprint as just regular scene objects (objects I just dragged and dropped into the scene/map rather than having them spawned in at runtime). Just like with the server authoritative setup, both of these approaches work well in this scenario. The pawns move smoothly with no issues.

It really seems like the issue has to do with the spawning and/or player control/ownership of the pawn. If it spawns, it’s screwed. If it’s part of the scene/map, it’s fine.

@xuKyosuke
Are you saying that when you move your spawned objects on either the client or the server that it is jerky on all other networked systems?

When using Smooth Sync, if you want to move the object on the server and have that position propagate out to clients you will need to set the owner to the server or have no owner. SetOwner() is one Unreal method that can accomplish this.

@xuKyosuke
I just read your discord message, it looks like it’s happening when you move it on either the client or the server.

I will have to test out your scenario using your example then. Thank you for providing it and sorry about the issue. It’ll probably be a couple weeks until I get the time to check it out though unfortunately. (also I’m always happy to offer a refund for any reason at all if it’s not meeting expectations)

I’m not even sure where the issue may exist or I’d give you some tips for where I’d start looking if you wanted to potentially make a workaround.
The number one cause of jitter is the object being moved on multiple networked systems at once when it should only be moved on one of the networked systems.
Beyond that, the following bug will make objects jittery:
“I believe this is the issue with the ThirdPersonTemplate controller for Unreal where Unreal is still syncing the character even when ReplicatesMovement is unchecked when standing on a networked moveable object.
If you take off Smooth Sync entirely, you will see that your ThirdPerson character is still syncing. If you can find a way to turn off this automatic syncing with Unreal for the ThirdPersonTemplate controller, then I would expect it to work because then both Unreal and Smooth Sync won’t be trying to set the position of the object at the same time.”

Thanks for the reply. Sorry, I forgot to mention in the server authoritative blueprint, I do use SetOwner() on the server in BeginPlay. Not sure if there’s a more appropriate time/event/place to do it. That’s just what I’ve been doing.

Thanks for agreeing to look into it. I’m still hoping there’s a simple fix, like a massive oversight on my part. Should I ZIP up the project and send you the link or were you planning to test with a new project on your end?

Thanks for the refund offer. Unless you think it’s better to issue a refund now, I’m fine with waiting a couple weeks to see if you come up with a solution and accepting a refund at that time if you can’t. I do still want your plugin, provided I can get it to work for my use case, of course.

It’s been a few weeks now. Just want to check back in to see where we’re at on this issue.

@xuKyosuke
Sorry about the wait. Unfortunately I could not come up with a solution, but I used the Rolling Template provided by Unreal because I’m not too familiar with starting from scratch and couldn’t follow your scenario too well.
For a refund, send me your email address associated with your account and any invoice number from the purchase receipt and I’ll send them over to Unreal for a refund. Our email can be found here: https://www.unrealengine.com/marketplace/en-US/profile/Noble+Whale+Studios?count=20&sortBy=effectiveDate&sortDir=DESC&start=0

If you want to potentially get it to work though, read on.

You say you can’t get it to work with a physics based pawn that spawns?
Smooth Sync works in the Rolling Template provided by Unreal which I believe is the scenario you describe. I started with that template and followed our video guide (Smooth Sync for Unreal Overview - YouTube) to get it set up. Then I deleted the PhysicsBall in the WorldOutliner to confirm it’s being spawned and set up a blueprint on it to automatically move the server owned ball only on the server. I didn’t see any jitter.
If this is the scenario, take a look at the Rolling Template and see what the difference between your setup and this may be.

Hey all, a question.

I have an owner-auth ball, and am having issues when colliding with physics objects.

Everything works fine for the owner, of course, but for non-owners the ball often will simply phase through obstacles. I don’t think hit events are triggered either. Please see the video below: left is a client, right is the server.

My question is, is this expected behavior, or am I doing something wrong? If it is expected, are there any workarounds?