Too many objects affecting game performance

Hello guys,

We got a problem over here. This time, we think that the issue is related to having too many sprites (hexagons) in the same scene. As you can see in the image, the game is experimenting a lot of lag, when we move the mouse to scroll the scene. Any ideas on how to get this fixed? Feel free to ask if you need more info to determine what is causing this.

Thank you in advance! :smiley:

  1. How many hexagons are there in the game?

  2. Are you running any functions on these hexagons every frame (if you are, you certainly should not be)?

There are 5,882 hexagon sprites across the scene. Each hexagon is 19;16. Also, every hexagon has 9 frames with different colors.

Update:

We have carried out a test in which we deactivated all the functions that were related to the hexagons, and fortunately the lag issue has been resolved. However, we need to get back those functions that were deactivated, as those are core features of the game. We will try to activate the functions gradually to see what happens. Please let us know if you have any suggestions on how we could leave our functions intact without affecting game performance. Your help is really appreciated :slight_smile:

Control the functions with bools and/or timers so you only call them when you need them.

Another idea : only process animations changes for visible hexagons.