Permalink
Find file
cb09ec8 May 23, 2016
981 lines (515 sloc) 36.4 KB

Unreal Engine

Forums

Getting Started

UE4 on Cortex (28:49)
Cortex Support for UE4 with Tappy Chicken
Customize Tappy Chicken (2:50)
Customize Tappy Chicken

Quick Start

FAQ

  • If you run and the screen is just all black or weird it could be a few issues:

  1. Did you compile for Development Editor/Win64, Development Client/Android, and run copy_client_for_game.cmd?

  2. Did you disable Mobile HDR lighting?

  3. Did you add a Camera to your scene and set a default Level?

  4. Did you install the specific version of the Tegra Android Development Pack? A specific version of TADP needs to be installed which is found in the Engine\Extras\Android\ folder.

TADP installer

Resources

Training and Jams

Documentation

Branch Upgrade Guide

As UnrealEngine releases occur, the branch is forked and then merged into a corresponding 4.X-Cortex branch. Rebranching releases are handled for you, and the following documents the process.

Remote:

  • Add a GIT remote to the fork of EpicGames\UnrealEngine and copy the latest 4.X branch into a new local 4.X branch.

  • Remove the GIT remote to EpicGames\UnrealEngine and push the new branch.

  • Create a new branch from the 4.X branch to 4.X-Cortex.

Native Plugin Changes:

  • Merge Engine\Build\Android\Java\jni\Application.mk to ensure that Android API Level 16 or better can use the Cortex SDK.

  • Copy ouya-sdk.jar to the Android libs folder Engine\Build\Android\Java\libs.

Java Engine Changes:

  • Manually merge Android Java source changes Engine\Build\Android\Java\src.

C++ Launcher Changes:

  • Manually merge JNI and Launch changes Engine\Source\Runtime\Launch\Private\Android.

C++ Engine Blueprints:

  • Manually merge Engine header blueprints Engine\Source\Runtime\Engine\Classes\OuyaSDK.

  • Manually merge Engine source blueprints Engine\Source\Runtime\Engine\Private\OuyaSDK.

Build:

  • Rerun GenerateProjectFiles.bat to generate UE4.sln.

  • Open UE4.sln in Visual Studio 2015.

  • Build Development Editor for Win64.

  • Build Development for Android.

  • Launch Development Editor for Win64.

  • Build and test the example apps.

Commit:

  • Add to .gitignore so that ouya-sdk.jar can be committed.
!/Engine/Build/Android/Java/libs/ouya-sdk.jar

Build UE4

git clone -b 4.10-Cortex https://github.com/tgraupmann/UnrealEngine
Cloning into 'UnrealEngine'...
remote: Counting objects: 243979, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 243979 (delta 8), reused 13 (delta 6)
Receiving objects: 100% (243979/243979), 291.48 MiB | 2.50 MiB/s, done.
Resolving deltas: 100% (172998/172998), done.
Checking connectivity... done.
Checking out files: 100% (26995/26995), done.
  • Important: The 4.6 release introduces a new system for downloading binary dependencies - just run the 'Setup' script in the root of your UE folder to get started. See the README or forum post for more information.

Generate project files

Generate project files

  • Open the UE4.sln in Visual Studio

Open Visual Studio

  • Add Solution Configurations and Solutions Platforms to the Visual Studio Toolbar to easily target the UE4 build platforms.

Options for toolbar

  • Build the Development Editor on the Win64 platform which will build the UnrealEngine\Engine\Binaries\Win64\UE4Editor.exe editor application.

Build UE4

  • Build the Development Client on the Android platform which will build the UnrealEngine\Engine\Binaries\Android\UE4Client-armv7-es2.so native library.

Build Android

  • Run the script UnrealEngine\Engine\Binaries\Android\copy_client_for_game.cmd to copy the native library as the UE4Game-armv7-es2.so dependency to use when building BluePrint projects.

Copy dependency

  • Launch the UE4 editor from UnrealEngine\Engine\Binaries\Win64\UE4Editor.exe.

Launch editor

UE4 Editor

  • Create a New Project as a Blueprint project in the Unreal Project Browser to publish to Android the fastest. Select No Starter Content to reduce the file size. Enter a location of an empty folder to place the project and give it a name. Click Create Project.

