Problem with porting Renpy to Android.

PandaLoverGames

A person who had nothing to "Family Affairs"
Game Developer
Aug 17, 2020
1,150
3,766
Good afternoon.
Such a problem, I want to create an android port game, click build package. In the end, apk files are very small (although the original 750 mb) and when you try to run any of them on my Samsung S7 writes "The application is constantly closing" and it's not working.
Kind, and knowledgeable, people! Help! Can you please tell me what I'm doing wrong?



1598093785614.png 1598093837247.png 1598093878648.png 1598093907967.png 1598094030313.png
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,496
7,074
I'm assuming you already did the "Install SDK and Create Keys" step. Did you do the "Configure" step? "Configure" has to be done before each release, as it sets version numbers and the like.
 

PandaLoverGames

A person who had nothing to "Family Affairs"
Game Developer
Aug 17, 2020
1,150
3,766
I'm assuming you already did the "Install SDK and Create Keys" step. Did you do the "Configure" step? "Configure" has to be done before each release, as it sets version numbers and the like.
Yes, of course. Screenshots 2,3,4 from the "Configure"
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,496
7,074
Yes, of course. Screenshots 2,3,4 from the "Configure"
Ah, ok. Looked at it again, this time with clarity. LOL

Note the "obb" file - that's because you chose the "expansion APK" option. So most of your content went there. This works if you're going to be distributing through sites like Google Play, but not if you're going to give the apk to people to side-load. So, for your purposes, you want to choose "No" on the fourth screen you showed. (Note that it says that this version can be side-loaded.)

The 100 Mb limit mentioned on the first option only applies if you're going to send it via Google Play. For side-loading, that limit doesn't apply - I've distributed Android games that were in the 900 megabyte range built that way, and they work fine.

Also, it will still build four apk files, but you only need to distribute the "universal" one.
 
  • Like
Reactions: anne O'nymous

MilfMaster90

