I have been trying and have successfully implemented a slow-motion effect similar to that of the popular game SuperHot, but I have encountered some obstacles that I am struggling to overcome efficiently. Keep in mind that the provided solutions do work, but I’m trying to work on possible optimizations.
To provide some context, my objective is to create a dynamic system where time appears to slow down dramatically when certain events occur such as bullets fired by enemies. I have realized that the approaches I have attempted, involving iteration, recursion, and conditional rendering, might not be the most optimal solutions due to the potential over-time performance impact on the script and the server itself.
Considering the complexity of the problem, I am here for advice on how to approach this challenge effectively. My current approach involves using loops to update the positions of individual bullets, but this approach quickly becomes computationally expensive as the number of bullets and enemies increases. E.g. with just two enemies shooting at the player each releasing at least two bullets every 5 seconds, the number of loops and iterations becomes substantial very quickly. When one bullet enters “slow time,” others should follow suit, leading to even more loops and iterations.
I am fully aware that repeatedly rendering and updating the positions of numerous bullets each frame is (most probably) not the most efficient way to achieve the desired slow-motion effect. Therefore, I am in need of guidance on alternative methods that could help me optimize the process.
I humbly request your advice:
1. Are there alternative approaches or algorithms I could use to minimize the computational burden of rendering and updating bullet positions while maintaining a convincing slow-motion effect?
2. Could you recommend any existing Roblox libraries or resources that specialize in time manipulation effects or provide efficient solutions for similar challenges?
3. Is there a more efficient way to handle the cascading effect of entering slow-motion for multiple bullets once one bullet triggers the time slowdown?
4. Are there any specific Roblox scripting techniques or best practices I should consider when dealing with performance-intensive tasks like this?
I would greatly appreciate any help, advice, or insights you can provide on this matter. I am sorry if I posted in the wrong section, but I saw it fit for here.
Thank you for taking the time to read my request. I look forward to your responses and suggestions. Please feel free to ask for any additional information or clarification if needed.