New Project

  • Use the File->New Level menu item to create a new level.

New Project

  • Choose an Empty Level to start fresh.

New Project

  • Use the Object Browser and search for OUYA to add the OuyaController and OuyaSDK actors to the level.

Object Browser

  • Use the File->Save As menu item to save the level.

Object Browser

  • Enter a name for the level and click Save.

Object Browser

  • Open the Level Blueprint.

Level Blueprint

  • With OuyaSDK selected in the Scene Outliner, Right-Click to add a reference in the Level Blueprint.

Add OuyaSDK

  • With OuyaController selected in the Scene Outliner, Right-Click to add a reference in the Level Blueprint.

Add OuyaController

  • Click the Compile button to update the latest Blueprint changes after adding the OuyaSDK and OuyaController object references to the Level Blueprint.

Compile Blueprint

  • Right-Click on the Event Graph to add an Event Tick to the Level Blueprint. The event adds an update event to the flow.

Event Tick

  • Right-Click on the Event Graph while the OuyaSDK object in the Scene Outliner is selected to add Ouya Get Any Button Down to the Level Blueprint. The event checks if any controller has a pressed event for the button parameter.

OUYA-Everywhere Input

Any Button Down

  • Right-Click on the Event Graph while the OuyaController object in the Scene Outliner is selected to add Get BUTTON O to the Level Blueprint. The event gets the KeyCode for the BUTTON_O on the OUYA Controller.

Button KeyCode

  • Right-Click on the Event Graph while the OuyaSDK object in the Scene Outliner is selected to add Ouya Clear Button States to the Level Blueprint. The event clears any detected pressed and released states so the next Update Tick can detect the next events.

Clear Button States

  • Click the Compile button to update the latest Blueprint changes after adding a set of events that will detect a pressed event for the given button for any OuyaController.

Compile Blueprint

  • Click the Play button to verify the flow is functioning properly to troubleshoot any issues.

Check Flow

Deployment

  • Before building for Android check your Project Settings in the Unreal Editor.

Project Settings

  • Check Use OBB in APK in the Packaging settings to output a single APK.

Use OBB

  • Uncheck Mobile HDR in the Rendering settings.

Mobile HDR

  • Be sure to select the default level by clicking the Game Default Map drop down and selecting your default level in the Maps & Modes settings page.

Maps & Modes

  • Click Android in the Platforms section. You may need to click Configure Now to configure the project for the Android platform.

Configure Now

  • Set the Orientation to Landscape for the TV.

Orientation

  • Click the Open Manifest Folder button to customize the manifest.

Open Manifest

  • Be sure to check Package game data inside .apk? which was added in the 4.7 update.

Open Manifest

  • The Android settings now auto-generate the AndroidManifest.xml in the 4.7 update.

Open Manifest

  • Edit the AndroidManifest.xml in a Text-Editor.

intent-filter

  • Add the intent-filter so the game will appear in the Play section in the OUYA Launcher.
<category android:name="tv.ouya.intent.category.GAME" />

Intent Filter

  • Build for Tegra 3 devices using the File->Package Project->Android->Android (DXT) menu item.

DXT

  • Browse for an empty folder or use the previous path to output the APK from the build process.

APK

  • Click Show Output Log to watch for any packaging errors that may occur while building the APK.

Output Log

  • A Blueprint only project should build within a few minutes versus a Code project which will take much longer.

Blueprint

  • Run the Install_ProjectName_Development.bat script to install to the connected Forge TV.

Install

  • Generally the install takes 1 second per MB and prints Success when the install has completed.

Success

Examples

Tappy Chicken

Tappy Chicken is a complete example project in the Unreal Launcher. The complete project can be installed within the MarketPlace in the Complete Projects section.

  • Double-Click the BP_MainGame blueprint to open the Event Graph of the Class Blueprint.

MainGame BluePrint

  • Add a Custom Event named OUYA_PLAY that simulates clicking on the PLAY button at the start of the game.

Play Button

  • Add a Custom Event named OUYA_TOUCH that simulates "tapping anywhere" at the start of the game.

