Animator issue in bullet hell game

Hi, we making multiplayer bullet hell game. There is several bullet patterns or bullet scenarios, dont quite sure how to call it. Here is a quick example:

Bullets are created with Instantiate function and they travels in a strait line. Bullet generator is animated by animator controller for rotation over time left to right. Player standing still. And here is the problem with frames or something. Sometimes for example, player get hit by 10 bullet, sometimes by 11 or 9. The number is not always the same and i think it depends on lag and fps.

How i can make it constant? Even if PC freezes or lags, player will get hit by 10 bullets every time.

Still dont know how to fix this issue. Maybe it is wrong to test games in editor’s play mode? But still, something wrong. Problems with either rotation with aimator or a instantiate function.

First, don’t instantiate your bullets while shooting. Use object pooling. You will cause massive lag.

Second, do not move them by incrementing their transform position, you need to move them using the physics system. They need a rigidbody.

Third, Ez Object Pooling in the asset store is great. Use that for bullets.

1 Like

Additionally, if you want LOTS of bullets, even object pooling isn’t going to help. With a beefy computer I top out at 700 bullets on the screen before things fizzle. I suggest using particles for anything over 400 bullets on the screen at a time.

Thx for the answer.

I dont think it is possible to use particles instead of bullet prefabs. There is several scripts and behaviors attached to bullets and they have their own stats like damage, public variable to explosion prefabs, speed and size buffs etc…

I will try object pooling and physics movement. But the main reason i asked this question is inconstancy. Even if game lagging why bullets does not sync with each other or with framerate? And this lead to the fact that the player receives a different amount of damage each time scene is played.

Like I said, make sure you are moving the bullet using physics and not transforming the position manually.