Play test - Game client integration - (Unreal Engine module)
Test start matchmaking
Compile the project and open it in the Unreal Editor.
Play the game in the editor.
Once you are in the main menu, navigate to Custom Matchmaking > Start Matchmaking. If your implementation is correct, you should see the Requesting message, indicating that your game is trying to connect to the matchmaking service. Since you haven't started the sample matchmaking backend service, you will receive connection error message on the game client, stating that the backend service is unreachable. You will learn how to run the sample matchmaking backend service on the next tutorial module.
Changing the target matchmaking server
In the previous page, you might notice there's already some logic in the SetupWebSocket
function. That code is an implementation for the configurable matchmaking server address. This allow the game to change which server it matchmake to easily.
There are two ways to configure this target address: through DefaultEngine.ini
and launch parameters. Launch parameters are the first priority, then DefaulEngine.ini
, then the default value, which is ws://127.0.0.1:8080
. For testing purpose, if you need to change the value, that is if you run the sample matchmaking backend service in a different computer, we recommend using the Editor method.
Via launch parameters
This is the highest priority that the game will take the address from. Meaning, if this is set, it will ignore other configurations. This can also be done in multiple ways: packaged game, uncooked, or play in editor.
Packaged game
Open your Byte Wars project in the Unreal Engine editor.
Package your project by going to to Platforms > Windows, make sure the Build Configuration is set to Development and the Build Target is set to AccelByteWars (the game client build target), and click Package Project.
Once the package is done, open the folder that you set as the output location previously, and go inside the Windows folder. Open Windows Powershell in that folder.
Run the game by using this command:
.\AccelByteWars.exe -CustomMatchmakingUrl="ws://target_mm_address:port"
Uncooked
Open Windows Powershell anywhere and run this command:
& "<your_ue5_dir>\UnrealEditor.exe" "<your_project_dir>\AccelByteWars.uproject" -game -CustomMatchmakingUrl="ws://target_mm_address:port
Editor
Open Windows Powershell anywhere and run this command:
& "<your_ue5_dir>\UnrealEditor.exe" "<your_project_dir>\AccelByteWars.uproject" -CustomMatchmakingUrl="ws://target_mm_address:port
Via the DefaultEngine.ini
This configuration is the lower than the launch parameter. This will only be used if the launch parameters for it isn't present. This work for both editor play and packaged game.
Open
Config/DefaultEngine.ini
file.Under the
[CustomMatchmaking]
category, you will findCustomMatchmakingUrl
. Edit the value of that variable.Compile the project and open it in the Unreal Editor. The matchmaking should now point to the new address.