Tap Anywhere

  • Add a Custom Event named OUYA_FLAP that simulates flapping the chicken during gameplay.

Flap Chicken

  • Compile the blueprint changes.

  • Open the Level Blueprint.

Level Blueprint

The following event flow adds the custom events needed to play Tappy Chicken on Cortex. If the BUTTON_O pressed event is detected on Any Cortex Controller then the custom events will be invoked for OUYA_PLAY, OUYA_TOUCH, and OUYA_FLAP. OUYA Clear Button States clears the detected pressed and released events so they can be detected in the next update frame.

Check Flow

  • Compile the blueprint changes.

  • Backup the changes with the File->Save All menu item.

Virtual Controller

The Virtual Controller example shows 4 images of the OUYA Controller which moves axises and highlights buttons when the physical controller is manipulated.

Screenshot

The Level Blueprint has a Setup Camera step that sets the Camera Actor as the view target since for this example the camera will remain in a fixed position.

Camera Setup

The BP_Controller class blueprint provides a custom event named Update Controller Sprite which takes sprite parameter references in order to toggle visibility. The custom event first sets the parameters in variables for cleaner flow organization.

Custom Event

The Ouya Get Button event is used to get the current state of each controller button.

Get Button

The menu button detection uses Ouya Get Button Down to catch the pressed event and then uses a Timer Delegate to clear the highlighted Menu Button after a second.

Clear States

One issue with the timer is that we need to pass which menu sprite should be hidden and delegate timers don't have parameters.

Clear States

Since we can't pass a delegate parameter, we use an array to store the menu sprite references to clear sprite visibility after the timer completes. Before calling the timer, we add the sprite actor reference to the array. When the delegate fires, all the sprite actor references are hidden and then the array is cleared.

Clear States

The Ouya Get Axis event is used to get the axis value for a given controller axis.

Get Axis

For the Left Stick and Right Stick, the input is rotated to match the camera angle. The axis sprites are also moved in the rotated direction using the axis input.

Rotate Input

The level blueprint passes sprite actor references from the scene to the class blueprint. The OuyaSDK and OuyaController are also passed to the Update Controller Sprite custom event.

Level Blueprint

The Scene Outliner shows all the Sprite Actor objects that make up a controller in a subfolder. The highlighted buttons and axis sprites are hidden by default. The left and right stick sprites are marked as Movable in the details tab.

Scene Outliner

The level blueprint shows mapping all the Scene Outliner sprites to the Update Controller Sprite custom event.

Level Blueprint

In-App-Purchases

The In-App-Purchases example shows making purchases, checking receipts, adjusting the safe area, and exiting the app.

Screenshot

The IAP example exposes the request purchase dialog.

Screenshot

  • Note: When opening the IAP sample app, set the project settings -> Android -> Android Package Name to tv.ouya.examples.unreal.inapppurchases.

The OuyaSDK provides methods to access In-App-Purchases:

  • AddInitOuyaPluginValues - Use to set the Developer Id

  • InitOuyaPlugin - Initialize the OuyaSDK to invoke IAP calls

  • RequestGamerInfo - Get the gamer's username and uuid

  • RequestProducts - Get the Product details

  • RequestPurchase - Purchase a Product

  • RequestReceipts - Verify the gamer has purchased the application

  • SetSafeArea - Adjust the safe area to control the border order

  • Shutdown - Shutdown/Exit the application

Screenshot

  • Delegates for onSuccess, onFailure, and onCancel parameters are created by using Custom Events. The red box on the top left of a Custom Event will connect to a Delegate parameter.

Screenshot

Add Init Ouya Plugin Values

  • Invoking Add Init Ouya Plugin Values has 2 delegates for onSuccess and onFailure. Add Init Ouya Plugin Values takes two String inputs for Key and Value. Key accepts tv.ouya.developer_id with the Value being your developer id from the developer portal.

Screenshot

Screenshot

  • Upon success or failure, the Add Init Ouya Plugin Values callbacks will be invoked. onSuccess provides no arguments. onFailure receives an integer ErrorCode and string Error Message about the failure. Upon success, the InitOuyaPlugin can be invoked.

Screenshot

Xiaomi Initialization

