[Solved] How to use renpy.profile_screen to debug interface lag on Android?

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
henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

[Solved] How to use renpy.profile_screen to debug interface lag on Android?

#1 Post by henvu50 »

EDIT: I figured out the lag problem with my android game. I was using showif and a ton of elif's in the tooltip. The tooltip was part of a global tooltip system. So everytime you tapped any button, it would have to process about 50 showif/elif statements that each have various screens with tons of images. On my modern PC, this wasn't a problem, but on my android phone which is 5 years old, it lagged to all hell. Don't make this mistake! :)

I'm going to document everything I learn about renpy.profile_screen here. My game lags and feels clunky in the navigation, main_menu, game_menu areas on Android. I need to learn how to use profiling to debug lag in these screens. Meanwhile the default game "The Question" runs fast and responsive on Android. I need to find out what I did wrong. I've completely overhauled Ren'py, deviating far outside its norm, treating Ren'py more as Unity or Unreal Engine for the design of a near, full blown game with massive amounts of features and customizations.

I need it to analyze the main_menu, game_menu, navigation and all screens that make up the interface of the main/game menus. I'll update this thread as I progress, if anyone can offer help it would be appreciated.

Okay let's begin. I put this line in init python.

Code: Select all

init python:
   #first i did this,
   #renpy.profile_screen("main_menu", predict=False, show=True, update=True, request=True, time=False, debug=True, const=False)
   # now I'm profiling the preferences screen 
   renpy.profile_screen("preferences", predict=False, show=True, update=True, request=True, time=False, debug=True, const=False)
It outputed profile_screen.txt in the folder just before game folder after I closed the game. Until you close the game, the text file seems to remain at 0 byets. The data doesn't seem helpful so far, but maybe if I compare it against profiling from the game The Question, which doesn't lag on Android?

Now I'm going to set time=True instead of False.

My game.

Code: Select all

SHOW main_menu 02:52:26.247954
* 0.99 ms
UPDATE main_menu 02:52:27.879151
* 9.97 ms
UPDATE main_menu 02:52:28.032335
* 5.98 ms
--------------------
UPDATE preferences 02:57:44.842528
* 6.98 ms
UPDATE preferences 02:57:44.931854
* 1.99 ms
The Question.

Code: Select all

SHOW main_menu 02:49:13.142216
* 0.00 ms
--------------------
UPDATE preferences 02:58:10.935905
* 1.02 ms
So now I know my game does more stuff than the question in the main_menu area, which takes up more time.

Okay, let's see if prediction can help solve my problem. The goal is to have the main_menu, game_menu & any menu screens, before the player starts the game, not lag.

So far, it seems the only real way to figure out what causes the lag is to create a new project, and slowly port over my code to it, then compare slowly, but that's gonna take 3-4 days of dev time, but it seems I have no choice. Uggh, that means I have to customize screen navigation, build then test on android. Customize game_menu, build then test on android. This is going to be painfully slow. Add three images, build then test on android.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]