Fps drops dramatically when more nodes are added

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By escorpolo

Hi, I’m making a 2d puzzle game for mobile, where there is a grid with cells, this grid for each level is drawn at run time, example at level 1 the grid is 5x5, at level 2 the grid is 10x10. Each cell is a node that has a label, an image, a TouchScreenButton, an AnimationPlayer, and 2 panels. The grid is one panel. The problem is that the larger the grid, the slower the game. The fps drops dramatically. Example in android device:

Grid 5x5 = fps 49-50
Grid 10x10 = fps 12-13
Grid 18x18 = fps 3-4

Please I need help, I don’t know how to solve this problem

Maybe something is looping in a node to slow down the game?
Hard to say without any code. If you could upload your game, someone to take a look.

deaton64 | 2020-06-21 10:58

I have no loops that run automatically, that is, nothing that runs in _process or _input functions in the scenes where it fails none of those methods are overwritten. The strangest thing is that I did a test replacing the cell scenes, with only labels, so, when I created the board the problem didn’t happen, I also tried replacing the cells with another scene that represents level buttons, and the problem didn’t happen either, I don’t really know what happens. I don’t know if it’s because of the size of the script that has 143 lines

here my cell scene and Grid Scene

escorpolo | 2020-06-22 00:23

could be… mine is 460 lines, but has timers firing off things.
Like I said. Hard to say without seeing it.

deaton64 | 2020-06-22 17:51

I think I found the error and it’s with the StyleBoxFlat property in CustomStyles, for some reason when you activate this property in a label or panel, it affects the performance of the app in android when you add more than one, in these threads they talk about that:

Polygon2D is extremely slow compared to Sprite rendering
Huge performence drop in Android when using ScrollContainer

escorpolo | 2020-06-22 18:12

Nice one… well done.

deaton64 | 2020-06-22 19:51

Mark as solved?

DDoop | 2020-06-23 00:00