Back to general info

addInitOuyaPluginValues supports additional strings to make the game compatible with OUYA Everywhere devices.

  • tv.ouya.developer_id - The developer UUID can be found in the developer portal after logging in.

  • com.xiaomi.app_id - The Xiaomi App Id is provided by the content team, email officehours@ouya.tv to obtain your key.

  • com.xiaomi.app_key - The Xiaomi App Key is provided by the content team, email officehours@ouya.tv to obtain your key.

  • tv.ouya.product_id_list - The product id list is a comma separated list of product ids that can be purchased in the game.

image alt text

Init Ouya Plugin

  • Init Ouya Plugin has 2 delegates for onSuccess and onFailure. Be sure to invoke Add Init Ouya Plugin Values successfully before invoking Init Ouya Plugin.

Screenshot

  • Upon success or failure, the Init Ouya Plugin callbacks will be invoked. onSuccess provides no arguments. onFailure receives an integer ErrorCode and string Error Message about the failure. Upon success, the other OuyaSDK methods can be invoked.

Screenshot

Request Gamer Info

  • Request Gamer Info has 3 delegates for onSuccess, onFailure, and onCancel.

Screenshot

  • Upon success, failure, or cancel, the Request Gamer Info callbacks will be invoked. onSuccess provides a Gamer Info result object. onFailure receives an integer ErrorCode and string Error Message about the failure. onCancel receives no arguments.

Screenshot

  • The Gamer Info object has Username and Uuid fields that can be accessed.

Screenshot

Request Products

  • Request Products has 3 delegates for onSuccess, onFailure, and onCancel.

Screenshot

  • Before invoking Request Products be sure to create a string array of product identifiers.

Screenshot

  • Upon success, failure, or cancel, the Request Products callbacks will be invoked. onSuccess provides an Ouya Product result array. onFailure receives an integer ErrorCode and string Error Message about the failure. onCancel receives no arguments.

Screenshot

  • The example iterates through the Ouya Product array to get the details for each Ouya Product object.

Screenshot

  • Several Ouya Product fields are available. The example uses a highlight mechanism to select one of the returned Ouya Product object's identifier for the Request Purchase button.

Screenshot

Request Purchase

  • Request Purchase has 3 delegates for onSuccess, onFailure, and onCancel.

Screenshot

  • The example uses the Result Products array variable which is set in the onSuccessRequestProducts callback. Since the purchasable parameter for Request Purchase takes a string argument, you can hardcode the value, pass a string, or use an array element like the example.

Screenshot

  • Upon success, failure, or cancel, the Request Purchase callbacks will be invoked. onSuccess provides an Ouya Purchase Result result object. onFailure receives an integer ErrorCode and string Error Message about the failure. onCancel receives no arguments.

Screenshot

Request Receipts

  • Request Receipts has 3 delegates for onSuccess, onFailure, and onCancel.

Request Receipts

  • Upon success, or failure, or cancel, the Request Receipts callbacks will be invoked. onSuccess provides an Ouya Receipt result array. onFailure receives an integer ErrorCode and string Error Message about the failure. onCancel receives no arguments.

Receipt callbacks

  • The example iterates through the Ouya Receipt array to get the details for each Ouya Receipt object.

Display Receipts

  • Several Ouya Receipt fields are available including the identifier which games can check for if a entitlement was purchased.

Display Receipt

Shutdown

  • Shutdown has 2 delegates for onSuccess and onFailure.

Shutdown

  • Upon success or failure, the Shutdown callbacks will be invoked.

Shutdown

Community Content

The Community Content example shows how to interact with the Community Content API from blueprints.

Success Callbacks

  • The examples use a Status text field to display the current status. The setTextStatus custom event is reused as a helper to display the status.

Success callback

Failure Callbacks

  • Most failure callbacks have an errorCode and errorMessage which are displayed in status text field for the examples. The setErrorTextStatus custom event can be reused to simplify the failure callbacks.

Failure callback

Get OUYA Content

  • Before interacting with the Community Content API, get a reference to the OUYA Content actor.

  • Upon success, or failure the Get OUYA Content callbacks will be invoked.

  • onSuccess receives a reference to the OuyaContent actor.

  • onFailure receives an errorCode and errorMessage details about the failure.

