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"

Character speed replication

I am creating a multiplayer game and am setting the max walk speed on the client through a custom event that replicates on there server. The issue is that in the clients animation blueprint, it still read the speed as if it was set to the lower max walk speed.

On the server, the speed and the animation works. On the client, the speed works but the animation doesn't

Image of my custom event setting the max walk speed:

alt text

I have managed to get around the issue by having a replicated Speed variable as a float in my character blueprint. It uses a custom event run on the server that updates the variable which I call in each tick (Image below).

alt text

From there, I just grab the variable from the character blueprint from my anim blueprint.

However, I just feel as if this is not the 'correct' way to do it. Am I doing anything wrong?

Product Version: UE 4.13
Tags:
more ▼

asked Feb 15 '17 at 02:53 PM in Blueprint Scripting

avatar image

WillB
1 1 2 5

avatar image WillB Feb 15 '17 at 03:11 PM

In fact, I think this is causing a jitter on the clients aim offsets.

avatar image Sean L ♦♦ STAFF Feb 15 '17 at 04:05 PM

Hey WillB,

I'm not sure that I understand exactly what it is you're trying to set up. What is the functionality that you're trying to achieve?

Could you provide a bit more detail in terms of what this would accomplish in your game? This would help give me a better idea of what we can do to see if we can get this working in another manner, or if the way you're currently doing it is best practice.

Thanks

avatar image WillB Feb 15 '17 at 04:21 PM

I am trying to create a function to allow the user to sprint. I can achieve this in single player by simply 'upping' the Max Walk Speed. However, it does not replicate on the server.

avatar image Sean L ♦♦ STAFF Feb 15 '17 at 04:25 PM

Are you working with the Third Person Character or are you using a custom character with a custom AnimBP? If you notice, the ThirdPersonAnimBP sets the speed just like you do in your SRV_SetSpeed event.

avatar image WillB Feb 15 '17 at 04:53 PM

Working with the default Third Person Character, yes I understand that it sets it in the anim bp but it doesn't replicate.

Edit: If I use the default way in the anim bp, it updates on the server but not the client.

avatar image Sean L ♦♦ STAFF Feb 15 '17 at 06:10 PM

Okay, great. So I have one more question for you just to make sure we're on the same page:

Are you trying to set the speed of both the Server and Client's characters, or are you just trying to set the Client character's speed? I just want to make sure I'm understanding your issue.

If you want to create a sprint function, you can try something similar to what we have pictured below:

alt text

This worked on my end and I was able to have both the Server and Client's characters sprint.

Let me know if that is what you're looking for, or else I can suggest something else.

2017-02-15.png (238.3 kB)
avatar image WillB Feb 15 '17 at 06:38 PM

I tried this, although the character seems to be moving faster, the anim bp doesn't get the faster speed so the animation doesn't get played. Which is why I added my work around previously. Thanks!

avatar image fl99coxo Aug 02 '18 at 01:43 PM

Thx bro, i used the workaround you added and it worked, its weird cuase im sure i didnt need to set the speed in char bp before and it worked, this time the clients didnt upodate the speed var on anim BP and anims didnt play, althou their physical velocity was updating! Maybe its a bug it should be reported!

avatar image fl99coxo Aug 02 '18 at 01:45 PM

By the way Sean, the problem is not on setting the char max walk speed, but yes on getting the velocity from the anim BP, it doenst work on clients!

avatar image ChiggenWingz Aug 05 '18 at 01:20 AM

I copied this exactly, and I get the jitters when trying to Sprint? Constant position corrections from the server. This is from a fresh Third Person Template also (as I'm trying to solve some networking issues of my own with sprinting.) Using 4.20.1

avatar image DistrictWare Dec 27 '18 at 06:06 AM

Same for me on 4.20.1, I can't seem to find a solution and its driving me nuts. When there is a change in speed it jitters and position correction from the server seems like. I am not even sure it is an issue with speed at all but an issue with movement replication, the client is not in perfect sync and the server corrects it causing a jerky feeling.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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