Floating Pawn player (Def. Pawn Class) doesn't replicate movement

(Full disclosure: I promise I’ve read absolutely everything on here regarding this and watched the Epic tutorials on basic blueprints networking already to no avail.) :slight_smile:

When my Floating Pawn player (Default Pawn class) moves on a client, the movement does not replicate to the server nor any other clients. If I’m playing ON the listen server, its player pawn movement does, indeed, replicate to all other clients.

Yes, my pawn actor is checked to replicate/replicate movement/net load.

No, switching the parent from default pawn to character class won’t work for a variety of reasons:

  1. It breaks the floating pawn movement, even if you try to to add a floating pawn movement component after the fact.
  2. I don’t need the skeletal mesh hookups or animations, etc.
  3. The character class seems hard coded against floating pawn movement (even though it exposes variables for any other type of movement! :slight_smile: ) It would be a ton of hacking/inefficiency just to strip away the character components just to get it to replicate. And yet, it breaks the floating pawn movement anyway.

SO! My questions are:
How can I get the basic floating pawn of a default pawn class to replicate properly? There has to be a simpler way than stripping the character class.
Replication works natively with the character class, so is there something to enable to get it to also work with basic pawns?
How does any other mesh, or movable non-character actor get replicated if it doesn’t live on the server?

Follow up: It’s totally plausible that I don’t know things :slight_smile: and the character class CAN support floating pawn movement component but it’s not as obvious as merely adding the floating pawn movement component like it was for the pawn class. I’d love to hear that someone got it to work!

Thank you ALL in advance!

Most components do not replicate by default. While you may have set your actor to replicate be sure you have also checked that the component itself replicates, not just some arbitrary “bReplicateMovement” variable attached to ACharacter. Also note that APawn does not handle MovementComponents for you. If you want easy plug-and-play movement components with proper client->server replication you will likely need to use ACharacter.

With this said I didn’t even know a FloatingPawnMovement component existed. It’s highly possible that its client->server FSavedMove stuff isn’t implemented. More on that can be found here (it is C+±based).

I’ve never touched on that before, but I would think you can do that with any AActor without the need for a MovementComponent. My first line of thought would be to disable gravity on the actor (mesh). I’d hook up custom input events that would apply acceleration to the mesh according to the forward/up/right vector (and their negatives) and rotation for pitch/yaw/roll.

Is it possible to give ACharacter full floating (6DoF) movement? Is there a way to do all this with Blueprints?

Thanks for the info! After taking bits and pieces from tons of posts, I think I got something simple that works smoothly! I’m going to post in a second.

Well I figured it out after referencing a lot of forum posts and trial and error! Like did in his awesome post, all this happens inside your Pawn’s blueprint. Mine inherits the default pawn class and has a Floating Pawn movement component added.

I have NO physics in my game, so I don’t need to do anything with forces or physics. All physics are off on all blueprints/levels, etc.

I just need my pawns to have 6 DoF and go where I tell it to go, plain and simple!

Create two custom events and set them to execute on the server and check them as reliable.

I called the first event ServerTurn and added a rotator output, calling that output New Rotation.

I called the second event ServerMoveForward and added a vector output, calling that output New Location.

Simply add the InputAxis LookUp and InputAxis Turn events, and connect both to a Server Turn call you just added, attaching a GetActorRotation and its return value plugged into the New Rotation input.

Off of the ServerTurn custom event, simply connect it to a SetActorRotation event, connecting up the New Rotation output to the SetActorRotation’s rotation node.

Then add InputAxis MoveForward event. Add a ServerMoveForward call and connect the two. Connect a GetActorLocation return value to the New Location node of the ServerMoveForward call.

Off of the ServerMoveForward custom event, connect it to a SetActorLocation. Then connect the New Location output from ServerMoveForward to the vector node of the SetActorLocation.

BOOM! All clients move on server and other clients!

I included a pic of the setup as well as the details panel of the base pawn.

I was afraid of that. Are there functions or checks I can use in Blueprints to safeguard against rubberbanding that you know of?

This works for local test servers with little to no ping, but be aware it might not be ideal for release and you may experience rubberbanding due to a lack of interpolation or prediction.

Unfortunately this is out of my area of expertise. Luckily for you this specific system quite small and decoupled from the rest of your system. You can replace it later down the line once you get some more experience with the engine.

Such a long, looong second…

Some say that second is still coming…

The only class that comes with the engine that I know of, that has network smoothing and prediction, is the Character base pawn class, which assumes a vertical skeletal character with a capsule (can act like a sphere if you make the capsule reeeeally short).

So unless you want to program your own network smoothing and prediction, you might have to use Character-based pawn but set its character Movement Type enum var to “Flying”. Not sure how this will work for 6DoF though since it assumes vertical character and might not know how to deal with pitching past -90 or +90 degrees, or banking much either.

1 Like

Could you please post it?

Be aware that setting an actor or component to Replicate means that the Server will replicate to the Clients, but not the other way around. So to have a Client control an object on the server that is not a CharacterPawn, you have to send RPCs to the server to tell it to move the server’s copy of the actor. But again, that doesn’t have built-in smoothing, interpolation, prediction to get rid of the rubberbanding and jitters like the CharacterPawns do.

Just a wild thought that… if its possible and it works… might simplify things a LOT. If you aren’t using physics etc…you might consider just using the Spectator Pawn class, which I suspect has built in replication (sorry I haven’t used this pawn class at all)

If you still want to use a floating movement behavior in networking, simply create a new pawn movement component, copy all the stuff from floating movement component into your own movement component.

in the TickComponent, change if (Controller && Controller->IsLocalController()) to (Controller)

with this change the component works on the server.
addinput vector on the server and the pawn will move on all clients.

1 Like

For anyone having issues w/ this in 2024 - here is what worked for me. Runs smoothly without much lag if any on my end. Granted my pawn is really simple. It’s for a board game style game. So the Player Controller has a pawn. Pawn inputs for movement and the Pawn has a sphere to show were the player’s pawn is to the rest of the players. So not very complex movement, but I think should work.

In the Pawn BP:
Base Actor Replicated = True
Default Scene Root Component Replicates = False
Sphere Component Replicates = True
FloatingPawnMovement Component Replicates = False


image

1 Like

Just so others know, this is Client Authoritative. The moving client will have full authority over the movement of its pawn. Location, rotation, movement speed etc. Thus it can fly, teleport etc.

There’s no server validation/correction.