# Networking ## How it stays predicted **CMC.** A traversal is a root motion source, `FTRCTraversalRootMotionSource`: a path of a few points and a duration. The CMC already saves root motion sources with each move, replays them after a correction and compares them with the server's. The jump key only marks the request in the saved move (`FLAG_Custom_2`); the owner and the server both start the move inside that same move, from their own copy of the position. A ladder is a custom movement mode driven by the move's own input. Nothing is sent outside the CMC's normal moves, and no correction is switched off. In the air the owner sends each frame as its own move instead of combining two into one: a grab in the air is looked for once a move, and two frames sent as one had the server look a frame away from where the owner did. It costs a little more upload, only while airborne. **Mover.** A traversal and a ladder are movement modes. The path, the time along it and the ladder are in the sync state, so Mover's rollback restores them, and the move starts from the input command, which the server receives like any other input. **Everyone else.** Other players see the move through the normal movement replication. The kind of move travels in the movement mode, so `OnTraversalStarted` and the animations happen on their machines too. ## Measured All numbers come from a dedicated server and two clients in separate processes, both clients at 150 ms of lag and 5% packet loss, running a fixed course: a 60 cm wall, a 150 cm ledge, a 250 cm wall on top of it and a ladder leaning 15 degrees, with a jump off the ladder halfway up. | Character | Completed | Corrections per traversal | |---|---|---| | CMC character, 5 runs | every move, every run | about 2 | | Mover character, 3 runs | every move, every run | under 1 | | Game Animation Sample, Mover, 3 runs | every move, every run | 0 | | Game Animation Sample, CMC, 3 runs | every move, every run | under 1 (largest 1.8 cm) | | Characters of 140 and 240 cm, both systems | every move, every run | as above | The corrections on the CMC are a few centimetres. They come mostly from a difference the CMC already carries before the jump, when the server is a move behind the owner, and they do not show as a jump on screen. For comparison, the vault in Epic's Mover example (montage based) had 2.2 rollbacks per vault on the same course, and it has no mantle. The newer moves, each on a course of its own, same server, clients and connection: | Course | CMC | Mover | |---|---|---| | A jump 2 m short of a 170 cm block, grabbed in the air | 3 of 3, about 3 corrections per grab | 3 of 3, 0 rollbacks | | Down a ladder from its top, sliding at 500 cm/s | every run, 0 to 3 corrections on the ladder | every run, 0 to 4 | | A mantle variant chosen by ledge height | the same variant on the owner and the other player, 0 corrections | the same, 0 | | Jump up to hang from a 340 cm tower, along it through three corners, climb up, drop off the far edge to hang, let go | every step, 0 to 2 corrections in the whole course | every step, 0 to 2 rollbacks | | A slide under a block 110 cm off the floor | 0 corrections; the capsule goes down and back up on both machines | 0 rollbacks; the same | | A wall run along a 12 m wall and a jump off it | runs and jumps off, 2 corrections | runs and jumps off, 0 rollbacks | | Hang from a tower, jump across a 150 cm gap to the next, up to a step 120 cm higher, climb up | 2 of 2, 2 corrections in all | 2 of 2, 1 rollback in all | | Jump at a 5 m wall and push off it in the air, four times | 8 pushes, 4 corrections in all | 8 pushes, 0 rollbacks | | The main course with the vault following its animation's root motion | every move, as without it | every move, 0 to 1 rollback | | The hang course with the body turned to the camera every frame (first person) | every step, about 7 corrections per course | (Mover turns by its own input) | | A vault animation whose root turns 90 degrees, with Follow Root Rotation and a Path Timing curve | ends facing 90 degrees off on the owner, the server and the other player alike; corrections as without it | the same, 0 to 3 rollbacks | | The hang course with the drop down to a ledge turning in 80% of the move (Turn Share) | every step, 4 corrections in 2 runs | every step, 0 | ## Server cost 100 AI characters, each in its own lane of walls and blocks, vaulting and mantling for 30 seconds on one machine with no rendering, against the same 100 just running down empty lanes: | | Frame, running only | Frame, traversing | Difference | |---|---|---|---| | CMC | 17.6 ms | 18.9 ms | +1.4 ms for 100 characters | | Mover | 6.8 ms | 8.2 ms | +1.5 ms for 100 characters | Looking for a traversal when the jump key is pressed (and finding nothing) did not show in the frame time. The frame is mostly the characters' own movement and animation, which a game has anyway. ## Checking it yourself Play in the editor as a client (Net Mode **Play As Client**, two players) with network emulation on under **Editor Preferences → Level Editor → Play → Multiplayer Options** (for example 150 ms and 5% loss), then in the console: | Command | What it shows | |---|---| | `Traversecraft.Debug 1` | Each traversal's path and ledge where it starts (cyan on the client, orange on a listen server), and a line on screen with the move under way, the ping and how many corrections (CMC) or rollbacks (Mover) the local player has had | | `p.NetShowCorrections 1` | The engine's own drawing of each CMC correction: where the client was and where the server put it | `GetCorrectionCount` and `GetLastCorrectionDistance` on the Traversecraft CMC give the same count to Blueprint, for a test of your own. Debug drawing and the on-screen line are left out of Shipping builds. ## Settings that matter on Mover Mover's own defaults in 5.8 make other players' characters jump about on a bad connection (up to 4 m in the same test). Epic's Mover README recommends, and Traversecraft was measured with: **Project Settings > Network Prediction > Simulated Proxy Network LOD = Interpolated** and **Enable Fixed Tick Smoothing = on**.