Ways to improve performance?

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:

Ways to improve performance?

#1 Post 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?

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Ways to improve performance?

#2 Post 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.

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: Ways to improve performance?

#3 Post 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.

User avatar
Green Glasses Girl
Veteran
Posts: 367
Joined: Thu Jul 11, 2013 7:16 pm
Projects: Cavaliers & Carnivals
Tumblr: green-glasses
Contact:

Re: Ways to improve performance?

#4 Post 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
Image

Honest Critique
Avatar art by akemicchi.

philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Ways to improve performance?

#5 Post by philat »

This thread also deals with the same issues, although I haven't really tried myself. viewtopic.php?f=8&t=36478

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: Ways to improve performance?

#6 Post 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!

Post Reply

Who is online

Users browsing this forum: Google [Bot]