So I’ve been looking at fps frameworks like FE gun kit and read the code which is alot and looks very complicated but then I see tutorials such as
It seems to be alot easier
So I’d like to know how hard it would be to make one and if anyone could point me to some key things I might want to learn more about to make one.
Depends on how realistic you want it to be as a simple raycast gun with no bullet drop or penetration is very easy to do. As soon as you start adding in realistic ballistics things can get complicated, but it’s mainly about copying different mathematical equations from google and applying it to your system.
(you can always just use a module that does it for you like fastCast)
What sorts of math do I need cause I’ve seen lots of equations involving velocity in the modules I’ve read
Also this is what I’m trying to replicate (it’s a streamable link btw)
You are able to calculate the position of a projectile in motion (bullets with realistic bullet drop) with this handy equation:
Position + (Velocity * Time) + 0.5 * Acceleration * Time * Time
To put in ROBLOX development terms:
OriginalCFrame + ((OriginalCFrame.LookVector.Unit * ProjectileSpeed) * Time) + 0.5 * Vector3.new(0, -workspace.Gravity, 0) * Time * Time
Bind this to a RunService event such as .RenderStepped and use the deltaTime for the time value. ProjectileSpeed is just the number of studs that would be travelled per second.
The reason FE gun kit seems so complicated is because, well, it is, and not in a good way. It is a good idea to split your code into modules for reusability and organization, especially when you have a lot of planned features in mind. Theres no definite way to guess how difficult making your fps framework may be, it really boils down to how you organize your code and avoid spaghetti code that could potentially make the system hard to look at and hard to work off of in the future (FE gun kit)