Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DaZel77 |
Hello, I am trying to make a bullet hell game, and I am calculating the sin(x) of each bullet in every frame to move it. This is causing lag when the number of bullets goes up. I was wondering if anyone has any other strategies for making bullet hell patterns, or if anyone knows how to use the trig functions with less lag. I can put together an example if it is needed, but thanks in advance fr your help!
This really depends on your game and where the bottleneck is (simple sprites usually wouldn’t incur much overhead). Perhaps an alternative is to decouple the calculation from the movement code so it can run in parallel, with the movement code then just using the result.
You might also consider a plugin: GitHub - samdze/godot-native-bullets-plugin: Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more.
spaceyjase | 2023-02-21 11:12
You may like the MultiMesh strategy: https://www.youtube.com/watch?v=-r4o3JWzw4U
TheNormandyProject | 2023-02-21 11:49
@spaceyjase, the plugin you mention isn’t compatible with Godot 4 at time of writing.
TheNormandyProject | 2023-02-21 11:51
Do you think that there would be a noticeable difference using a multimesh over sprites? Right now I am just instancing sprites and using the PhyscisServer2D to move them.
DaZel77 | 2023-02-21 14:48