Strategy to optimize performance on a bullet-hell game genre in Roblox

Hello everyone. Currently I am making a game that looks almost like a bullet hell (as in bullet curtain game genre, not gun shooting!). This is also my first time doing this in a multi-player game. (Look up to games like Touhou for a better following on what I said)

What I have prepared so far to make this game:

  • A client-side script to create a bullet on their side to avoid lagging.
  • Some bullet objects stored in ReplicatedStorage
  • An object pool prepared in order to not use Instance.new(“Part”) on every bullet create.
  • A script that manage position of bullets on each frame.

What I have stuck so far:

  • Since these bullets do not move mostly on linear path (ex. their bullet path behavior might change either curve or aim directly at a player on a bezier curve, etc.), a simple Vector cannot be set to these bullets like a gun bullet, instead it might set Vector3 on every set frames. Therefore, I can imagine what the performance will be like when when looping 200+ bullets every frame just to update Vector3 (I might be biased about this).
  • Finding strategy to set Vector3 of these bullets on all clients on their client-side but also sync with everyone and the server without delaying issue (ex. looping Vector3 from server to :FireAllClients(vec3)?)
  • How to achieve hit detection in server without the need of Touched event (I think of raycast, but I have no idea about the approach). There are some threads talking about doing raycast each frame, each bullets but I can’t figure out about that to optimize performance…

I appreciate any suggestion that you guys can give. Thank you!

1 Like

maby use RemoveFunction?

make a invisible bullet use this as the actual bullet to do the calculations and all.
then make one on the client side with all its effects and align them via remote function.

If your bullet paths are all completely deterministic, i.e. there’s no randomness to them, then instead of sending information about each bullet you can just send information about each attack, e.g. there might be a “beam attack 6” that fires 100 bullets in a tight beam, and “death blossom 2” that fires bullets in a spiral or whatever. Then you can generate the actual bullet patterns on each client and they should be kinda in sync

Unfortunately my system at some point that some of the bullet pathway can shift to aim at the player half way on the current path…

So following what you guys said so far, when creating bullet sequence, I should make a Server script that handle the position of all the bullets by using :FireAllClients() on every set frame?

Pretend if 100 bullets on the game moves on 100 different directions, but also moves on a curve path, what should be the correct communication method for this?

Any solution so far? I am still struggling up until now though…