erisdiscordia February 12, 2021 Building your own Android: A Ren’Py Howto

Login

Building your own Android: A Ren’Py Howto

Greetings devs and aspiring devs! If you’re here and reading this, you likely want to build and release your own Android builds of your Ren’Py game.  Fortunately for you, this is much easier than you’d think it is at first place. Initially it can seem overwhelming when you click on that ‘Android’ option in the Build Distributions menu and see all the choices awaiting you:

Fig. 1 – Ren’Py Main Launcher

But in reality it’s pretty straightforward to set up your build environment for PC, Mac, or Linux systems.  With just a download or two and a couple of configuration tweaks, you too can be up and running making your own Android builds in no time!

Step One: Install Java

So first of all, you will need to have Java working and installed.  For Windows, this can be Oracle’s JDK (Java Development Kit) or OpenJDK, but for certain platforms (macOS) only OpenJDK will work, and on top of it, Oracle has some odd licensing terms for their Java release.  So as a result this tutorial will focus on OpenJDK only.  So to start off, we will need to install the OpenJDK as follows.

Fig. 2 – AdoptOpenJDK Download Screen (macOS Download)

Go to https://adoptopenjdk.net and you’ll see the download options right away. Pictured here is the macOS version, but Windows will look similar. The primary thing to note is that you want to be downloading OpenJDK 8, as this is the version of Java used by the Android build system that comes with Red’Py.  Just click the download, wait for the file to transfer, and install it in whatever way your Operating System handles such things.  You will probably want to reboot afterwards. Then we’re ready to move on to the next step!

Step Two: Install RAPT

The next step is to install the Android Build system for Ren’Py, RAPT.  This is done by selecting ‘Install SDK & Create Keys’ from the Android menu in Ren’Py Launcher.

Fig. 3 – Ren’Py Launcher Android Menu

Once you select this, Ren’Py will check to ensure you have the Java JDK properly installed, and then it will download some needed software by itself.  This may take a little while!  When asked if you wish to create keys, select ‘Yes’ – and make SURE that you back these up, as you may need them in the future.  After you have gone through all this, you will come to a screen that says ‘Information: it Looks like you’re ready to start packaging games’.  That means you’re good to go!

Step Three: Configuring your Game Build

Select the ‘Configure’ option (underneath ‘Install SDK & Create Keys’), and you will be greeted with the following screen:

 Fig. 4 – Ren’Py Android Configure Menu 1

Type the name of your game as you want it to appear to the player.  In this case, I will be calling it ‘A Season of Love’, as that is the name of the game of mine I am building, but you would use whatever the title of your game is.  Click continue afterwards.

You will then be greeted with a screen asking you to choose a ‘Short Name’ for your application.  This can be the same as the name of your game.  See below for an example:

Fig. 5 – Ren’Py Android Configure Menu 2

Click continue and move on to the next step, which is naming the actual Android package.

Fig 6. Ren’Py Android Configure Menu 3

The naming convention for Android applications is com.developername.packagename , so in my case I will use com.erisdicordia (my developer name) .aseasonoflove (the name of my game).  This is how the Android OS itself sorts and handles the name of your game, it is not something the player will generally see.

Next you will be asked the application’s version.  This should match the version number you have saved in Options.rpy in your game folder.  That sections looks like this:

So enter your version number, and click ‘Continue’.

You will then be asked to enter the Version Code.  This is typically similar your version number, but 3 digits.  So 1.0 would be 100, 1.2 would be 102. 2.1 would be 201, and so on.  Enter your Version Code and click ‘Continue’.

Fig. 7 – Orientation Menu

On this next screen, you are asked to select your game Orientation.  You will want to select Landscape, and then click continue. 

Fig. 8 – App Store Menu

You will then be asked which App-Store you wish to support.  You will select ‘Neither’ as neither allow adult content and so users will be manually downloading and installing your game.  On the ‘Would You like to create and expansion APK’ screen, leave it at the default of ‘No’, as the other option requires using Google Play, which we are not doing.

When asked if you wish to allow the app to access the internet, select ‘no’, as this is not needed, and will make users uncomfortable.  No one wants their porn games phoning home.

Users will still be able to click hyperlinks, etc, from within your game, as those will open in their browser, not in your app itself.

Lastly you will come to this screen:

Fig. 9 – Java Source Menu

Simply select yes, the other option deals with scenarios that do not apply to our use-case.

Congratulations, you have fully configured your game for Android building!  We will now move on to the final step.

Step Four: Building your Game for Android

So now we’re ready to build our game for Android.  However, there is one very, very important thing you need to check first.  That being – Android applications have a 1GB size limit (without using work-arounds for external data files, which is not something we want to be messing with at this point).  So check the size of your Ren’Py game folder, make sure that it’s not too huge.  If it’s bigger than 1GB, its likely due to large image or video filesizes.  You may want to use a utility like XnConvert ( https://www.xnview.com/en/xnconvert/ ) to convert images, or HandBrake ( https://handbrake.fr ) to convert videos.  Both of these utilities are free.  For images, the .webp format is recommended, and for videos the .webm format is recommended, as both give very compact file-size while maintaining good quality.  This is actually just a good general practise anyhow to keep your game file-sizes reasonable for any platform.  You probably really shouldn’t be having a 6GB game download every release.

So select the ‘Build Package’ option from the Android menu:

Fig. 10 – Build Package

After you select ‘Build Package’ some automated processes will kick off, and then you will see the following screen for a little while (duration will depend on how big your game is, as Ren’Py assembles and it and packages it up as an Android APK file). Once this is complete, you will see this screen:

 Fig 11 – Gradle Build Screen.

And a File Manager window will pop open and show your four Android APKs.  These match the ones described in the ‘information’ screen.  For simplicity’s sake, you probably only want to distribute the ‘Universal’ version.  It is slightly bigger, but not significantly so, and it will work on any device running Android, regardless of CPU type.

Part Five – The End

Congratulations! You have now successfully built your Ren’Py game for Android, and can distribute it to your players.  There are other quirks / options with Ren’Py games on Android (such as persistent save files), but these are highly tacky, prone to breakage, and outside the scope of this tutorial.  You can find more info on them via online forums for renpy and/or adult games, and they are entirely optional modifications.

One last word of caution – if you are using a current version of Ren’Py (7.4.1 as of the writing of this tutorial), you need to be aware that the new GL2 graphics options will not work on Android devices with versions of Android older than version 4.4., which is from September 2013.  Depending on your player-base, you may wish to forgo using any updated graphical effects in your game, and possibly stick with Ren’Py 7.3.5.

Thats it, and thank you for reading!

Care has been taken to compile this guide. If you spot any mistake, or if anything is unclear feel free to drop a comment below or join us on our Discord server.

Attribution(s)

Photo by Daniel Romero on Unsplash: https://unsplash.com/@rmrdnl

Subscribe
Notify of
guest

4 Comments
Newest
Oldest
Inline Feedbacks
View all comments
Sonny
Sonny
2 years ago

How to create a second persistent save location?
For a user to keep his save files and continue playing when there’s a new version if he deletes the previous version

apphely
2 years ago

I am getting this error in the build package section, what should I do?
“The build seems to have failed.”

Perverteer
Perverteer
2 years ago
Reply to  apphely

Is there any log ouput at the bottom of the screen or anything in the log file? On which platform are you trying to build your project?

apphely
2 years ago
Reply to  Perverteer

First of all, thank you for getting back to me. When I want to make my project android, I get an error in the build package part. The link below is a screenshot of the error.
https://hizli-resim.com/i/OFxqO

You must be logged in to upload content to LewdPixels.com

Login | Register