Sprite performance optimization

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

Look at this mess:


Since I’m using SmartShape2D for some of my levels and I want to make a very colorful game, the path and background need to be different colors. The only solution I have is to put a bunch of sprites around the shape, 32x32 textures that are just one color.

In this particular level the performance is terrible. I have about forty sprites around the shape and it gets really laggy in areas. Does anyone know any other solution for this? I can’t even use filled SmartShape2Ds because I need collisions, so any help would be appreciated.

Are those Light2D nodes? Light2D rendering will be slow if large sprites are lit, especially if you have multiple lights. This is because each light causes a new rendering pass to be performed. This is no longer an issue in Godot 4.0 since lighting is single-pass there, but lighting will remain multi-pass in 3.x for technical reasons.

If you’re using Light2D nodes, try increasing Scissor Area Threshold in the Project Settings.

Calinou | 2021-10-17 22:05

OMG you’re my savior, I never would’ve guessed it was because of the lights. Godot has some awesome features coming in 4.0 for 2d, I think I have to wait to make the game I’m working on.

SoMir | 2021-10-20 10:30