Client Side Prediction and Pawn Exchange vs Pawn Transformation

Hello fellow devs,

we are working on a racing game and we want to transform the player pawn / visually exchange the vehicle with another one while racing. The new vehicle has different movement and different visuals (mesh, FX, etc.). The transformation happens on input of the player (using a power up).

I am wondering which of the two ways to do this will be the best user experience. We can either:

  • Create a new pawn blueprint, possess it on the player controller and hide the old one or
  • Alter the movement mode in the movement component of the existing pawn and hide and show a set of different meshes / FX components so that the visuals correspond to a the new vehicle.

I assume that the first option will be cleaner from the implementation view, but will break client side prediction / introduce lag due to the forced switch of the pawn on the server side, that will require a confirmation over network.

The latter option will introduce more logic into a single class which would be nice to avoid, but should probably avoid forced lag since i can predict the transformation on the client side and only correct it if the prediction is wrong, which happens rarely. Meaning this approach would occasionally create a correction while the other approach would create lag on each use.

Any experts with experiences on this? Or is there a way to avoid the lag on possess / a different approach to the problem that I havent thought of?

Thanks in advance

Modular Character (Pawn) using Skeletal Mesh Merge is what I’d shoot for out of the gate. This doesn’t swap out the actual class so there’s no loss of current movement. It’s all data driven (Cosmetics Struct RepNotify).

You’d RPC the Server to change “cosmetics” it’ll set the struct elements then execute the OnRep function. Handle all the skeletal mesh, static mesh, materials, VFX in the onrep function.

Use Actor Components to handle changes in movement logic and input.

1 Like