Member
Sep 26, 2017
440
2,153
Guys is it possible to build Android projects that are larger than 2GB ? I get some weird integer too large error when I'm trying to build
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,224
Guys is it possible to build Android projects that are larger than 2GB ? I get some weird integer too large error when I'm trying to build
Well... that sucks ((

Not really.
Most Android devices don't use screen sizes where you'd notice a difference between a 4MB .PNG file -vs- a 800KB .JPG file.
Most > 2GB games are very high quality .PNG files or lots and lots of video content.
So use a tool like Cruncher to reduce the size of the images used by the game so the game is (considerably) smaller than 2GB.
Then build your custom Android build using the much smaller version of the game.

Cruncher works by converting all the images to .webp format at 80% quality. The quality can be altered by editing the command line options within the batch file.

Thankfully, RenPy doesn't care what the file is called. So when cruncher converts everything to .webp it doesn't rename the file. So even though the file might be called "pic1.png", RenPy doesn't care that it's actually a .webp file.

Warning: Don't run this against the only copy of your project. Copy your project and run this against the copy. Cruncher is a destructive process.

Edit:
To give you an idea of the usefulness of Cruncher, I processed a copy of Karlsson's Gambit (v0.3) which currently clocks in at 2.4GB.
It is already pretty image efficient, in so much as it is already using mostly .jpg files rather than .png files.
Taking 1 single image at random, Cruncher converted a 965KB jpg file down to 237KB (~25% of it's original size).

When I ran it, this was the output...
----------------------------------------------------
Summary:

Processed 0 webp, 2064 jpg, 0 jpeg, 0 bmp, and 190 png image files.
Processed 131 mp3, 0 ogg, 0 opus, and 0 wav audio files.
Processed 1 webm, 0 mp4, 0 mkv, 0 m4v, 0 mpg, 0 ogv, and 0 avi video files.
----------------------------------------------------


It took around 19 minutes to turn a 2.4GB game into a 631MB game (~26% of it's original size).
I doubt you could tell the difference on most Android devices between the two versions.

A second attempt using quality 95 instead of 80 resulted in a 1.5GB game. Which would be small enough to build without running into errors (I hope) and without reducing the image quality too much.
 
Last edited:

MilfMaster90

Member
Sep 26, 2017
440
2,153
Not really.
Most Android devices don't use screen sizes where you'd notice a difference between a 4MB .PNG file -vs- a 800KB .JPG file.
Most > 2GB games are very high quality .PNG files or lots and lots of video content.
So use a tool like Cruncher to reduce the size of the images used by the game so the game is (considerably) smaller than 2GB.
Then build your custom Android build using the much smaller version of the game.

Cruncher works by converting all the images to .webp format at 80% quality. The quality can be altered by editing the command line options within the batch file.

Thankfully, RenPy doesn't care what the file is called. So when cruncher converts everything to .webp it doesn't rename the file. So even though the file might be called "pic1.png", RenPy doesn't care that it's actually a .webp file.

Warning: Don't run this against the only copy of your project. Copy your project and run this against the copy. Cruncher is a destructive process.
I tried to split a 6GB renpy game made out of 8 chapters in different games (ch1-3, 4-6, 6-7) and it works but maybe there is a simpler workaround with patch.obb extensions? renpy makes a single main.obb and I think it should be possible without the compression to make large games
 

MilfMaster90

Member
Sep 26, 2017
440
2,153
Not really.
Most Android devices don't use screen sizes where you'd notice a difference between a 4MB .PNG file -vs- a 800KB .JPG file.
Most > 2GB games are very high quality .PNG files or lots and lots of video content.
So use a tool like Cruncher to reduce the size of the images used by the game so the game is (considerably) smaller than 2GB.
Then build your custom Android build using the much smaller version of the game.

Cruncher works by converting all the images to .webp format at 80% quality. The quality can be altered by editing the command line options within the batch file.

Thankfully, RenPy doesn't care what the file is called. So when cruncher converts everything to .webp it doesn't rename the file. So even though the file might be called "pic1.png", RenPy doesn't care that it's actually a .webp file.

Warning: Don't run this against the only copy of your project. Copy your project and run this against the copy. Cruncher is a destructive process.
Forgot to mention that I notice a huge difference on my 12+ inch oled tablet between games with compressed and uncompressed quality. I have 1.5 terrabytes of internal space, storage it's not a issue for me.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,224
Forgot to mention that I notice a huge difference on my 12+ inch oled tablet between games with compressed and uncompressed quality.

Fair enough. I played about 5 minutes of the test game I compressed earlier and barely noticed any difference on my 27" monitor. Perhaps you just have better eyes than me or just higher expectations.

I should say I edited my post to include quantifiable data about the Cruncher compression.

My first attempt at 80% quality reduced a 2.4GB games down to 631MB.
-- 1 specific jpg file I picked at random went from 965KB jpg to 237KB.

My second attempt at 95% quality reduced the same game down to 1.5GB.
-- With that same test file going from 965KB to 571KB.

Perhaps if you can see a noticeable difference at the default (80), then perhaps try 95 instead and see if you can live with the results.


I have 1.5 terrabytes of internal space, storage it's not a issue for me.

Fair enough.

My aim wasn't to actually reduce the size of games to save you space... instead I was pointing out a way to get a game that is potentially too big for an Android build (> 2GB) to be small enough that an version of that same game could be built for Android, albeit at the cost of some time and a slight loss of image quality that may go unnoticed on a lot of Android devices.
 

MilfMaster90

Member
Sep 26, 2017
440
2,153
79flavors -
I'm compressing the game rn, cruncher is a bit slow but the game went from 6+GB to under 2GB. The solution works but the image quality is too low. The method with splitting into multiple games is better for me at the moment but I would like to know how to create main.obb and multiple patch.obb files
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,384
15,291
Edit:
To give you an idea of the usefulness of Cruncher, I processed a copy of Karlsson's Gambit (v0.3) which currently clocks in at 2.4GB.
It is already pretty image efficient, in so much as it is already using mostly .jpg files rather than .png files.
Taking 1 single image at random, Cruncher converted a 965KB jpg file down to 237KB (~25% of it's original size).
Looking at the "compressed version" offered here, some games can goes to 10% of their initial size without a loose that would be noticed on smartphone. What would lead a 2GB game to only take 200MB.
 

recreation

pure evil!
Respected User
Game Developer
Jun 10, 2018
6,278
22,428
My first attempt at 80% quality reduced a 2.4GB games down to 631MB.
-- 1 specific jpg file I picked at random went from 965KB jpg to 237KB.

My second attempt at 95% quality reduced the same game down to 1.5GB.
-- With that same test file going from 965KB to 571KB.
80% is really noticable, yes, I know some people don't seem to notice it, but a lot of people do, even on android phones.
I usually go with 95% because even I don't see much different with this setting anymore (and I'm "trained" to see that stuff).

Looking at the "compressed version" offered here, some games can goes to 10% of their initial size without a loose that would be noticed on smartphone. What would lead a 2GB game to only take 200MB.
Depends on the phone's display and of course the user^^
I noticed compressions quite easily on my older smartphone with 1080p display, now I have one with 4k display and it's even more obvious, some games look outright ugly because of the compression being too high.

But yeah I know I'm a bit of a unicorn when it comes to compression and quality.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,384
15,291
[...] (and I'm "trained" to see that stuff). [...] But yeah I know I'm a bit of a unicorn when it comes to compression and quality.
I knew about drug dogs, but not about compression unicorns :D

More seriously, you're obviously right. Ideally when you start to compress your images, you should do it one by one. You batch proceed our images with many compression factor, then for each image you select the one that look the best, whatever its size.