Hello everyone!
Although fireballs are relatively simple to make (object with body velocity and a .Touched event), I was wondering what the best way to handle such an ability would be.
To explain what my problem is, I will use Ryu’s Hadoken, from the Street Fighter series.
So, why is the method I mentioned a problem? First of all, I want to handle the animation on the client as well as having the effect synchronized with the hitbox, for a better feeling. This is something the previously mentioned method can not do.
My guess is that I would have to have a listener in both the client and the server, the former handling the effect and the latter handling an “imaginary” hitbox, of sorts.
Most of my doubts are relative to client - server interactions. Still, I would like to hear your thoughts in this matter. Thank you for reading.
If you want stuff to be synchronized I would suggest using cframe instead of bodyvelocity, that way you know exactly where it will be and how much it will move.
I would have the hit detection be local, combined with sanity checks from the server
The effects should also be created locally to comfirm no latency from the local hitbox then just fire remote to server, and have that fire a remote to every other client to replicate the effect
You could tween it, I was thinking in more of the lines of
Fireball.CFrame = FireBall.CFrame + FireBall.CFrame.LookVector*Speed
and then just have that in a loop until its destroyed
As for how to track on server, you just simulate the projectile without actually needing the fireball model itself, you can do this by passing it the type of projectile, and then the server can determine the speed of the projectile (from a stats module or something similar) and u can get the position of the projectile by passing it and hten doing a simple distance sanity check to see if the fireball can realistically spawn in that spot
If you do the detection on the server, that just means whenever u see a fireball hit on your screen it can sometimes not actually detect on server due to latency for something like guns this would be very noticeable… not to sure about fireballs
Performance wise, its not really a big deal ur just slightly using more server resources