Using UDK as a data provider for Scaleform CLIK components

Scaleform CLIK components such as ScrollingList get their data from an IDataProvider. An IDataProvider simply represents a way to populate a component with data. The included IDataProvider implementation in Scaleform, DataProvider, gets its data from an array.

import scaleform.clik.data.DataProvider;
var redTeamPlayerList.dataProvider = new DataProvider(["Player 1", "Player 2", "Player 3"]);

This is great if the data is generated in ActionScript. However, the data we want is usually generated in the game code, not in ActionScript. To get data from the game, you can use ExternalDataProvider, an IDataProvider implementation that is fully compatible with the existing DataProvider in Scaleform.

ExternalDataProvider works by using ExternalInterface to call a source function in the game code that returns an array of data for the component. An UnrealScript function that returns an array of data could look like this:

function array<string> GetPlayerNames(string TeamName)
{
    local array<string> Data;
    local PlayerReplicationInfo PRI;
    local byte TeamIndex;

    TeamIndex = TeamName ~= "red" ? 0 : 1;

    foreach GetPC().WorldInfo.GRI.PRIArray(PRI)
        if (PRI.Team != None && PRI.Team.TeamIndex == TeamIndex)
            Data.AddItem(PRI.PlayerName);

    return Data;
}

Back in ActionScript, you can hook up a component to this data by setting its dataProvider to an ExternalDataProvider that calls the defined function.

redTeamPlayerList.dataProvider = new ExternalDataProvider("GetPlayerNames", "red team");

The component is now hooked up to the specified game data. Whenever the component is displayed, it will automatically call the source function to get an array of data to populate the component.

If the source data changes while the component is displayed, the component needs to be invalidated in order to update itself with the new data.

redTeamPlayerList.dataProvider.invalidate();

With ExternalDataProvider, the work of transferring game information from the game to Scaleform is automated. The only setup required is to define the source function in the game code.

Building an Unreal Development Kit (UDK) game without the installer

The official way to build a UDK game is to use the UnrealFrontend application to create an installer. However, it’s also possible to build a game into a zip archive, instead of an installer. This can be used, for example, to distribute the game with a custom installer, to package the game for releasing on a distribution platform like Steam, or to build the game using a continuous integration system.

Building the game into a zip archive can be accomplished by using the commandlet utilities and the UnSetup application included with UDK. The batch script below will compile, cook, and package the game. It should be run from the root directory of your UDK installation (e.g. C:\UDK\UDK-2012-07).

call Binaries\Win32\UDK.com make -full -unattended -stripsource -nullrhi
if errorlevel 1 goto error

call Binaries\Win32\UDK.com CookPackages -full -platform=PC -nullrhi
if errorlevel 1 goto error

call Binaries\UnSetup.exe -GameCreateManifest
if errorlevel 1 goto error

call Binaries\UnSetup.exe -BuildGameInstaller
if errorlevel 1 goto error

:end

echo Build successful.
exit \b

:error

echo Build error!
exit \b 1

The result of this script is a zip archive in the root directory of your UDK installation that contains the packaged game files. This can be unzipped to any location to get the same game files that would have been extracted by the installer generated by UnrealFrontend.

Installing Unreal Development Kit (UDK) on Windows Server

The UDK installer checks for the presence of a Shader Model 3 video card before proceeding with the installation. By default, this will cause the installation to fail on most servers since a video card is not present. However, it’s possible to bypass the video card check and successfully run the installer by using the -progressonly argument.

  1. Install DirectX on the server. This will work even if the server doesn’t have a video card.
  2. Download the UDK installer on the server.
  3. Open a command prompt where the installer was downloaded (shift + right-click in Windows Explorer to get the Open command window here item).
  4. Execute the installer with the -progressonly argument (i.e. type UDKInstall-2012-11-BETA2.exe -progressonly)
  5. The installer will skip the video card check and the installation will begin.