How can I fix inconsistencies and inaccuracies caused by network delays?

So, I have a lot of things in my game, such as projectiles, ray casts, etc. that just don’t ever seem to line up or work properly because certain parts of code will be delayed or fire too late/early.

Two examples here is this explosion appearing before/after the cannon ball collides visually, and this raycast coming from the fishing pole delayed if the player moves at all. I’m not really sure exactly why this happens but I’m assuming its something to do with network lag. I tried setting the network ownership to some of these things to nil but it doesn’t really seem to work?

Here’s the fishing raycast code.

Here’s some of the cannon code.

And the cannon ball.

I’m not sure what’s causing all this delay so I’m not sure what to look for, but the game is pretty janky and sometimes just doesn’t work because of it, so I’m not sure if I’m just doing it all wrong or there’s a fix to this. Any help is appreciated.

I would use fastcast for the cannon, and for the fishing I would do different method

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.