I am running up to maybe 500+ ~0.4 length raycasts a frame to simulate projectiles and my fps drops pretty quickly. the casts get shot in rings around each projectile so the hits get registered from the edges and not the center.
my machine is not very fast, so I don’t actually know if my game is just heavily unoptimized or if I need to do something about it. I am pretty sure that the only bottleneck is these raycasts since my microprofiler is about 90% Render right now.
Have you looked into parallel scripting; right now all of the raycasts are performed serially which just drags on the frametime. Multithreading the projectile simulator can cut the total time down dramatically
Ask yourself what are the fundamentals of your projectile simulator and what can be changed without taking a toll on gameplay performance and visuals; things such as implementing Level of Detail (raycast less often), frustrum culling (do not render projectiles that are off-screen), frame skipping (literally just make the simulator run less often), expiration time for projectiles (delete them when possible to leviate burden)
Try playtesting your game after publishing it. You’ll need a partial system first.
To get accurate test results, lower your graphics quality all the way. Your PC is most likely not the problem if your FPS drops WAY down. The problem is usually a scripting habit, such as using the 2nd parameter of Instance.new().
forgot about parallel scripts but that definitely seems like the most viable solution; the last three aren’t really applicable and frame skipping is… well I’d rather write parallel code. sigh. thread safety errors here I come.
Exception while signaling: Must be a LuaSourceContainer
Anyways, I did frame skipping in the previous weapon system I made. It worked out really well and I think it’s the proper way to do something like this.
really? I suppose with bullets out of a gun it’s alright, but I neglected to mention in my post that my projectiles are going relatively slowly (think touhou). even with alternating frames I think it’d have a bit of a toll. I think I’ll still up doing it if the parallel stuff pisses me off enough
Good idea, that’s what my system uses. Problem is that it needs to fire a RemoteEvent quite often and that slows the server a bit. It doesn’t matter too much, but it would be better if it was possible to have Client to Client communication.
I actually ran into this today when I was wondering how to replicate an automatic weapon. if it helps, when they begin firing, I shoot a remote with the position, mouse position and rng seed. then every four frames I update the mouse position on other clients. when they stop holding click just shoot another remote.