Jump to content
  • Advertisement
Sign in to follow this  
Kastor372

To Square Root or Not To Square Root

This topic is 2141 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

Another question to ask is if this is really going to be a bottleneck. Lots of times things are compute expensive, but if they are expensive in a section of code that is not performance sensitive then it doesn't really matter.
 
This is for collision detection, but for how many moving objects?  Handling collisions against two or three objects is very different from handling collisions for hundreds or even thousands of objects.  
 
If you are only testing against a few items chances are it doesn't matter which algorithm you pick.


Not to mention, games tend to be graphics card intensive. You should still free up the processor whenever possible, but oftentimes you can get more performance from focusing on things which affect a lot of objects.

Share this post


Link to post
Share on other sites

Thanks alot for all the help, eveytime I come on here with a question I feel like I learn so much more. I had no idea about profiler or Visual VM. Thanks alot! Cant wait to use it :D

Share this post


Link to post
Share on other sites

I also dont want to use another engine just because I want to learn all these things, rather than let my game be ruled by Unity ya no...and I dont have that kinda money to blow :P

Share this post


Link to post
Share on other sites

I also dont want to use another engine just because I want to learn all these things, rather than let my game be ruled by Unity ya no...and I dont have that kinda money to blow :P


Well, making a game for the Wii U requires a $3000 dev kit...

Share this post


Link to post
Share on other sites

Yeah, but that would be after I have it running like silk on my computer first...for free; No? :/


Yeah. Just hope the hardware of your computer is similar or worse to that of the Wii U, for proper testing of just how it would work on Wii U. :)

Nah, actually, just make your game first and if any features need cut, cut them.

I'm going to be making a game for the Wii U, and am also going off-topic. So PM me if you want to discuss any further.

Share this post


Link to post
Share on other sites

An old method which often could be used is comparing the squares  instead of having to go thru with computing the square roots.

 

If basic difference/magnitudes are being sought then that often can be employed.

 

With these one-cylindar cpu handhelds these days, these old tricks become relevant again.

 

--

 

Also (if possible) use the simplest (cheapest computation) to do 'early culling'  where you crudely (but still validly) find out if some calculation is even in the 'ballpark' for consideration or can be thrown out quickly , and then do more extensive processing upon the remaining (hopefully much smaller) data set.

 

Example is doing a 'bounding box check' (if-then difference/delta threshold test of XYZ coords) to cull before doing alot of  higher precision  square root based distance calculations.

Share this post


Link to post
Share on other sites

Yes, it is always good to do a broad phase cull of objects to reject immediately, as long as the broad phase is faster than the narrow phase check you would have to perform later.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!