How to reduce initial projectile lag?

In my game, when I instantiate projectiles, I set all their properties BEFORE parenting them, which USED to work seamlessly, the projectile would spawn and instantly begin moving, but on my recent project which I started about 2 years after the one in which that technique worked, it seems to no longer work, as the projectile will lag for a solid half to full second before moving.

What I tried initially was setting the projectile’s network ownership to the player that created it, but that doesn’t exactly work because many projectiles in the game have scripts inside them that govern the way they behave during physics interactions. This solution works for making it look smooth, but not ACT smooth, an example of this is a pole projectile that has raycast based hit detection to make it instantly stick to any surface it hits. This works seamlessly when network ownership is set to the server, but when set to the client, I believe the server still sees the projectile as a half second behind (because of the initial lag) and as such the projectile will take about a half second to actually register a hit, the projectile basically appears to be a half to full second in front of where the raycast script actually believes it to be, and thus it has this delayed hit effect.

One solution I’ve seen mentioned on the forums is to use remote events to make a projectile on every client, and only on that client, but I’ve tried that exact solution in a past project and it had loads of issues with replication, I ended up dumping way more time into making a bullet simply register a correct hit and administer proper damage than I did working on the rest of the game, besides, the previous solution is so close to working anyway. Is there any sort of way I can eliminate the lag on the server? Why is it happening?

1 Like

I find it much easier to set everything up to be client-side rendered. It looks better for all clients and has no stress on the server which in the long run will give better and faster hit reg. You also negate needing to manage network ownership, and other hacky things that doing it server-side brings.

FPS games, or any game, with server-sided projectiles would be unbearable for anyone with over 100 ping (which is a decent amount of players on Roblox)

Yeah, that’s fair, what’s the easiest way to convert a game from server sided to client sided projectile rendering? Also, this is a question I had back when I was working on a project with client sided projectile rendering, how do you handle players taking damage, do you just have it be purely client sided or use an ID system for the projectiles to manually replicate only once? Which bullet should have priority in an ID system? And how do you get around people with poor ping being able to effectively manipulate client bullets in their favor?

Take this with a grain of salt since I don’t have much experience working with projectiles: have you considered ‘predicting’ how the projectile will behave on the client? (i.e instant hit with raycasting), and then on the server-side, perform the actual physics calculations (and if there’s a discrepancy between the server and the client, adjust the position and properties accordingly)