––– THE SETUP –––––
In my game I have what are effectively ‘heat seeking missiles;’ Parts that target a player, and use an AlignPosition to home in on said player. Gameplay is dependent on the way AlignPosition slings and yo-yo’s these Parts at and around the Player, and is also dependent on the server owning the Part and running the physics calculations.
––– THE PROBLEM ––––––––––
Predictably, this is causing headaches with hit detection:
I’m handling hit detection on the server, and everything works swimmingly… on the server. But, client-side, due to lag, the Player is taking damage and dying long before the Part is visually within collision distance.
––– WHAT I’VE TRIED ––––––––––
If I handle hit detection on the client, client-side the Player only takes damage when they visually come into contact with the Part, which is great, BUT, if the Player is moving --at all-- the Part will never trigger a collision because on the server, when AlignPosition ‘aligns’ the Part with the Player, it stops applying force, slowing the Part to keep pace with the Player… which means due to client-side lag the Part always lingers just outside striking distance, never catching up to the Player.
I also tried creating “echo part” hit boxes that trail the Part by 1/10th of a second (give or take) like a snake, but I just ran into the same issue as above.
––– POTENTIAL SOLUTIONS??? ––––––––––
Has anyone found a reliable way to tackle this issue?
I saw the recent tennis thing that does all manner of motion prediction and timing synchronization, but I have multiple ‘heat seeking’ parts and (ideally) many players in the arena, so I don’t see that solution scaling, let alone being even remotely performant.
I’ve thought about projecting a target spot beyond the Player so the Part stays in motion, placing the Part and Players in different collision groups so they pass through each other, and then using Echo Parts for hit detection, but I worry that won’t scale either.
Is there a way to reduce lag by sending along ONLY the Part’s CFrame?
Is there a way to accurately predict and advance the Part’s position client-side so it appears to the Player as it would on the server?
Have I just painted myself into a corner with no possible exit routes??