Get OUYA Content

Initialize OUYA Content

  • Init has 2 delegates for onContentInitialized and onContentDestroyed. The onContentInitialized delegate will be called with OuyaContent has been initialized. The onContentDestroyed delegate will be called with OuyaContent has been destroyed.
  • OuyaContent should be initialized before invoking other Community Content methods.

Initialize OuyaContent

Create OUYA Mod

  • CreateOuyaMod creates a local Community Content record which you can use for editing and publishing.

  • Upon success or failure the CreateOuyaMod callbacks will be invoked.

  • onSuccess receives a reference to the OuyaMod actor.

  • onFailure receives an errorCode and errorMessage details about the failure.

Create OuyaMod

Delete OUYA Mod

  • Upon success, or failure, the Delete callbacks will be invoked.

  • onSuccess receives the Ouya Mod object that was deleted.

  • onFailure receives an Ouya Mod object, an integer ErrorCode and string Error Message about the failure.

Delete

Download OUYA Mod

  • Upon download complete, download progress, or download failure, the Download callbacks will be invoked.

  • onComplete receives the Ouya Mod object that was downloaded.

  • onProgress receives the Ouya Mod object that is downloading and an integer progress.

  • onFailure receives the Ouya Mod object that failed to download.

Download

Edit OUYA Mod

  • Upon success, or failure, the Edit OuyaMod callbacks will be invoked.

  • onSuccess receives a reference to the OuyaModEditor and OuyaMod actors.

  • onFailure receives the associated OuyaMod actor, an errorCode and errorMessage details about the failure.

Edit OuyaMod

Flag OUYA Mod

  • The Flag function will open the dialog to Flag the content item for review.

Flag OuyaMod

Get Category

  • Get Category on the OuyaMod actor gets the string category field.

Get Category

Get Description

  • Get Description on the OuyaMod actor gets the string description field.

Get Description

Get Filenames

  • Get Filenames on the OuyaMod actor gets an array of filename string objects.

Get Filenames

Get Meta Data

  • Get Meta Data on the OuyaMod actor gets the string meta data field.

Get MetaData

Get Installed OUYA Content

  • Upon success, or error, the Get Installed OUYA Content callbacks will be invoked.

  • onSuccess receives a reference to an array of OuyaMod actors, and the Integer count of installed items.

  • onError receives an errorCode and errorMessage details about the failure.

Installed Content

Get Published OUYA Content

  • Upon success, or error, the Get Published OUYA Content callbacks will be invoked.

  • onSuccess receives a reference to an array of OuyaMod actors, and the Integer count of published items.

  • onError receives an errorCode and errorMessage details about the failure.

Published Content

Get Rating Average

  • Get Rating Average on the OuyaMod actor gets the float rating average field.

Get RatingAverage

Get Rating Count

  • Get Rating Count on the OuyaMod actor gets the integer rating count field.

Get RatingCount

Get Screenshots

  • Upon success, or failure, the Get Screenshots callbacks will be invoked.

  • onSuccess provides an Ouya Mod object and Ouya Mod Screenshot result array.

  • onFailure receives an Ouya Mod object, an integer ErrorCode and string Error Message about the failure.

Get Screenshots

Get Tags

  • Get Tags on the OuyaMod actor gets an array of tag string objects.

Get Tags

Get Text File

  • Get Text File on the OuyaMod actor passes a FString filename argument and returns a FString of the file contents.

Get Text File

Get Title

  • Get Title on the OuyaMod actor gets the string title field.

Get Title

Get User Rating

  • Get User Rating on the OuyaMod actor gets the float user rating field.

Get UserRating

Is Downloading

  • Is Downloading on the OuyaMod actor gets the boolean is downloading field.

Is Downloading

Is Flagged

  • Is Flagged on the OuyaMod actor gets the boolean is flagged field.

Is Flagged

Is Installed

  • Is Installed on the OuyaMod actor gets the boolean is installed field.

Is Installed

Is Published

  • Is Published on the OuyaMod actor gets the boolean is published field.

Is Published

