Projectile and client prediction

I’ve been looking for this for a while now and I still do not know how to do this,
I have looked everywhere but I do not understand how I should do it,
I could not find anything regarding this matter on the dev forum and I feel defeated.

Few things I managed to figure out is that

  1. Spawn a projectile localy as soon as the player press a button and tell the server to make a new projectile on their end
  2. Move the server projectile ping seconds to sync with the client’s projectile
  3. You have to rewind the server projectile and all potential targets to check if the projectile hit anyone or anything within the time the projectile was fired and the input was reached to the server

Now that’s cool and all but I have some questions

  1. How often should I record the everyone’s positions for the rewind?
  2. What should the other players see? The exact location of the server projectile? If that’s the case then all the projectile spawned by other players looks like they spawned ahead of them and how should I fix that?

Please please if anyone can tell me or at least point me at the right direction for any information about this matter, please let me know I have a game I want to make and this is the only thing holding me back.


do you want to actually rewind the projectile???
like see the flightpath as some kind of movie??

or are you looking for a decent hit-detection system???
is it for a fast-firing system like a gun?
or something like an arrow?

I just want to know what the projectile hit during the time bitween the input and when the input reached the server

I want to projectile to be as flexiable as possible small, big, fast, slow, gravity, bounce and so on and so forth, I know I need to use some deterministic tregectory and I’m planning to figure out that later and for now I want the collision detection with linear motion

FastCast might have the answers you are looking for.

But fast cast doesn’t have client prediction correct? I tried the template gun that’s provided and the projectiles spawned with a delay

I’m gonna bump this because I’m too desperate

It depends on the type of projectiles you’re working with. If you’re working with bullets that are basically near (or completely) instant, this sort of thing doesn’t matter. You see this in almost every fps game where you hit an enemy but they don’t die because they moved out of the way by the time the server checked the hit. There is another solution, but it can be pretty complicated. If you’re interested, here’s a video covering what’s called Rollback Netcode:

If you’re working with something slower, you can still do everything the same. But I’d recommend sending a global timestamp for then the even was fired. That way the server can sync up based on the time difference, and can also tell other clients the same information so the clients can also catch up and see the same thing at about the same time. That video above is still relevant above regardless of what you’re doing, so I definitely recommend giving it a watch.


So does this mean that I have to rewrite all the code for the player movement from scratch? That’s kinda insane… Although the video was incredibly helpful thank you for sending me it!

1 Like

That’s up to you really. You’ll have to determine is the end result is worth the effort or not. I definitely think it’s beneficial to do and your players will definitely appreciate it (if it works right), but there also aren’t really any games on Roblox doing this right now anyway. Plus again, if you’re working with bullets, this likely isn’t going to do a whole lot.

If you use your other idea of recording everyone’s position, that might help with server-side calculations at least. That might be your better option. Just record everyone’s CFrame and at what timestamp it was recorded at. Then when called to calculate a hit, find which timestamps this new timestamp would be between and do some math to merge both together for that point in time (or just be lazy and pick the closest timestamp), and then due the calculations based off of that. But that doesn’t help with visuals on the original client’s end at all really as the player might not have been there to begin with at that time and was only there due to a larger ping.

This is a somewhat complicated issue that all multiplayer games struggle with, so don’t feel bad if you can’t get it the way you want.


I live in japan so I allways have 200 ping but in games like Phighting and Critical strike unless I’m mistaken, the projectile never seem to spawn out of nowhere (although for critical strike, any fast projectile fired by opponents seem to have incorrect hitbox and I can never dodge them)

I haven’t heard if they do or not. I’d look into it a bit more, but I’m about to get off for the day.
That video and what I’ve said so far is about as much information as I have on this topic. I hope you can find a solution that works best for you :+1:

Either way thank you so much! I wish I could put solution on both of your reponse but I can’t so I’ll put it on the last one

1 Like

I think the one with the video would be better for anyone else looking into this topic. But anyway, you’re welcome and have a good rest of your day

1 Like

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