Skip to content

Two players in the editor

Play In Editor (PIE) can run a host and one or more clients in one editor. It is the quickest way to check that a change works for every player, and not only for the host.

In PIE the clients connect straight to the host. The HOST and JOIN menus, the password and the version check are not used. To test those, start two games side by side and go through hosting and joining.

Set it up

  1. In the main toolbar, click the three dots next to Play (Change Play Mode and Play Settings).
  2. Under Multiplayer Options, set Number of Players to 2 and Net Mode to Play As Listen Server.
  3. Under Modes, keep Selected Viewport. The host plays in the editor's viewport, and each client opens in a window of its own.
  4. Click Advanced Settings... (Edit > Editor Preferences > Level Editor > Play). Under Multiplayer Options, check that Run Under One Process is ticked. It is the default, and it costs far less memory than one process per player.
  5. Still there, tick Enable Network Emulation, choose the profile Average and the target Clients Only. Without it, the client has no latency at all and hides timing problems. The template's co-op was tested under Average and Bad.
  6. In Edit > Editor Preferences > General > Performance, untick Use Less CPU when in Background. Otherwise the window you are not using slows down while you play in the other.

These settings are saved in your own editor preferences, not in the project.

Play

  1. Open Content/ZombieSurvival/Maps/L_World and press Play. The host's survivor appears in the viewport.
  2. The client's window opens character creation, because this player has no character in the world yet: CREATE YOUR SURVIVOR, NEXT, then OCCUPATION AND TRAITS, PLAY. The client's survivor appears at the start point.
  3. Click in a window to play in it.

Esc in any of the windows, or Stop in the toolbar, ends the session for every player. In PIE, Esc does not open the pause menu.

What to test

A change that other players must see is tested in four cases:

  1. The host acts, and the client sees it.
  2. The client acts, and the host sees it.
  3. A client acts, and another client sees it. Set Number of Players to 3.
  4. A player arrives in the middle of the game, after the change (below).

A change that works in the first case only usually changes something on one machine instead of asking the host, or sends a one-off message instead of a replicated value.

A player who arrives late

  1. In Edit > Editor Preferences > Level Editor > Play, under Experimental, tick Allow late joining.
  2. Play with Number of Players at 2. Make your change in the world.
  3. Click Add Client in the toolbar. A new client joins the session in progress.

The new client must see the world as it is: the door you opened stays open, the item you dropped is on the floor.

If it does not work

  • The client window stays on character creation: confirm a character in that window. The client plays only once it has one.
  • The editor runs out of memory: each player is a full copy of the world. Close other programs and keep Run Under One Process ticked.