Download

Movement and replication for multiplayer spaceships

Ok… I have a problem that I’ve been trying to get to grips with for WEEKS. Hoping someone can guide my brain in the right direction.

The setup -
A spaceship mesh
A relative rotation arrow
A free camera that follows mouse rotation
Blueprints only
Not using marketplace solutions.

The arrow direction is set to a vector (matching the direction the camera is facing) by double clicking. Ship then rotates on tick to face the direction of the arrow. This woks fine.

The problem -
I cannot work out a logical way to control and replicate the movement in a server authoritative manner.

In order to avoid cheating opportunities, I want to run the simulation on the server and replicate positions to the clients. Slight input lag is not a game breaker.

The solutions I’ve tried -
Character movement component: This was a *****. Due to the way I’d like the ships to move, the movement component doesn’t really work as needed. For a physics simulation, it seems to lack some of the additional functions that would be useful. It seemed to replicate alright but running client side. I didn’t dig much further due to the movement not being easy to implement within the framework. Attractive because the component seems to be designed to run client side and prevent cheating attempts by default and keep traffic low, but ultimately not set up for a non walking/driving pawn, especially server side.

**Floating pawn movement component: **In a single player client simulation, this was PERFECT. Adding movement input, using acceleration and max speed settings and adjusting the turn boost setting to control lateral drift did what I needed SO well. Collisions and vector adjustments were as I wanted too. I essentially built a totally perfect prototype of my physics and control system.
The major problems were at first client side replication, both for listen or dedicated. It jitters like CRAZY. I tried for days to solve the replication jitter but failed. It seems many other people have run into the same issues. I won’t go into all the solutions I tried, but I exhausted everything I could find online over about 10 days.
This component is also not set up like character movement so doesn’t allow me to trust it to not be abused if inputs are processed client side. Therefore, this must run on the server to avoid cheating.
I unfortunately discovered that you cannot properly control the component in a server authoritative simulation. I set up the rotation replication by applying the rotation to the pawn and setting a rotator variable on the server. I then teleported the clients to match on tick. Smooth enough, but could not apply the standard movement inputs to the component at all, so no way to use the component as it is designed. It seems it needs a player controller to work (i assume).

No component: Setting physics off on the clients, and on for the server. I passed the inputs to the server and processed them there, adding force for the thrust and torque for rotation. The pawn moves as desired on the server. I then set rotation and location variables, and multicast to set a pawn transform teleport on timed function. SILKY SMOOTH. So this to me is the perfect replication solution, and fairly low traffic, but a horrible movement solution. For a tight control system, using force and torque is messy and hard to control, especially if the acceleration, max speed and rotation rate need to be adjustable and precise. Using the movement input on the above components was so close to perfect for control in comparison.

So here I am, stuck between a perfect single client control system with no decent replication solution, and a perfect replication solution with no usable server authoritative control system. Surely I’ve overlooked something… it should not be this hard to achieve something so basic, when compared to a walking character.

Help!

Did you find a solution for this?