Will we ever get something that will make magnitude better to use for high player count servers? the current issue with it now is to use it you have to loop through every player making it take longer depending on how many players are in the game. Once a server goes past say 30+ people magnitude starts to become really slow and inaccurate especially on moving targets since there’s such a a delay for it to spawn. Will we ever get something to fix this or is there already?
This might be helpful. All credit goes to @Ozzypig. https://ozzypig.com/2018/09/25/fast-distance-comparison-algorithm/
What is the application? For each application, there is generally a way to make it faster by caching results, using divide and conquer, ext. The unfortunate truth is that writing more performant code takes more thought. The magnitude function itself cannot be sped up, but you can use it less or use different measurements of distance (like distance squared so you don’t have to take a square root),
I use it for combat systems so its going to be used 24/7 in a game that’s why Its bad to make community games that average 30+ players but for open world games high player count makes the map more filled and more action being overall less boring and magnitude is not a good supporter of hitboxes and .touched is even more bad ever since FE
I am very surprised to hear this - you can calculate magnitude tens of thousands of times per second without any problem at all. There is something else slowing your code down!
As for the ‘fast distance comparison algorithm’ mentioned above - this won’t improve your performance from Roblox Lua at all. From some quick tests, it actually looks like it runs a bit more slowly - but that’s beside the point. Your code is being slowed down in some other area than distance checking.