Unreal Tournament on the Cloud

In this section, we walk you through the steps to get an Unreal Tournament project integrated with the Genvid MILE SDK running on an Amazon Web Services (AWS) cloud instance.

If you’ve never set up a game to run on the cloud after integrating the Genvid SDK, you should read the SDK in the Cloud section for an overview. If you’d like to try a simpler sample of running a project on the cloud, see Building the DirectX Sample for the Cloud.

Before You Begin

  1. Set up an AWS instance to use with the Genvid MILE SDK. See Set Up a New Cloud Environment for more information. If you need to stream with SSL, like for streaming on Twitch, use an alb_ssl module for your cloud cluster.
  2. Integrate the Genvid MILE SDK with Unreal Tournament. See Unreal Tournament Integration for more information.

Prepare the UT4 Project and Cluster

Unreal Tournament is a large game and requires some preparation to simplify transfers to the cloud.

  1. First, you need to package your project. If you’re doing it following the Unreal Engine documentation, use the following values:

    • Cooker configuration: Development
    • Platform: WindowsNoEditor

    If you’re not packaging from the Unreal Editor, you can cut-and-paste the following scripts into your command-prompt while in the Unreal Engine root directory.

    SERVER

    Engine\Build\BatchFiles\RunUAT.bat BuildCookRun
    -project="UnrealTournament/UnrealTournament.uproject" -noP4
    -platform=Win64 -clientconfig=Development -serverconfig=Development
    -cook -server -serverplatform=Win64 -noclient -compile -stage -pak
    -archive -archivedirectory="UnrealTournament\Archives"
    -map=DM-Underland+Example_Map+UT-Entry -build
    

    CLIENT

    Engine\Build\BatchFiles\RunUAT.bat BuildCookRun
    -project="UnrealTournament/UnrealTournament.uproject" -noP4
    -platform=Win64 -clientconfig=Development -serverconfig=Development
    -cook -compile -stage -pak -archive
    -archivedirectory="UnrealTournament\Archives"
    -map=DM-Underland+Example_Map+UT-Entry -build*
    
  2. Sync the content of the archive folder with your Amazon S3 bucket.

    aws s3 mb s3://[mys3bucket]/v1/
    aws s3 sync [UT Folder]/ s3://[mys3bucket]/v1/[Windows Folder]
    
    • [mys3bucket] is the unique name for your AWS S3 bucket.
    • [UT Folder] is the \\WindowsNoEditor folder in your package directory.
    • [Windows Folder] is the \\WindowsServer and \\WindowsNoEditor folders that will be created in your bucket in which your assets will be added.
  3. Save a copy of /samples/ut4/config/config/cloud.example.hcl as /samples/ut4/config/config/cloud.hcl to use for your project configuration.

  4. Edit the bucket in cloud.hcl to work with your S3 bucket.

    config {
      cloud {
        artifact {
          s3url       = "s3://[some_unique_name]/v1/"
          destination = "c://game//"
        }
      }
    }
    
    • s3url is the location of your S3 bucket.
    • destination is the folder on the game machine to download to.

    This lets the cloud configuration load properly using the supplied Python script.

    Note

    We use the Z: drive (a local drive to the AWS instance) to avoid hitting IO limits of an EBS volume which would otherwise stall the game process.

  5. Ensure the cluster is properly set up.

    genvid-sdk -c [myclusterid] clean-config
    genvid-sdk -c [myclusterid] load-config-sdk
    genvid-sdk -c [myclusterid] upload-images-sdk --update-config
    genvid-sdk -c [myclusterid] setup
    
    • [myclusterid] is the unique name you gave your Genvid cluster while setting it up.
  6. Load the project definition into the cluster.

    py ut4.py -c [myclusterid] load
    

Start the Update and Build the Website

The update service sends the game from your S3 cluster to the game machine. During this process, which can take some time, you can build and set up the website.

  1. Start the custom job to update the game.

    genvid-sdk -c [myclusterid] start update
    
  2. Verify progress on the Cluster UI page.

    On the Logs page, the Update service will show Pending while the process runs, then turn green when it completes.

    You can also monitor the progress by printing the log directly to your command prompt.

    genvid-sdk -c [myclusterid] log -t update
    
  3. While the update runs, build the website and upload it to S3.

    py ut4.py -c [myclusterid] build-cloud
    py ut4.py -c [myclusterid] upload-images --update-config
    

    The second command ensures the Docker images are all updated.

  4. If you need your stream to be embedded on the website while using SSL, make sure that your configuration file has the embed_ssl key set to true. For example for Twitch:

    version = "1.7.0"
    
    settings {
        encode {
        stream {
          enable  = true
          service = "twitch"
          // YOU MUST CHANGE THE ADDRESS, CHANNEL AND KEY VALUE
          addr    = "rtmp://<twitch-ingest-server>/app"
          channel = "channelname"
          key     = "live_NNNNNNNN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
      }
        leaf {
        port = 30001
      }
    } // end of settings
    
    link "button" {
      name     = "Twitch Channel"
      template = "http://twitch.tv/${key `genvid/encode/stream/channel`}"
    } // end of link "twitch"
    
    config {
      embed_ssl {
        enabled = true
      }
    } // end of config
    

Populate it correctly with channel, address and key, then load it:

genvid-sdk -c [myclusterid] load-config samples/streaming_services/twitch.sample.hcl.

Start the Game

Once the update job is finished, you can start the game and view the results on the website.

  1. Launch the Cluster UI.

    genvid-sdk [myclusterid] monitor
    
  2. Click the Jobs tab.

  3. Click START ALL.

    This starts the following jobs:

    • services
    • tutorial application
    • web

    You can also start the services individually.

    The links become active after the job status changes to running.

  4. Click UT4 DEMO in the Links section to launch the tutorial.

  5. When finished, click STOP ALL to stop all the services.

You can also do everything from the command line.

  1. Start the game.

    genvid-sdk -c [myclusterid] start
    
  2. Open the webpage.

    genvid-sdk -c [myclusterid] open web
    
  3. When you finish, stop the game.

    genvid-sdk -c [myclusterid] stop # Stop the game but not the servers.