Exporting for Android Devices
With TyranoPlayer, exporting your game projects to smart devices is now easier than ever. Export your games for release on the Google Play Store!
The two main smartphone platforms, iPhone and iPad (developed by Apple) and Android (Google) are are incompatible, so there is a different process to create applications for each. This tutorial explains the procedure for exporting for Android devices.
· A PC
· Registration on Google Play Store* – costs $25 USD.
* This is optional, as games can be distributed without going through Play Store
That’s it! Just be aware that the software may run slowly on older PCs.
Now let’s take a look at how to create your app.
Install Android Studio
First, install Android Studio on your PC. (Super simple, so we’ll skip to the next step.)
Next, download and unzip the TyranoPlayer standalone version for Android from the following link:
Prepare your Game Project
The process for preparing the game project differs slightly between TyranoBuilder and TyranoScript.
For TyranoBuilder projects:
Click the “Export Game” icon at the top right of the screen.
Then select “Android Application” and export the project. This will create a folder named ‘android_xxxxxxx_xxxxxx’ in your TyranoBuilder projects folder.
In the next step, we’ll use the files in that folder to create the smartphone application.
For TyranoScript projects:
Delete unnecessary files (exe, app, dll etc.) from the project folder.
* Please Note* the following requirements when exporting for Android:
· Do not use Japanese characters in the filenames
· Audio files must be in m4a or mp3 format. ogg is incompatible.
· Video files must be in mp4 format.
Your project may not run if the above points are not followed.
Support for automatically converting file types is currently under development and will be rolled out as soon as possible.
Create the Android Application
Locate the folder called /main/assets/ in the folder of TyranoPlayer standalone version” that we downloaded earlier and copy the files from the android_xxxxxxx_xxxxxx folder we created earlier into this folder. When you’re done, the /main/assets/ folder should contain your index.html file and all other files from the exported project folder.
Next, run Android Studio. Select File → New Project from the menu at the top, enter your project details, and click Next.
On the next screen, under Phone and Tablet, select “API 19: Android 4.4 ( KitKat )” as the Minimum SDK and click Next.
On the following window, select Empty Activity and click Next.
Let’s leave the defaults here and just confirm the following settings:
Activity Name: “MainActivity”
Layout Name: “activity_main”
Press Next, then hit Finish, and Android Studio will build the project info (may take a few minutes.)
When the build is complete, right click on the folder “app”, which will be below your project name at the top left side of the window, then select “Show in Explorer”.
When the folder opens, navigate down to /app/src/, delete the folder /main/ and replace it with the /main/ folder from the TyranoPlayer folder that we prepared earlier.
Check Your the Game
Go back to Android Studio and click the Play button at the top of the screen. (You can also hit Shift+f10 on the keyboard)
If the Play button is faded out you may need to install missing component(s) before being able to hit the play button. To do this, click on the text which says “install missing platform(s) and sync project” at the bottom in the message window to install the required files. You may be missing multiple files and will have to do this a few times.
Select Simulator. If Simulator is not visible, you can add it using AVD Manager.
Press OK and if the game runs, success!
By default a game will timeout if left unattended for a while and this can lead to errors. The solution: remove the timeout.
To do this, open /main/assets/tyrano_player.js with an editor and edit delete everything from setTimeout on line 192.
So how was that? Easy, right?!
Here are a few more tips for your new Android application:
Changing the app name
To change the app name from TyranoPlayerFramwork, go into the App->res->Values->Strings.xml and change the <string name=”app_name”>TyranoPlayerFramework </string> to your preferred name instead.
If you are playing music, you may need to change click=true to click=false to get it to play without requiring the user to tap on the screen in your playbgm tags in the scenario files.
The game doesn’t rotate in the simulator!
Don’t panic! Test it out on an actual phone and you’ll likely find that rotating to landscape works fine.
If you need to post an update, expand the Grade Scripts section and select build.grade file. Add one to the number after versionCode and you should update VersionName to something descriptive (1.1, 1.2, etc). The versionCode should always be whole nubmers, so 1, 2, 3, etc.
There are articles about the above topics readily available on the internet, so please refer to those. We’ve included a couple of links to get your started.
If you have any requests for information to be added to this tutorial, submit a request to the TyranoBuilder discussion group on Steam at the link below.
TyranoBuilder Discussion Group on Steam
Just one more thing…