Best way to tween a bullet?

I want a intense focus on performance.

The bullet is composed of 3 attachments and 4 beams, all of which are moved in unison.

All particles are contained inside a single brick located at 0,0,0

Which is better?

  1. TweenService on the bullet
  2. Heartbeat CFrame
  3. Wait() CFrame
  4. RenderStep CFrame
  5. BindToRenderStep CFrame (and if so, please supply which level to bind to)
  6. Other way that is not mentioned here

Right now I plan on using TweenService, but I would like your input. Keep in mind that this server is meant to run over 100 players at once, so I need bullet performance to be as best as Lua can get.

Thoughts?

Edit: Yes I will be sure to only render bullets if they are visible on screen.

1 Like

Never use any form of wait() when trying to tween. It’s inconsistent.

Of your listed methods, TweenService would be the best one, as it’s completely handled C++ side. However, if the bullet is physical, you may want to look into physics based moving, such as VectorForce (I think) and BodyMovers.

Also, just a tip, no need to create a brick at 0,0,0 (assuming that’s relative to the world), workspace.Terrain already extends BasePart with a position of that.

Yep I never use wait() anymore, just wanted to include that as an option so I listed all possible ones.

Additionally, I specifically want as little moving parts as possible, so using moving bullets are a no-go.

The reason I put a part at 0,0,0 is because it essentially allows me to put any number of particles in World Space via their attachments. A light in an attachment at a position of 0,5,3 would literally be at 0,5,3 in the world.

Yeah I understand, but what I was saying is you can put your attachments inside Workspace.Terrain, so you don’t need to make a part at all.

As for the moving parts issue, that’s fine. Use TweenService then.

2 Likes

Lmao school wifi killing me for 15m trying to send this reply

  1. Too taxing on CPU and memory to generate a tween and run it for such a short time per bullet
  2. Heartbeat fires after the frame is rendered. Use RenderStepped for things to show up on the upcoming frame
  3. Wait() falls out of sync with render.
  4. Would be fine for a longer term animation
  5. Yields render thread guranteeing movement but too taxing to bind and unbind to RenderStepped

You can do alot more if your fire rate is generally low, like a games such as Fortnite. (dont kill me for using it as an example) The bullet speed is generally way too fast for the client to render regardless. GTA leaves a bullet trail that fades away quickly, without an actual bullet ever being involved. Phantom Forces doesn’t involve any trail, until a certain range in which you can see a short pink flash, a part representing the bullet.

You mention that this needs to be efficient for the server which is making me worry that you want to animate these bullets serverside. The client should fire the bullet, let the server verify the data without any visual work, and have each client draw the bullet on their own. Damage is the only thing that should be calculated serverside.

2 Likes

I have no clue what all this magic talk is because I don’t have the time to properly read every reply. For now though, I’ll say; if you’re making projectiles, do not use TweenService to move the bullet. Fade sure, move no.

The bullet does not fade and it is technicallly not a physical object, rather a GUI particle.

1 Like

Nevermind. TweenService is :ok_hand:.

Perhaps you should experiment using all of them and go from there.