ELI5: Why don't game designers just use real world physics equations in games?

"Checking distance" isn't really the best way to put it maybe? Quad trees are a data structure for the objects themselves.

So because quadtrees are a robust tool and there's way more than "a few" ways to use them to save you work I'm not going to try to give a specific example, I'm just going to give a general ELI5 that will hopefully make sense.

I have a point traveling through space and I want to know what it's going to collide with yeah? For convenience's sake let's say the "point" is YOU and the region it's going through is the earth.

Now checking if you're colliding with every object on earth is VERY hard but it turns out that we've mapped "partitions" onto the earth and we are going to use that to keep us from having to check every single object on earth to see if you're colliding with it.

What the hell does that mean?

  • Are you in the americas, eurasia, or other? Americas
  • Are you in north, central, or south america? North america
  • Are you in Canada, Mexico, or the US? US
  • PST, EST, Other? PST
  • CA, NV+OR, or WA? CA
  • North, south, central? South
  • Greater LA, San Diego, or other? Greater LA...

I'll stop there because this should be enough to illustrate the point without mapping it onto a quadtree function itself. (because there are actually lots of ways you could implement this and I'm trying to describe the general idea of it not a specific implementation)

A quad tree is a structure for partitioning up space that essentially has one goal to be able to answer very general questions about "are you left of that or right of that" or "are you above that or below that"? If you're not familiar with the concept of "bin search" or O(log n) time that doesn't sound amazing so I used a series of similar "which of these 3 are you questions" to make (essentially) "7 very simple comparisons" and determine which city the object was in, eliminating literally 99% of the objects on earth from even having to be considered in collision right?

Getting away from the metaphor, that's the whole point of quad tree. By making a handful of similar "drill down comparisons" for each object in the scene then holding that information basically static and only having to requery when an object is in motion we basically obtain the ability to say "For each object that is in motion, are you hitting this, this or this? (the three "this"s are different for each object of course) then you aren't hitting anything."

/r/explainlikeimfive Thread