Rate OUYA Mod

  • The Rate function will open the dialog to Rate the content item by the user.

Rate OuyaMod

OUYA Mod Editor Add Screenshot

  • The Add Screenshot function on OuyaModEditor will add the UTexture2D to the OuyaMod actor being edited.

Add Screenshot

OUYA Mod Editor Add Tag

  • The Add Tag function on OuyaModEditor will add the string tag to the associated OuyaMod actor being edited.

Edit AddTag

OUYA Mod Editor Delete Filename

  • The Delete Filename function on OuyaModEditor will delete string filename associated OuyaMod actor being edited.

Delete Filename

OUYA Mod Editor New Text File

  • The New Text File function on OuyaModEditor will create a string filename associated OuyaMod actor being edited and the contents of the file are passed as a string .

New Text File

OUYA Mod Editor Remove Screenshot

  • The Remove Screenshot function on OuyaModEditor will remove the OuyaModScreenshot from the OuyaMod actor being edited.

Remove Screenshot

OUYA Mod Editor Remove Tag

  • The Remove Tag function on OuyaModEditor will remove the string tag from the OuyaMod actor being edited.

Remove Tag

OUYA Mod Editor Save

  • The Save function on OuyaModEditor will save the associated OuyaMod actor being edited.

Save OuyaMod

OUYA Mod Editor Set Category

  • The Set Category function on OuyaModEditor will set the string category on the OuyaMod actor being edited.

Set Category

OUYA Mod Editor Set Description

  • The Set Description function on OuyaModEditor will set the string description on the OuyaMod actor being edited.

Set Description

OUYA Mod Editor Set Meta Data

  • The Set Meta Data function on OuyaModEditor will set the string meta data on the OuyaMod actor being edited.

Set MetaData

OUYA Mod Editor Set Title

  • The Set Title function on OuyaModEditor will set the string title on the OuyaMod actor being edited.

Set Title

Publish OUYA Mod

  • Upon success, or failure, the Publish callbacks will be invoked.

  • onSuccess receives the Ouya Mod object that was published.

  • onFailure receives an Ouya Mod object, an integer ErrorCode and string Error Message about the failure.

Publish

Unpublish OUYA Mod

  • Upon success, or failure, the Unpublish callbacks will be invoked.

  • onSuccess receives the Ouya Mod object that was unpublished.

  • onFailure receives an Ouya Mod object, an integer ErrorCode and string Error Message about the failure.

Unpublish

GetImage

  • Invoking GetImage on the OuyaModScreenshot actor returns a UTexture2D image.

Get Image

GetThumbnail

  • Invoking GetThumbnail on the OuyaModScreenshot actor returns a UTexture2D image.

Get Thumbnail

Forge TV

To be able to run UE4 on the Forge TV be sure to use the 4.7-OUYA, 4.8-OUYA, or 4.9-OUYA branch.

Building Source

1) Be sure to upgrade the Android NDK to R10E or later. And update your environment variables to point to the downloaded location.

ANDROID_NDK_ROOT
NDKROOT
NDK_ROOT

2) Build the following targets before launching the Unreal Editor to support publishing to ARM for Forge TV.

  • Development Editor for Win64
  • Development Client for Android
  • Development for Win64
  • Development for Android

Texture Compression

For sprites to appear in the Forge TV be sure to set the compression format as the default compression format will not display on Forge TV.

1) Browse to your texture images in the Content Browser and double-click on the texture item.

image_139

2) Change the texture format to TC_UserInterface2D or similar format and click Save to support the texture on Forge TV.

image_140

Android settings

UE4 version 4.7 added AndroidManifest.xml editing to the Project Settings.

1) Be sure to enable Package game data inside apk?.

2) Add the following intent-filter entry for Extra Settings for <activity> section which should fit all on the same line. This allows the game to appear on the main Forge TV launcher and in the OUYA play store.

<intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /><category android:name="tv.ouya.intent.category.GAME" /></intent-filter>

image_141

Wake Lock

Be sure to add the WAKE_LOCK permission to prevent a screensaver from displaying while the UE4 game is running.

1) Click the + button next to Extra Permissions to add an element.

2) In the new element enter android.permission.WAKE_LOCK.

image_142