Creating a movement system for all actors

Hi, I am currently creating a movement system where I have actor components that control the state of each actor, and a single actor that actually ticks all the movement. However I am struggling with replicating this. I move by setting world location at every tick based on the state of the actor component. If I set the world location in the actor itself, everything works smoothly and im able to replicate it. However, when i move the actors from an external actor, the movement wont replicate… is this due to some ownership or mechanic for setting world location I might have missed?

how are you replicating it? you could probably just set the actor/component to ReplicatesMovement but if you want to smooth it out you’ll have to handle it differently

I am adding a replicated vector variable (stored in an array) to the world location, so they move slightly every tick. IF you have any better suggestion for replication, I will gladly take them :slight_smile: Will do so fast tarray replication, and perhaps make an array of world location which will be replicated regularly, and used to correct the clients if the local calculation should differ from the server.

Replicate movement seems to make it jitter a bit.

We will need more information on how exactly the “manager” actor ticks the movement. Are you sure this event happens on both client and the server?

The jitter is probably because the actors are moved only on the client and the server then replicates their initial position so they move back into place.

Yes, i run the same function (which basicly adds a vector to the world location, and sets the new world location on every tick) on both server and client. The replication in this case is replicating the world location values and the added vectors.
Replicate movement probably would work for the actors themselves, but I want to be able to have my character (CMC, but considering using the new mover 2.0) stand on all actors. If I only run the world location update on the server, I struggle with jittering when looking at the client from the server.

ah yeah if you’re using CMC it’ll be overriding/fighting with anything you manually do hence the jitter.

you could have the manager call an interface on the actors and then let the actors handle the movement each their own way, some CMC, some FMC, some manual etc

I see… Tried using the mover 2.0 but it is also causing a lot of jitter :frowning: Do you think there is anything wrong with having one manager actor that controls movement of all actors?

yeah im looking forward to Mover 2.0 but it could be a long way away yet :frowning:

no a manager makes sense, ive created the same for a strategy game with different modes like humans/vehicles/flyers etc

i used a separate component to handle the logic, i call it UnitMovement.

Basically all requests go through it and can bind to movement completed. the component where needed calls a dispatcher which the actor pics up, reroutes to its movement of choice (say CMC) then reports the result back to the UnitMovement.

its a bit messy but does the job

1 Like

Will try to implement this somehow :smiley: Currently exploring the use of FastArraySerializer for the replicated values.