I’m currently trying to figure out the best way to create a projectile gun system in ROBLOX.
I’ve heard a very good way to optimize something like this is with multi-threading, Parallel Luau | Documentation - Roblox Creator Hub, is this true? How would this work in the case of the projectile gun system? Is parallel luau only server-sided, so in this case it would only be used for server validation and recreating the path of the bullet really quickly?
What’s the best way to calculate the path for the bullet?
What’s the best way to validate the path on the server?
In which sequence would I see the best results, both performance and visually.
yes. parallel lua is really good for optimizing big systems and its only for server side as u said.
u can start with actors if you’re really keen on optimizing stuff. actors are used to separate parts of your game logic into different threads via the parallel lua which is useful for performance and multi-core CPU utilization.
from client side u can use ViewportPointToRay along with the Activated event to detect hits, send a remote event to the server and from there u can check if the bullet hit the player on the server.
i usually start with client, bullet hit checks, replication of the bullet, physics (aka bullet path) in that order. hopefully it helps