x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Replicating SetActorLocation

How do I go about replicating this movement function? I need to use a timeline with setactorlocation for gameplay abilities in my project but it causes jitter on clients over netplay.

alt text

alt text

Product Version: UE 4.17
Tags:
lunaupcopter.gif (971.6 kB)
more ▼

asked May 23 '18 at 10:34 PM in Blueprint Scripting

avatar image

Prazon
15 14 10 14

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'm not sure. I struggle with getting smooth network movement when I use anything other than the built-in smoothing of the CharacterMovement component.

Something to keep in mind that might help though, is that when you set an Actor to Replicate Movement, then the server will force the clients to update to the server's version of the actor's location whenever it does another update to the clients. If both the clients and the server are telling the character to set its location, then even if they start the exact same movement at the exact same time, then you'll get this problem:

  1. Server and Client both start the exact same movement at exact same time.

  2. 100 ms later, Server and Client have both moved the exact same distance (say 25 Unreal Units of distance). Server sends location/movement update to Client saying "your location has moved 25 UU".

  3. Server moves 25 more UU. Client moves 25 more UU. They should both be at 50 UU traveled.

  4. Client receives update from server at 120 ms. The update says the pawn has moved 25 UU.

  5. Client obeys the server because movement is replicated, and resets the location to have only traveled 25 UU.

  6. Server sends another update saying "What are you doing? You're supposed to be at 75 UU from the start position by now!"

  7. Client receives the replication update. "Oh, sorry! Fixing it now."

Hence the jitter. Now it's not quite that bad because Velocity is also replicated, so any missed position updates are filled in by the velocity moving the character in between network updates (but will have to jitter-adjust if there was a change in direction, if there's no network smoothing).

Now, if you're using CharacterMovement component, then eveything I just mentioned gets smoothed over and hidden by the nice built-in smoothing algorithms. So then why is it still jittering?

I could be due to that timeline you have going there. Differences in framerate between the two machines, plus ping delays, are probably not smoothed by the charactermovement algorithms.

I'm not sure how to fix this as I've never succeeded in getting smooth movement on anything that's not built-in charactermovement, but it might be worth trying to tell it to stop replicating movement until the Timeline is finished, then turn movement replication back on with a lerp or something. IDK. If you figure it out, let me know!

more ▼

answered May 24 '18 at 05:30 PM

avatar image

mightyenigma
3.8k 18 20 20

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question