Smooth Sync: Sync your Transforms Smoothly across the network

Hello,

I’m having a bit of an issue in my project with this plug in. It seems that all but one client on the test dedicated server will not stop moving even after letting go of movement controls. Almost like the character is sliding on ice. The original first client does not have this issue for some reason? any ideas?

@Creampuff6
Is your setup a server position determined player and you are sending commands over to the server to say “walk forward” and “stop walking”? In this scenario if you say “stop walking” you have to wait for your command to get to the server and for the player to stop, then for the player stopping information to get back to you.

Does it also seem like it takes an amount of time to start moving?

Hello,

We are having issues using smooth sync since our update from UE 4.23 to 4.25.

Running with 4 players with a dedicated server on the editor and the average network emulation we had this problem on the start

2020-06-08 11_35_34-.png

2020-06-08 11_37_55-.png

and also here

2020-06-08 11_42_20-.png

2020-06-08 11_43_00-.png

I removed the packet loss emulation and it this seems to not happen anymore.

We also had other crashes SmoothSyncTeleportServerToClients_Implementation because realObjectToSync is null and then it crashed on getPosition.

@Lawendt
Thank you for bringing this to my attention and for the detailed post. For now you can probably throw some null checks in there and be good to go until I get a better solution out.

If you need help with some quick null checks, let me know and I can whip up something.

Thanks again.

This crash occurs when calling SetOwner on the item with SmoothSync.
Dedicated server with 2 players.

The image of the log is attached.

@ Any ideas on solving this bug?

@GuacFrog
Maybe changing line 1896 of SmoothSync.cpp into:
if (insertPos + 1 < stateCount)
{
state->movementMode = stateBuffer[insertPos + 1]->movementMode;
}
might solve it.

Sorry but my day job has been crushing me lately and I don’t really have time to try to reproduce the issue and get a good fix right now.

Let me know how that goes though. My free time should start opening up next weekend for me to take a true deep look. Feel free to ask questions here though and I should have time to answer.

Will this work to rep all bodies in a ragdoll?

@Nonlin
I’m not sure what “bodies in a ragdoll” are, but it’ll sync anything with a Transform you can see in the details tab.
The way I assume a ragdoll would work is you’d only want to sync the Actor Transform and then the limbs and stuff would flop around. You wouldn’t want to sync each joint anyway.

I do want to sync each joint lol, sounds like it can’t bummer.

@ I presume that I need to build from source in order to modify those lines of code?

@GuacFrog
I heard that was one way. I also heard you could delete the intermediate and binary files from the plugin itself, but that never worked for me.

The way I edit engine plugins is I bring them into my project.
I do this:

  1. Create a SmoothSync c++ file in your project.
  2. Create a State c++ file in your project.
  3. Copy over the SmoothSync.h SmoothSync.cpp State.h State.cpp from the Private and Public folders at Engine\Plugins\Marketplace\SmoothSync\Source\SmoothSyncPlugin
    into wherever it made them in your project folder
  4. Then change SMOOTHSYNCPLUGIN_API in the .h files to YOURPROJECTNAMEINALLCAPS_API

Then you will have the plugin as part of your project and you can edit and compile to your heart’s content.

Hi :slight_smile:
I try to create a setup where the server handles the movement.
So when i right click, the client sends a request to the server, and the server uses a “Simple AI move to” to the designated location.
In the default UE setup this works, and replicates correctly, with jittering at the client.
When i add the smoothsync component, the client doesn’t move neither in client or sever window.
What am i doing wrong?

When switching FROM client owner TO server owner of an actor with smooth sync (SetOwner(nullptr)), there is a sudden ‘jump’.

The smooth sync actor jumps FROM the location that the CLIENT left it, over to the location where the actor was LAST owned by the SERVER, and then back to the location where the client left it.

This jump is very unpleasant. I realize that it may be a hard issue to solve. However, in my case, the actor will ONLY switch from client to server owned if the actor is NOT moving. Because of this, there should be some way to solve this problem.

Any ideas?

@Fjordhoj
Smooth Sync uses ownership to determine who is the authority of the position. It sounds like your client owns your actor. Set the server as the owner or have no owner to have the server determine the position. Then if you move it on the server, that position will be sent out to all clients.
Let me know how it goes or if you think I misunderstood.

@GuacFrog
Call SmoothSync.ClearBuffer() on all instances of the actor after you change owners.
Or in your case, maybe call it before if you didn’t call it afterward on the previous ownership change because it seems to have an old position in the buffer from when the server was previously the owner.

Let me know how it goes or if you think I misunderstood.

@ Is there an easty way to do this? I imagine using the “Set Owner” node, but which actor do i plug in?

@Fjordhoj
Yes, SetOwner is what you want. You’ll most likely want to pass in the most parent actor of the actor you are trying to sync across the network.

Tried several ways. Different ways of spawning, assigning controllers, various assingment of moving (Server, multicast)
Nothing seems to work when using AI movement, and can’t get the client to do anything.
When i enable movement replication on the BP, and remove SmoothSync, the client moves as desired again, but with lagging.

Udklip.PNG
https://forums.unrealengine.com/core/image/gif;base64

This is the movement on the character called from the controller.

@Fjordhoj
I would confirm that the owner is set with GetOwner(). My best guess is that maybe you set the owner of an Actor but you are trying to move your Controller instead. Let me know how it goes.

If there’s an Unreal Template that does what you are trying to do, let me know and I can take a look at that and see if Smooth Sync has any unexpected issues. But I think the above is probably your issue.

Let me know how it goes.