No matter what I do, I can’t find a way to remove the start lag from projectiles, and trying to find a solution (other posts and tutorials) is more stress inducing and confusing than helpful to me. This is something that has bothered me for a long time and I want to get rid of it now more then ever, as it’s having noticeable effects on the weapons I’m making.
I’m looking for either:
a) a simple, easy to script solution.
or
b) a complex solution, but explained in a simple manner.
I also don’t want links to modules or other resources, as making this myself will give me a better understanding how it works.
This is because of server-client lag, as well as the physics system may be loading in physics for this part.
There’s not really much you can do of this, but you could try->
make the projectile invisible on the client for a portion of a second, then make it invisible. This will make it look smoother, but the actual time to visualize the projectile will take longer.
A similar option to the one before, have an invisible server part, and a part for the client only. The client side will only will make it look smoother.
I’m not sure if this will work, but you could try making a few unanchored parts near where you are spawning the projectile to ready up the physics system?
Set network ownership to the client that is firing. This should make the projectile start in smoother, but only on the client that is firing. Other clients may actually wait longer to see projectile move.
1+2. I don’t want it to look smoother, I want it to be smoother. However, I may use this if I find no other options.
3. I don’t really understand this one.
4. This helped with one of the weapons, but explosives don’t behave properly. (Explosion not positioning where it should)
If your projectiles are created "on demand’, consider using PartCache to recycle their usage from a pool of available ones. This can improve performance.
If that does not help, then you need to start looking at more complex ideas:
Client clicks fire, renders locally generated cosmetic projectile, sends fire pos to server
Server tells other clients to renders locally generated cosmetic projectile.
Server also does hit scan check to see if client projectile would hit anything to deal damage
use instance:SetNetworkOwner(player) to set ownership of instances you create to the player. The server will let the client calculate physics instead, removing client-server lag.