Better performance on iOS/ Working for multiple resolutions

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Better performance on iOS/ Working for multiple resolutions

#1 Post by Kinmoku »

Hi all,

I'm testing One Night Stand on iPad and iPhone at the moment. It's a universal build. It works great on the iPad Pro, but on my older iPhone 5S, it's running slow, even crashing, on longer sprite animations.

I had this trouble before on older computers, so I reduced the file size of the PNG/ transparent frames considerably, and this seemed to solve the problem. I believe if I can reduce the size of the sprites to match the iPhone 5S, this will improve the performance. The resolution of iPhone 5S is 1136x640, which is considerably smaller than what they are right now (1920x1080). This is great for iPhone 6+, but not so great for older devices which I'd like to support. However, if I reduce the file size of the sprites and assets, that will also reduce it on iPad, which is something I don't want to do. I could split the builds, but this wouldn't look good on newer iPhones either.

Is there a way to use a different set of assets depending on which device you're using? Or to improve performance on the iPhone 5S? I once looked into using movie sprites, but they didn't work the way I wanted them to so this isn't an option for me.

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Better performance on iOS/ Working for multiple resoluti

#2 Post by Kinmoku »

Lil bump. I think I've figured out how to alter the sizes of some of the assets for device https://www.renpy.org/doc/html/screens. ... n-variants

But I'm wondering if there's anything else I could be doing?

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Better performance on iOS/ Working for multiple resoluti

#3 Post by PyTom »

There isn't really anything built into Ren'Py to allow this, sorry.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: Better performance on iOS/ Working for multiple resoluti

#4 Post by xavimat »

I can think of an ugly workaround:
Define your assets with ConditionSwitch, or better using text interpolation in their names.
Use renpy.get_physical_size() to select 'large' or 'small' assets.

I've done an example for the computer, where the screen can be changed, and you can see the variations, changing the size of the window and clicking. In, Android, the "sz/sz2" variables can be defined in default or init, so that variable won't change.

Code: Select all

image test = ConditionSwitch(
    "sz[0] < 1000", Solid("#f00", xysize=(200,500)),
    "True", Solid("#ff0", xysize=(200,500)))

image test2 = "asset_[sz2].png" # put "asset_large.png" and "asset_small.png" in the "images" folder.

default sz2 = 'large'

label start:
    scene black with None
    show test at right
    show test2

    jump start2

label start2:

    $ sz = renpy.get_physical_size()
    if sz[0] < 1000:
        $ sz2 = 'small'
    else:
        $ sz2 = 'large'

    "[sz]"
    jump start2
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Better performance on iOS/ Working for multiple resoluti

#5 Post by Kinmoku »

xavimat wrote:I can think of an ugly workaround:
Define your assets with ConditionSwitch, or better using text interpolation in their names.
Use renpy.get_physical_size() to select 'large' or 'small' assets.

I've done an example for the computer, where the screen can be changed, and you can see the variations, changing the size of the window and clicking. In, Android, the "sz/sz2" variables can be defined in default or init, so that variable won't change.

Code: Select all

image test = ConditionSwitch(
    "sz[0] < 1000", Solid("#f00", xysize=(200,500)),
    "True", Solid("#ff0", xysize=(200,500)))

image test2 = "asset_[sz2].png" # put "asset_large.png" and "asset_small.png" in the "images" folder.

default sz2 = 'large'

label start:
    scene black with None
    show test at right
    show test2

    jump start2

label start2:

    $ sz = renpy.get_physical_size()
    if sz[0] < 1000:
        $ sz2 = 'small'
    else:
        $ sz2 = 'large'

    "[sz]"
    jump start2
I wouldn't say it's ugly, just tricky! There are a lot of assets to deal with, but I think this method may help. I'll test a small part of the game using this and see how I get on. Hopefully the performance will be better :) I'll report back how it goes!

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4084
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: Better performance on iOS/ Working for multiple resoluti

#6 Post by jack_norton »

I have a lot of problems on mobile, and I'm even not using high-res assets. My games (even on desktop) are 1280x720. I have sprites at higher resolution but not more than a texture of 1024px.
I think honestly optimization like this is not worth the time - thanks to the super-fast mobile cycle, those old devices will be obsolete in 3-4 years max (on Apple is even faster since they stop supporting "old" OSes super quickly).
For example when I started doing mobile ports in 2013-2014 on Android the most popular was 2.2-2.3, while now you can safely ignore anything below 4.1 and will work on most devices :)
follow me on Image Image Image
computer games

Post Reply

Who is online

Users browsing this forum: Google [Bot], peach_light