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"

Proper way to apply a constant movement to characters/objects in Multiplayer

Hello, I need the help of you guys to know how should I make (in Multiplayer) all player characters AND objects to be constantly pushed into a direction.(Somewhat like a Treadmill)

Currently, I have a 0.005 Loop Timer that AddActorWorldOffset inside each actor blueprint that I want this movement(players and objects) and that works fine, in Single Player. alt text However, I'm afraid this method is not the right way to do it in Multiplayer, as with multiple objects doing this constantly might be too expensive on the network.

Please, I need help to do it the right way.

Thank you already!

Product Version: UE 4.21
ue4.jpg (140.5 kB)
more ▼

asked Jan 31 '19 at 01:15 AM in Blueprint Scripting

avatar image

10 2 3 6

avatar image aNorthStar Jan 31 '19 at 03:14 AM

I seem to recall there is a physics or force volume that you might use... there is a Zak Parrish video tutorial doing a conveyor belt I think

avatar image HenriOsbourne Feb 07 '19 at 12:21 AM

This https://www.youtube.com/watch?v=aqRUe7pm4Ok ? This is exactly what I'm doing already, he uses 'Add World Offset' just like I do, and as such, the movement is not replicated smoothly in a network enviroment.

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

2 answers: sort voted first

If you don't need to sync all objects' movement (i.e., they are just there for aesthetics) then don't replicate them and just simulate their physics locally. However if they are important and should be synced across all players, then try to minimize their number as possible. There's is no easy way to answer how many objects can you replicate, you just have to test them yourself.

Also, aside from Character class where movement is smoothly replicated, you have to implement a similar way to interpolate the objects' movement from one replication update to another. Without it, they'll appear jittery or at worst, teleports from one spot to the next every replication update (because not all objects are replicated every tick).

Here's a bit more info about how CharacterMovementComponent handles the syncing of player movement in a network environment.

more ▼

answered Jan 31 '19 at 02:13 PM

avatar image

1.2k 8 4 8

avatar image HenriOsbourne Feb 06 '19 at 10:35 PM

Thank you for your answer. Unfortunately, All the actors that I need this synced constant movement are part of the gameplay mechanics so their movement must be replicated very smoothly. I think it would be around 20~30 objects having this movement behavior at max, usually less(around 10~15).

It seems like BluePrint-wise there's nothing more optimal than what I'm already doing that can be done, right?

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

When you're talking network movement of actors, you need to read up on dead reckoning (not the game, the process of predicting movement).

In a nutshell, clients send simple commands like move forward, stop moving forward, turn left, stop turning left, etc. The server will always update players based on what actions they last knew they were performing. Based on time, the server can calculate the player's current location, rotation, etc. based on that data.

As a client is running, you smoothly update their position, locations, etc. based on their input, send that data to the server, which will use dead reckoning to figure out where the player is at any time, and periodically send updates to the client to sync up. The client will then interpolate from it's last known local position to the server's updated position. That's why you see the "rubber banding" of your players bouncing around in other games - it's lost sync with the server and the server is forcing the client to sync back to it's last known position.

The interpolating is the smooth motion you are referring to. You don't know it's doing it, but it is. Periodically, it moves from the last known position the client thinks it has to the position the server told it that it really is. You can use a vinterpt to and rinterpto over the update rate period of time between these server to client updates.

So, if a client sends a move forward command, the server will continuously move a client forward based on the elapsed time until it receives a stop moving forward command from the client.

more ▼

answered Feb 07 '19 at 05:49 AM

avatar image

146 2 2 4

(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