We know there are quite a bit of mobile developers who use the Corona SDK to develop mobile applications in Lua, we used it ourselves to make our latest game, infinite
. However, Corona has a few issues, first and foremost, the engine itself is very limiting to the non-enterprise user (which is most of all Corona users
) as without the very expensive enterprise version, you cannot really adapt external API's outside that of which is supported natively by Corona itself.
That being said, Corona itself does not have native support for OUYA. While we've been trying to work with the Corona Team, their "official" support has been set on the back-burner and is not a priority. So, we're taking matters into our own hands and we're putting together code and samples to help the Corona developer get their project running on the OUYA hardware as efficiently as possible.
We hope you find this useful and if you have any special request or suggestions, ask away! We'll be updating this thread with new content or updated code as much as we can.
---Notes: Configuration file to get your game displayed and scaled for HDTV'sBuild Settings
---Notes: Sets your Android permissions and settings (see more permissions, example given in code)
(Code by Red Piston Games
---Notes: Limited controller support (O, U, A, D-Pad, left analog, touchpad are supported) due to lack of external API support of Corona. All credit for this code goes to Red Piston Games who beat us to the punch ;) We compiled a .apk for your convenience.
Overscan Sample Application
---Notes: This is a sample application that showcases an overscan compensation tool that allows you to adjust the screen to avoid overscanning issues. The result will display information (as well as store information in the code so you can use) regarding the correct scale values. This is great to include at the very start (or options menu) of your game.OUYA Pong
---Notes: This is a 1 player sample of Pong in which the player can bounce the ball around the court. There are no victory conditions, nor scores. A simple demo to show how all the sample files work together (excluding the overscan demo). This demo will appear under "Games" on the OUYA.
Tips & Work-arounds
===========================================================Designing Your Graphics
The problem with using Corona SDK on HDTV is that, it's designed around phone screens, so we have to trick it. Normally, you work with a base resolution of 340x480, set image suffix's in the config file and create your images at 1x, 2x or 4x resolution (depending on device). Corona would then read the screen size, check the config file to see what scale the screen lies at, then load the appropriate image set based off the resolution. This is not the case here.
When working on OUYA, Corona will not read the TV screen size, it will however, read the initial video output of the system, which is 1080p. We had a hard time trying to understand why Corona would not read 720p on the system, but it would read it on phones / tablets.
Realistically, we should be able to set our config file to 1280x720, then use suffix's to scale our images [so a scale of 1.5 (1920 / 1280 = 1.5)
]. This will not work due to the issues above. So, we still set our config files to 1280x720, but we create our images to the scale of 1080p. When coding your images, even though they are made for 1080p, we set their resolution manually (using .newImageRect) at the scale of 720p. (eg. I make a banner image at the resolution of 1920x1080 in Photoshop, when I code the image, I state that it is 1280x720. Corona will automatically scale the image to whatever the TV resolution is.Tip: When you make your images with 1080p in mind but you want to know what the resolution is for the 720p scale when you code, just take your actual image dimensions and divide it by 1.5.
Editing The AndroidManifest.XML (Get your game to appear in the 'Games' tab)
Due to the closed nature of Corona SDK, you cannot edit the Android manifest directly. There are some permission settings you can include in the build.settings file, however, the requirements for OUYA will not work there. Instead, we have to decompile our .apk file and manually add it.
1. You'll need to download the APK Manager
and extract the ZIP to your desktop. This will allow us to decompile our .apk. Make sure you have the JAVA JDK
already installed before any of this.
2. Open command prompt (cmd) and type 'java' (without the quotes
) to initiate Java.
3. Open the APK Manager folder. If you do not see folders called "place-apk-here-for-modding", etc. Then run the Setup.bat and run option 3, this will create the folders for you. If you already have the folders, then place your Corona build .apk in the "place-apk-here-for-modding
4. Double click on Script.bat, use option 9 to decompile. This will decompile your app and place it in the folder "projects
5. Open the "projects
" folder and use your favorite editor to edit the AndroidManifest.xml
. You'll want to look for the line "<intent-filter>
". You should see lines below it that say: <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
6. We want to add the following line below them: <category android:name="tv.ouya.intent.category.GAME"/>
*Replace "GAME" with "APP" if you wish to appear under the Apps tab instead of Games.
It should look like this:<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
7. Save the file and return back to the APK Manager. Select option 11 to recompile your .apk with your newly edited manifest. It will ask you if it needs to include other files, press 'n' for no.
8. Once the .apk is recompiled, select option 13 to resign the .apk with the keystore you used to make your app with.
Thats it! Your new .apk is ready and will now show up on the 'Games' tab on the OUYA system.*Please note, this was tested with local builds, however, it should be fine to publish to app stores.*