Page 1 of 1

Ways to improve performance?

Posted: Thu Apr 14, 2016 2:21 am
by Kinmoku
A few players have reported that my game crashes at various points of the game. Mainly, it seems to be when a sound effect plays, but I imagine my animated sprites are hogging a lot of the memory.

Here's an example of the animated sprites... each one of these images is a transparent PNG about 300-400kb in size.

Code: Select all

image robin disagree:
    yanchor 0.0 ypos -0.162
    
    "sprites/disagree_01.png"
    0.1
    "sprites/disagree_02.png"
    0.1
    "sprites/disagree_03.png"
    0.1
    "sprites/disagree_04.png"
    0.1
    "sprites/disagree_05.png"
    0.1
    "sprites/disagree_06.png"
    0.1
    "sprites/disagree_07.png"
    0.1
    "sprites/disagree_08.png"
    0.1
    "sprites/disagree_09.png"
    0.1
    "sprites/disagree_10.png"
    0.1
    "sprites/disagree_11.png"
    0.1
    "sprites/disagree_12.png"
    0.1
    
    block:
        "sprites/disagree_13.png"
        0.1
        "sprites/disagree_14.png"
        0.1
        "sprites/disagree_15.png"
        0.1
        repeat
I wish I could get the file size down but I can't think of a way to do it unless I compromise the quality. I could save them as JPGs with the character on top the the background though. This could work, as the character's only ever on one screen in the center anyway.

I've also added this at the beginning:
init python:
config.image_cache_size = 8
As for sound effects, they vary in size quite a lot... between about 50kb and 800kb. Some sample rates are 44100, others 48000. All are 16bps WAV files.

Any tips?

Re: Ways to improve performance?

Posted: Thu Apr 14, 2016 3:21 am
by SundownKid
Renpy has a new feature for movie sprites that can improve performance.

https://www.renpy.org/doc/html/movie.ht ... ie-sprites

SFX should always be converted into .ogg files. Both to save space and because .ogg is not licensed like .mp3.

Re: Ways to improve performance?

Posted: Thu Apr 14, 2016 8:31 am
by Kinmoku
Ah cool, I didn't know about movie sprites :)

I'll change all the sound effects to ogg too... I forgot about the mp3 license.

Re: Ways to improve performance?

Posted: Fri Apr 22, 2016 10:54 am
by Green Glasses Girl
There's also a thread on optimizing images as well to reduce file size without compromising the quality: viewtopic.php?f=51&t=36378

Re: Ways to improve performance?

Posted: Fri Apr 22, 2016 11:43 am
by philat
This thread also deals with the same issues, although I haven't really tried myself. viewtopic.php?f=8&t=36478

Re: Ways to improve performance?

Posted: Thu Apr 28, 2016 3:55 am
by Kinmoku
philat wrote:This thread also deals with the same issues, although I haven't really tried myself. viewtopic.php?f=8&t=36478
Brill, I'll check this thread out and see if I can do anything further :D Thanks!