Hello. Thanks to the partnership between Epic Games and Gamedev.tv , we accessed the Multiplayer Course for Unreal. We’ve been studying the KrazyKarts tutorial for at least two weeks, and we learned so much things, thanks for the tutoring!
Based on the teachings of KrazyKarts tutorial we created our own movement component. Actually what have we done has exact same setup with the tutorial, but only difference is we collapsed the movement component and movement replicator into one ActorComponent, and instead of car moving we implemented our own flying and walking setups. It was working very well fine and we were amazed with the results, acking, smoothing, prediction everything was working as intended!
But later when we tested the component on client, we saw whenever we get an update from server, instead of moving, server was resetting our location and teleporting us to where we spawned first. After some debugging and printing strings, we realized GetOwner()->GetActorTransform() is not being updated with the client input. For example, we start at 0,0,0 - and we move forward to 10,0,0 , and in a non-replicated function we call GetOwner()->GetActorTransform() and it is correct, but when inside of the UpdateServerState(), it is still 0,0,0 - and after the server update with OnRep, server teleports us to 0,0,0.
AnyFunction()
{
GetOwner()->GetActorTransform().GetLocation(); // returns the location where I am
}
Server_Function()
{
GetOwner()->GetActorTransform().GetLocation(); // returns where I spawned first
}
In summary, client is able to update its transform locally, but not able to tell this to server, since we are using GetOwner()->GetActorTransform() and its not reading our local value, server thinks we didnt moved and teleports us back to previous location. And since exact setup works very well fine with the KrazyKarts repo, I think we are missing something in our code? Can you guys share your ideas about this situation? What could be wrong and where should be look at to find the problem?
Thanks for reading