Skip to main content

Run sample matchmaking backend service - End-to-end testing - (Unity module)

Last updated on March 12, 2025

Run sample matchmaking backend service locally

In this tutorial section, you learn how to run the sample matchmaking backend service locally on your computer.

  1. First, make sure you have cloned the sample matchmaking backend service project on your computer. You can refer to the Initial setup module on how to clone it.

  2. The sample matchmaking backend service project is created using Python. Thus, make sure you have install Python 3.13.x on your computer.

  3. Once you have the previous requirements ready, open the sample matchmaking backend service project. Then, create a new PowerShell script named run.ps1 and place it in the matchmaking-server folder of the cloned backend service project.

  4. Open the run.ps1 file and add the code below. This code set environment variables for server.py and the run the Python script.

    # Set env var
    $env:AB_BASE_URL = "https://<game_namespace_id>.prod.gamingservices.accelbyte.io"
    $env:AB_NAMESPACE = "<game_namespace_id>"
    $env:AB_CLIENT_ID = "<ams_cliam_client_id>"
    $env:AB_CLIENT_SECRET = "<ams_cliam_client_secret>"
    $env:CLAIM_KEYS = "unity-ds-ams"
    $env:REGIONS = "ap-southeast-1,us-east-2"

    # Run python
    & python ./server.py
    info
    • AB_BASE_URL is the base URL made out of your game namespace ID combined with your Admin Portal environment.
    • AB_NAMESPACE is the namespace ID of your game namespace.
    • AB_CLIENT_ID is the client ID of the IAM client to claim dedicated servers. You can use the ByteWars-AMSClaim IAM client you created in the previous section.
    • AB_CLIENT_SECRET is the client secret of the IAM client to claim dedicated servers. You can use the ByteWars-AMSClaim IAM client you created in the previous section.
    • CLAIM_KEYS is the claim keys you set on your AMS fleet. The claim keys must be separated with coma without whitespaces, for example claimkey1,claimkey2. Refer to the previous module for more information.
    • REGIONS is the active regions of your AMS fleet. The regions must be separated with coma without whitespaces, for example ap-southeast-1,us-east-2. Refer to the previous module for more information.
    tip

    To find your game namespace ID, go to your Admin Portal and navigate to the Namespace page where your game namespaces are listed. Then, locate your game namespace under the GAMES section and click on the gear icon. On the new page, locate the Namespace ID property and there you can find your game namespace ID value.

  5. Finally, run the run.ps1 using Windows PowerShell. Make sure to run it from matchmaking-server folder of the cloned sample matchmaking backend service, otherwise Windows PowerShell won't able to find the file.

    ./run.ps1
  6. Now, the sample matchmaking backend service is running locally on your computer at ws://127.0.0.1:8080. You can also see the log indicating that the service is started.

    matchmaker started