How to optimize Bullethell game

Godot Version

4.2.1 Mono

Question

I am making a game like 20 minutes till dawn and I have a question about optimization.
The game does not have as many bullets as possible enemies, that is, the enemies are more).

Having tested the game on different PCs I got the following limits at which to play becomes uncomfortable (<60 fps):
I5 8300H and GTX 1050 - 250 enemies,
I5 10*** and RTX 3060 - 480 enemies,
I5 12***K and RTX 3060 TI - 680 enemies.

I also found that when these entity thresholds are reached, the CPU and video card load is not peak to peak, but much lower.

On a PC with rtx 3060(ti), the load on the GPU is about 5-20 percent and the load on the CPU is about 15%.

On a pc with a GTX 1050 ( my pc :(((( ) the load on the GPU is about 20% and the load on the CPU is about 40%.

Also, RAM consumption on all PCs did not exceed 500MB.

So, I would like to know how I can optimize this kind of game, get tips and help :slight_smile:

Read the Performance section of the documentation Performance — Godot Engine (stable) documentation in English and find out in which ways you can optimize your game.

1 Like

As mentioned, start with the performance documentation and run the profiler to see where things are slow.

In addition, here are some techniques specific to handling thousands of sprites: Can Godot Handle 10,000 Bullets?!

Learn about object pooling in the first instance, because otherwise Garbage Collection is going to kick in and kill your performance.

There’s plenty of resources out there on the subject.

I read and found nothing for me

I know about the object pool, however in my case I don’t need it, my problem comes solely from the enemies. I need a way to optimize them. All I have done now is disable and enable visibility on and off screen.

Sounds like you figured it out then! Would be interesting to understand what is going so wrong with your enemy node implementation as to cause such significant FPS degradation with a not so huge amount of instances.