Quick start - APIAPI's Replicated Rope & Physics-Carry Kit

A networked carry in your own level: two players, one cube.

Assumes you have finished install.md.

A networked carry

Goal: two players, one cube; one player picks it up and the other sees it in that player's hands.

  1. Make your character carry. Open your character Blueprint. In Class Settings, set Parent Class to UKRope Character (AUKRopeCharacter) - held objects then slow it down by their weight. In the Components panel, click Add, search for UKRopeInteractor and add it; click Add again, search for UKCarry and add the carry component (not the one named Carryable).
  2. Make a cube that can be carried. Create a Blueprint Class of type Actor named BP_MyCrate. Add a Cube static mesh component and drag it onto the root. On the cube: tick Simulate Physics. In Class Defaults: tick Replicates and Replicate Movement. Click Add, search for UKCarryable and add it (leave its Preset empty - the kit's default carry settings apply). Place one BP_MyCrate in your level, in front of the player start.
  3. Bind Grab and Throw. In your character's Event Graph, add the keyboard event for the E key. On Pressed: get the camera's location and forward vector, do a Line Trace By Channel (channel Visibility) from the location to the location plus forward × 300; from the hit's Hit Actor call Get Component by Class with class UKCarryable Component; if it Is Valid, call Request Grab on your UKRopeInteractor component with that component as Target. Add the keyboard event for the Q key and, on Pressed, call Request Throw with Throw Charge Q = 255.
  4. Set two players. In the toolbar's Play options (the three dots next to Play): Number of Players = 2, Net Mode = Play As Client. This runs a dedicated server and two clients in the editor.
  5. Play and grab. Press Play. In the first window, walk to the cube (within 250 cm, the carry preset's default reach), look at it and press E: the cube is held in front of your character - and the second window shows it in the first player's hands.
  6. Throw. Press Q in the first window: the cube flies where that player looks, in both windows.

If the cube does not move with the player, check the log for [UK-VAL-...] lines and see network-model.md. To react to the result of a request (for example to play a sound), bind On Rope Request Resolved on the interactor - see api.md.

Where to next

  • api.md - turn a rope into a zipline a player can ride.
  • api.md - carry presets, weight, throwing and what every machine sees.
  • network-model.md - what is server-authoritative, what is predicted, and the known limits.