Getting in Game #

In this section, we’ll put the finishing touches by generating our tokens via the Pragma Portal. Then we’ll test our work by building and packaging our game server and client, then going through matchmaking and getting into game. We’ll first start the platform up so that we can access the portal to generate our tokens.

Start Pragma Engine #

Run Pragma Engine via one of the following methods.

Running via Make
Run make run to start the platform. Run this in a terminal with platform as the working directory.
Running in IntelliJ

From the IntelliJ toolbar in the upper right, ensure MainKt - LocalConfigured is selected, then click the play button.

If MainKt - LocalConfigured isn’t available, you will need to configure it. In the IntelliJ toolbar, click the dropdown next to the run button, then click Edit Configurations…. In the Run/Debug Configurations window that appears, expand Kotlin in the left hand side, then select MainKt - LocalConfigured. Click OK. Click the play button in the IntelliJ toolbar to start Pragma Engine.

Once the engine has started successfully, it prints the message [main] INFO main - Pragma server startup complete.

Generate the Social and Game tokens #

For the game server to integrate with the Pragma Engine backend, we need to generate tokens.

  1. Using a terminal from your Pragma Engine’s platform directory, run make portal-start.
  2. When you see the development and test server start, open a browser and navigate to localhost:3000, then log in to the Portal via unsafe login using the account test01.
  3. Click on the Services menu, then Game Server Management.
  4. Select the testGameShard game shard, then click the Create Tokens button to generate tokens.
  5. In your PragmaGameServer.h file, paste in the tokens you just generated.
    • FString SOCIAL_TOKEN = "Social token value here";
    • FString GAME_TOKEN = "Game token value here";

Set the default map for the game server #

We now need to configure the default map for the game server. This is the map we created earlier during this tutorial.

  1. Switch to Unreal Editor.
  2. From the Edit menu, click Project Settings.
  3. In the Project Settings window, click Maps & Modes which is under the Project category.
  4. Expand the Default Maps section.
  5. Ensure that the Editor Startup Map and Game Default Map both still point to level where you built out your game’s login and party screen. You likely do not need to make any changes here.
  6. Ensure that the Server Default Map points to ServerMap, which you created earlier during this guide.
  7. Don’t close the Project Settings window yet.

Include maps in packaged build #

Next, we need to ensure that those maps get included when we package our standalone dedicated server.

  1. In the sidebar, click Packaging, which is also under the Project section.
  2. Under List of maps to include in a packaged build, include both the ServerMap and the map where you built the login and party screens.

Package the server and client #

  1. In Unreal Editor, go to the File menu, Package Project, Build Target, and select the game client.
  2. Go to the File menu, Package Project, Windows (64-bit), and select a convenient directory.
  3. When the build finishes, go back to the File menu, Package Project, Build Target, and select the game server.
  4. Go to the File menu, Package Project, Windows (64-bit), and select the same directory.
  5. When this build finishes, you should now have standalone client and server executables built and packaged.

Configure the Local Process Capacity Provider #

Lastly, we need to configure Pragma Engine to launch our game executable.

  1. Open or switch to IntelliJ, then open your copy of pragma-engine.
  2. Navigate to your 5-ext/config/local-dev.yml file.
  3. Insert the following configuration:
game:
  pluginConfigs:
    MatchCapacityService.capacityProvider:
      class: "pragma.matchcapacity.LocalProcessCapacityProvider"
      config:
        processCommand:
          0: "C:/Path/To/TutorialsServer.exe"
          1: -pragmaBackendAddress="http://127.0.0.1:10100"
          2: -hostname="127.0.0.1"        # Passed to client via HostConnectionDetails
          3: -port=7777                   # Passed to client via HostConnectionDetails
          4: -version="GameServerVersion1"
          5: -pragmaServerNoExit          # Don't exit when done.
        serverIdParam: -serverID=
        gameServerZoneParam: -gameServerZone=
        logPathParam: ""
        logOutputPath: ""
        maximumLocalServers: 1

You should modify the following line to point to the game server executable that you just packaged: 0: "C:/Path/To/TutorialsServer.exe" 4. If pragma-engine is currently running, stop and restart it.

Get in game #

  1. Launch two copies of the game client executable.
  2. Log into each client with test01 and test02.
  3. Proceed through the party screen then start matchmaking on both clients.
  4. After matchmaking succeeds, the Pragma Engine backend launches the game server, which calls connect players. Connection details get sent to the game clients, which then connect to the game server to play the game.