6. Simulated Players

In this part of the tutorial, you learn how to set up simulated players to test your project at scale.

Watch the video for this part of the tutorial:

Image: Map06_SimulatedPlayers with two real players and two simulated players

6 - Simulated Players
Before you play this map, make sure you set the number of simulated players you want in the Editor Preferences.

A simulated player is a client-worker instance that is controlled by simulated player logic, as opposed to real player input. You can use simulated players to test your game at scale.

A very simple simulated player (BP_SimulatedPlayer) moves around in this map.

Simulated players in the GDK for Unreal

To set up simulated players, you create a character class specifically for them and add custom behaviour to this class. To create behaviours for your simulated players, you use native Unreal Engine simulated players and behavior trees.

In this tutorial, the Blueprint Classes Characters/BP_SimulatedPlayerCharacter and Game/AI/BT_Wander define the simulated players.

When you use simulated players in your own games, you must specify which Blueprint Class to use for the simulated players in each map. To do this, set the following properties:

  • In the Blueprint Class for your simulated players, set IsSimulate to true
  • In the Game Mode Blueprint Class for your map, in Simulated Pawn Class, select the Blueprint Class for your simulated players

You don’t need to do this in the tutorial, because these properties are already set for you.

Image: The Game Mode Blueprint Class BP_Map06GameMode used for the map Map06_SimulatedPlayers. Note that Simulated Pawn Class is already set

In this tutorial, you run simulated players on a local deployment. To test your game at scale, you need to run simulated players in a cloud deployment. For more information, see Simulated players.

Simulated players in the tutorial

To view the simulated players tutorial, follow these steps:

  1. Open the Example Project in the Unreal Editor.
  2. In the Content Browser, open InGameTutorial > Maps > Map06_SimulatedPlayers.
  3. To stop your existing local deployment, in the GDK toolbar, click Stop Deployment.
  4. Go to Edit > Editor Preferences > Level Editor > Play.
  5. In Number Of Simulated Players, enter 2.
    When you start the game, the GDK will spawn additional client windows for the simulated players. There might be a delay before the simulated players start moving.
  6. In the Unreal toolbar, click Play.
  7. Play the game.

You’ve finished the in-game tutorial.

Next steps:

  • Follow the Offloading tutorial: in this you set up the Example Project to run on multiple server-worker instances.
  • If you have an existing Unreal multiplayer project, you can follow the detailed porting guide to get it onto the GDK.
  • If you want to start a project from scratch, follow the setup tutorial for the Starter Template to set up a blank project using the GDK.
  • To set up your project for mobile game-client development, see the documentation on mobile set up for Android or iOS.

2020-08-12 Page added with editorial review

Updated about a year ago

6. Simulated Players

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.