UE4 on Cortex (28:49) |
Customize Tappy Chicken (2:50) |
-
First you need an Unreal account
-
Link your Github account with your Unreal account per the wiki instructions
-
Only after linking your Github account will you have access to the UE4 Source.
-
After linking your Github account, you should have access to the
Cortex
Branches -
4.10-Cortex branch for the
Cortex
Fork of UE4 -
4.9-OUYA branch for the
Cortex
Fork of UE4 -
4.8-OUYA branch for the
Cortex
Fork of UE4 -
4.7-OUYA branch for the
Cortex
Fork of UE4 -
4.6-OUYA branch for the
Cortex
Fork of UE4 -
Quick Link: Building the Cortex Fork of UE4
-
Quick Link: Getting Started in the UE4 Editor
-
Quick Link: Deploying to the Forge TV
-
Quick Link: Tappy Chicken Example
-
Quick Link: Virtual Controller Example
-
Quick Link: In-App-Purchase Example
- If you run and the screen is just all black or weird it could be a few issues:
-
Did you compile for
Development Editor/Win64
,Development Client/Android
, and runcopy_client_for_game.cmd
? -
Did you disable Mobile HDR lighting?
-
Did you add a
Camera
to your scene and set a defaultLevel
? -
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.
-
Get the Unreal Engine - Unreal Engine and Source, All for 5% of Revenue after more than $3k gross revenue
-
Unreal Forum Post - Unreal - Tracking
Cortex
Plugin process and requests for info -
UE4 Video Tutorials - Unreal - Unreal 4 Documentation
-
UE4 Video Playlist - Unreal - Epic Video Playlists
-
UE4 Programming Playlist - Unreal - Introduction to UE4 Programming Playlist
-
Android Quick Start - Unreal - Documentation steps for getting started with Unreal
-
Android Reference Guide - Unreal - Environment variable setup for Android publishing
-
Blueprints - Unreal - Visual Scripting
-
Introduction to Paper2D - Unreal - Intro to 2D sprites
-
Unreal Chat - #UnrealEngine on Freenode
-
C# for Unreal Engine - Write gameplay, AI, UI elements, and more with C#
-
Zeef Resource Page - Tons of Unreal resource links
-
Master Unreal Blueprints - Books and other resources for mastering Blueprints
-
Syncing Remote Fork - As EpicGames releases branch updates, the fork needs to be synced
-
Training Streams happen Tuesdays for Q&A training sessions.
-
Weekly Unreal Twitch Stream
-
Game Jams - Epic hosts monthly game jams.
-
Answer Hub is the best way to get your questions about UE4 answered.
-
Coding Documentation: Delegates
-
Coding Documentation: Functions
-
Coding Documentation: Properties/Core Data Types
-
Artificial Intelligence - AI Overview and Behavior Tree Quick Start Guide
-
JNI Spec - UE4 to Android communication uses the JNI specification
-
BLUI - BLUI is an open-source HTML renderer to make fancy UIs by embedding a browser into UE4
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 ofEpicGames\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 to4.X-Cortex
.
Native Plugin Changes:
-
Merge
Engine\Build\Android\Java\jni\Application.mk
to ensure that Android API Level 16 or better can use theCortex SDK
. -
Copy
ouya-sdk.jar
to the Android libs folderEngine\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 generateUE4.sln
. -
Open
UE4.sln
inVisual Studio 2015
. -
Build
Development Editor
forWin64
. -
Build
Development
forAndroid
. -
Launch
Development Editor
forWin64
. -
Build and test the example apps.
Commit:
- Add to
.gitignore
so thatouya-sdk.jar
can be committed.
!/Engine/Build/Android/Java/libs/ouya-sdk.jar
- Download the 4.10-Cortex branch to get the
Cortex fork
of theUnreal Engine
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.
- Follow the Build the Engine steps to generate the Visual Studio solution.
- Open the
UE4.sln
in Visual Studio
- Add
Solution Configurations
andSolutions Platforms
to the Visual Studio Toolbar to easily target theUE4
build platforms.
- Build the
Development Editor
on theWin64
platform which will build theUnrealEngine\Engine\Binaries\Win64\UE4Editor.exe
editor application.
- Build the
Development Client
on theAndroid
platform which will build theUnrealEngine\Engine\Binaries\Android\UE4Client-armv7-es2.so
native library.
- Run the script
UnrealEngine\Engine\Binaries\Android\copy_client_for_game.cmd
to copy the native library as theUE4Game-armv7-es2.so
dependency to use when building BluePrint projects.
- Launch the
UE4
editor fromUnrealEngine\Engine\Binaries\Win64\UE4Editor.exe
.
- Create a
New Project
as aBlueprint
project in theUnreal Project Browser
to publish toAndroid
the fastest. SelectNo Starter Content
to reduce the file size. Enter a location of an empty folder to place the project and give it a name. ClickCreate Project
.
- Use the
File->New Level
menu item to create a new level.
- Choose an
Empty Level
to start fresh.
- Use the
Object Browser
and search forOUYA
to add theOuyaController
andOuyaSDK
actors to the level.
- Use the
File->Save As
menu item to save the level.
- Enter a name for the level and click
Save
.
- Open the
Level Blueprint
.
- With
OuyaSDK
selected in theScene Outliner
,Right-Click
to add a reference in theLevel Blueprint
.
- With
OuyaController
selected in theScene Outliner
,Right-Click
to add a reference in theLevel Blueprint
.
- Click the
Compile
button to update the latestBlueprint
changes after adding theOuyaSDK
andOuyaController
object references to theLevel Blueprint
.
Right-Click
on theEvent Graph
to add anEvent Tick
to theLevel Blueprint
. The event adds an update event to the flow.
Right-Click
on theEvent Graph
while theOuyaSDK
object in theScene Outliner
is selected to addOuya Get Any Button Down
to theLevel Blueprint
. The event checks if any controller has apressed
event for thebutton
parameter.
Right-Click
on theEvent Graph
while theOuyaController
object in theScene Outliner
is selected to addGet BUTTON O
to theLevel Blueprint
. The event gets theKeyCode
for theBUTTON_O
on the OUYA Controller.
Right-Click
on theEvent Graph
while theOuyaSDK
object in theScene Outliner
is selected to addOuya Clear Button States
to theLevel Blueprint
. The event clears any detectedpressed
andreleased
states so the nextUpdate Tick
can detect the next events.
- Click the
Compile
button to update the latestBlueprint
changes after adding a set of events that will detect apressed
event for the givenbutton
for anyOuyaController
.
- Click the
Play
button to verify the flow is functioning properly to troubleshoot any issues.
- Before building for
Android
check yourProject Settings
in theUnreal Editor
.
- Check
Use OBB in APK
in thePackaging
settings to output a singleAPK
.
- Uncheck
Mobile HDR
in theRendering
settings.
- Be sure to select the default level by clicking the
Game Default Map
drop down and selecting your default level in theMaps & Modes
settings page.
- Click
Android
in thePlatforms
section. You may need to clickConfigure Now
to configure the project for theAndroid
platform.
- Set the
Orientation
toLandscape
for the TV.
- Click the
Open Manifest Folder
button to customize the manifest.
- Be sure to check
Package game data inside .apk?
which was added in the4.7 update
.
- The Android settings now auto-generate the
AndroidManifest.xml
in the4.7 update
.
- Edit the
AndroidManifest.xml
in aText-Editor
.
- Add the
intent-filter
so the game will appear in thePlay
section in theOUYA Launcher
.
<category android:name="tv.ouya.intent.category.GAME" />
- Build for
Tegra 3
devices using theFile->Package Project->Android->Android (DXT)
menu item.
- Browse for an empty folder or use the previous path to output the
APK
from the build process.
- Click
Show Output Log
to watch for any packaging errors that may occur while building theAPK
.
- A
Blueprint
only project should build within a few minutes versus aCode
project which will take much longer.
- Run the
Install_ProjectName_Development.bat
script to install to the connectedForge TV
.
- Generally the install takes 1 second per MB and prints
Success
when the install has completed.
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 theEvent Graph
of theClass Blueprint
.
- Add a
Custom Event
namedOUYA_PLAY
that simulates clicking on thePLAY
button at the start of the game.
- Add a
Custom Event
namedOUYA_TOUCH
that simulates "tapping anywhere" at the start of the game.
- Add a
Custom Event
namedOUYA_FLAP
that simulates flapping the chicken during gameplay.
-
Compile the blueprint changes.
-
Open the
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.
-
Compile the blueprint changes.
-
Backup the changes with the
File->Save All
menu item.
The Virtual Controller example shows 4 images of the OUYA Controller which moves axises and highlights buttons when the physical controller is manipulated.
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.
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.
The Ouya Get Button
event is used to get the current state of each controller 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.
One issue with the timer is that we need to pass which menu sprite should be hidden and delegate timers don't have parameters.
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.
The Ouya Get Axis
event is used to get the axis value for a given controller 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.
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.
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.
The level blueprint
shows mapping all the Scene Outliner
sprites to the Update Controller Sprite
custom event.
The In-App-Purchases example shows making purchases, checking receipts, adjusting the safe area, and exiting the app.
The IAP
example exposes the request purchase dialog.
- 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
anduuid
-
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
- Delegates for
onSuccess
,onFailure
, andonCancel
parameters are created by usingCustom Events
. The red box on the top left of aCustom Event
will connect to aDelegate
parameter.
- Invoking
Add Init Ouya Plugin Values
has 2 delegates foronSuccess
andonFailure
.Add Init Ouya Plugin Values
takes two String inputs forKey
andValue
.Key
acceptstv.ouya.developer_id
with theValue
being yourdeveloper id
from the developer portal.
- Be sure to set your
DEVELOPER_ID
from the Developer Portal.
- Upon success or failure, the
Add Init Ouya Plugin Values
callbacks will be invoked.onSuccess
provides no arguments.onFailure
receives an integerErrorCode
and stringError Message
about the failure. Upon success, theInitOuyaPlugin
can be invoked.
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, emailofficehours@ouya.tv
to obtain your key. -
com.xiaomi.app_key
- The Xiaomi App Key is provided by the content team, emailofficehours@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.
Init Ouya Plugin
has 2 delegates foronSuccess
andonFailure
. Be sure to invokeAdd Init Ouya Plugin Values
successfully before invokingInit Ouya Plugin
.
- Upon success or failure, the
Init Ouya Plugin
callbacks will be invoked.onSuccess
provides no arguments.onFailure
receives an integerErrorCode
and stringError Message
about the failure. Upon success, the otherOuyaSDK
methods can be invoked.
Request Gamer Info
has 3 delegates foronSuccess
,onFailure
, andonCancel
.
- Upon success, failure, or cancel, the
Request Gamer Info
callbacks will be invoked.onSuccess
provides aGamer Info
result object.onFailure
receives an integerErrorCode
and stringError Message
about the failure.onCancel
receives no arguments.
- The
Gamer Info
object hasUsername
andUuid
fields that can be accessed.
Request Products
has 3 delegates foronSuccess
,onFailure
, andonCancel
.
- Before invoking
Request Products
be sure to create astring array
ofproduct identifiers
.
- Upon success, failure, or cancel, the
Request Products
callbacks will be invoked.onSuccess
provides anOuya Product
result array.onFailure
receives an integerErrorCode
and stringError Message
about the failure.onCancel
receives no arguments.
- The example iterates through the
Ouya Product
array to get the details for eachOuya Product
object.
- Several
Ouya Product
fields are available. The example uses a highlight mechanism to select one of the returnedOuya Product
object'sidentifier
for theRequest Purchase
button.
Request Purchase
has 3 delegates foronSuccess
,onFailure
, andonCancel
.
- The example uses the
Result Products
array variable which isset
in theonSuccessRequestProducts
callback. Since thepurchasable
parameter forRequest Purchase
takes astring
argument, you can hardcode the value, pass a string, or use anarray element
like the example.
- Upon success, failure, or cancel, the
Request Purchase
callbacks will be invoked.onSuccess
provides anOuya Purchase Result
result object.onFailure
receives an integerErrorCode
and stringError Message
about the failure.onCancel
receives no arguments.
Request Receipts
has 3 delegates foronSuccess
,onFailure
, andonCancel
.
- Upon success, or failure, or cancel, the
Request Receipts
callbacks will be invoked.onSuccess
provides anOuya Receipt
result array.onFailure
receives an integerErrorCode
and stringError Message
about the failure.onCancel
receives no arguments.
- The example iterates through the
Ouya Receipt
array to get the details for eachOuya Receipt
object.
- Several
Ouya Receipt
fields are available including theidentifier
which games can check for if aentitlement
was purchased.
Shutdown
has 2 delegates foronSuccess
andonFailure
.
- Upon success or failure, the
Shutdown
callbacks will be invoked.
The Community Content example shows how to interact with the Community Content API from blueprints.
- The examples use a
Status
text field to display the current status. ThesetTextStatus
custom event is reused as a helper to display the status.
- Most failure callbacks have an
errorCode
anderrorMessage
which are displayed in status text field for the examples. ThesetErrorTextStatus
custom event can be reused to simplify the failure callbacks.
-
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 theOuyaContent
actor. -
onFailure
receives anerrorCode
anderrorMessage
details about the failure.
Init
has 2 delegates foronContentInitialized
andonContentDestroyed
. TheonContentInitialized
delegate will be called withOuyaContent
has been initialized. TheonContentDestroyed
delegate will be called withOuyaContent
has been destroyed.OuyaContent
should be initialized before invoking otherCommunity Content
methods.
-
CreateOuyaMod
creates a localCommunity 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 theOuyaMod
actor. -
onFailure
receives anerrorCode
anderrorMessage
details about the failure.
-
Upon success, or failure, the
Delete
callbacks will be invoked. -
onSuccess
receives theOuya Mod
object that was deleted. -
onFailure
receives anOuya Mod
object, an integerErrorCode
and stringError Message
about the failure.
-
Upon download complete, download progress, or download failure, the
Download
callbacks will be invoked. -
onComplete
receives theOuya Mod
object that was downloaded. -
onProgress
receives theOuya Mod
object that is downloading and aninteger
progress. -
onFailure
receives theOuya Mod
object that failed to download.
-
Upon success, or failure, the
Edit OuyaMod
callbacks will be invoked. -
onSuccess
receives a reference to theOuyaModEditor
andOuyaMod
actors. -
onFailure
receives the associatedOuyaMod
actor, anerrorCode
anderrorMessage
details about the failure.
- The
Flag
function will open the dialog toFlag
the content item for review.
Get Category
on theOuyaMod
actor gets thestring
category field.
Get Description
on theOuyaMod
actor gets thestring
description field.
Get Filenames
on theOuyaMod
actor gets an array of filenamestring
objects.
Get Meta Data
on theOuyaMod
actor gets thestring
meta data field.
-
Upon success, or error, the
Get Installed OUYA Content
callbacks will be invoked. -
onSuccess
receives a reference to an array ofOuyaMod
actors, and theInteger
count of installed items. -
onError
receives anerrorCode
anderrorMessage
details about the failure.
-
Upon success, or error, the
Get Published OUYA Content
callbacks will be invoked. -
onSuccess
receives a reference to an array ofOuyaMod
actors, and theInteger
count of published items. -
onError
receives anerrorCode
anderrorMessage
details about the failure.
Get Rating Average
on theOuyaMod
actor gets thefloat
rating average field.
Get Rating Count
on theOuyaMod
actor gets theinteger
rating count field.
-
Upon success, or failure, the
Get Screenshots
callbacks will be invoked. -
onSuccess
provides anOuya Mod
object andOuya Mod Screenshot
result array. -
onFailure
receives anOuya Mod
object, an integerErrorCode
and stringError Message
about the failure.
Get Tags
on theOuyaMod
actor gets an array of tagstring
objects.
Get Text File
on theOuyaMod
actor passes aFString
filename argument and returns aFString
of the file contents.
Get Title
on theOuyaMod
actor gets thestring
title field.
Get User Rating
on theOuyaMod
actor gets thefloat
user rating field.
Is Downloading
on theOuyaMod
actor gets theboolean
is downloading field.
Is Flagged
on theOuyaMod
actor gets theboolean
is flagged field.
Is Installed
on theOuyaMod
actor gets theboolean
is installed field.
Is Published
on theOuyaMod
actor gets theboolean
is published field.
- The
Rate
function will open the dialog toRate
the content item by the user.
- The
Add Screenshot
function onOuyaModEditor
will add theUTexture2D
to theOuyaMod
actor being edited.
- The
Add Tag
function onOuyaModEditor
will add thestring
tag to the associatedOuyaMod
actor being edited.
- The
Delete Filename
function onOuyaModEditor
will deletestring
filename associatedOuyaMod
actor being edited.
- The
New Text File
function onOuyaModEditor
will create astring
filename associatedOuyaMod
actor being edited and the contents of the file are passed as astring
.
- The
Remove Screenshot
function onOuyaModEditor
will remove theOuyaModScreenshot
from theOuyaMod
actor being edited.
- The
Remove Tag
function onOuyaModEditor
will remove thestring
tag from theOuyaMod
actor being edited.
- The
Save
function onOuyaModEditor
will save the associatedOuyaMod
actor being edited.
- The
Set Category
function onOuyaModEditor
will set thestring
category on theOuyaMod
actor being edited.
- The
Set Description
function onOuyaModEditor
will set thestring
description on theOuyaMod
actor being edited.
- The
Set Meta Data
function onOuyaModEditor
will set thestring
meta data on theOuyaMod
actor being edited.
- The
Set Title
function onOuyaModEditor
will set thestring
title on theOuyaMod
actor being edited.
-
Upon success, or failure, the
Publish
callbacks will be invoked. -
onSuccess
receives theOuya Mod
object that was published. -
onFailure
receives anOuya Mod
object, an integerErrorCode
and stringError Message
about the failure.
-
Upon success, or failure, the
Unpublish
callbacks will be invoked. -
onSuccess
receives theOuya Mod
object that was unpublished. -
onFailure
receives anOuya Mod
object, an integerErrorCode
and stringError Message
about the failure.
- Invoking
GetImage
on theOuyaModScreenshot
actor returns aUTexture2D
image.
- Invoking
GetThumbnail
on theOuyaModScreenshot
actor returns aUTexture2D
image.
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.
- Be sure to upgrade the
Android NDK
toR10E
or later. And update your environment variables to point to the downloaded location.
ANDROID_NDK_ROOT
NDKROOT
NDK_ROOT
- Build the following targets before launching the
Unreal Editor
to support publishing toARM
forForge TV
.
Development Editor
forWin64
Development Client
forAndroid
Development
forWin64
Development
forAndroid
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
.
- Browse to your texture images in the
Content Browser
anddouble-click
on the texture item.
- Change the texture format to
TC_UserInterface2D
or similar format and clickSave
to support the texture onForge TV
.
UE4 version 4.7
added AndroidManifest.xml
editing to the Project Settings
.
-
Be sure to enable
Package game data inside apk?
. -
Add the following
intent-filter
entry forExtra Settings for <activity> section
which should fit all on the same line. This allows the game to appear on the mainForge TV
launcher and in theOUYA
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>
Be sure to add the WAKE_LOCK
permission to prevent a screensaver
from displaying while the UE4
game is running.
-
Click the
+
button next toExtra Permissions
to add an element. -
In the new element enter
android.permission.WAKE_LOCK
.