These forums are archival. Please visit us on discord!
I've looked at the issue a couple of times, just haven't sat down to investigate.
My guess is that it's the approximate range calc showing its approximateness. At a few specific angles and displacements it can be simply wrong, but it's probably several orders of magnitude faster than sqrt(a^2+b^2)
Why not use the exact calculation, but just don't sqrt() either side? I mean compare range squared vs. distance squared? That avoids the sqrt() calculation, for better performance.
They doubless already do that elsewhere... the method they use is obviously even cheaper to run...
At a few specific angles and displacements it can be simply wrong, but it's probably several orders of magnitude faster than sqrt(a^2+b^2)
Quote from: RanakastraszThey doubless already do that elsewhere... the method they use is obviously even cheaper to run...Are you sure they already use it? I only suggested this because of Keith's comment:Quote from: keith.lamotheAt a few specific angles and displacements it can be simply wrong, but it's probably several orders of magnitude faster than sqrt(a^2+b^2)Keith is a developer of the game, and he's comparing the not-completely-accurate algorithm they use to the sqrt() algorithm. I want to point out we should be comparing it to the squared function instead, since it's also much faster than the sqrt() algorithm.
Well, AFAIK, Anyone who does distance checking, and is competent, will not use the highly expensive method of taking the square root of a distance unless absolutely necessary