BestContainer and NearestChild?

Discussion of Inner Space

Moderators: Lavish Software Team, Moderators

Post Reply
blackwinter
GamingTools Subscriber
Posts: 74
Joined: Sun Jun 25, 2006 8:29 am

BestContainer and NearestChild?

Post by blackwinter » Wed Apr 06, 2011 11:48 pm

Which one is faster??

And how faster?

If BestContainer is better ,I will replace all NearestChild in atom.

blackwinter
GamingTools Subscriber
Posts: 74
Joined: Sun Jun 25, 2006 8:29 am

Post by blackwinter » Wed Apr 06, 2011 11:50 pm

also I wanna know the cpu consume. If BestContainer consume more cpu then it will laggy.

Lax
Owner
Posts: 6634
Joined: Fri Jun 18, 2004 6:08 pm

Post by Lax » Thu Apr 07, 2011 8:48 am

Uh.. they are different things.

BestContainer is going to be far more efficient on average than if you are using NearestChild for the same purpose. BestContainer is designed to take your "best container" from the last frame ("I am contained by region X") along with your new coordinates, and translate that into a new "best container" for the new frame (it is optimized to track your position). The best case for "best container" is when you are standing still -- it can stop immediately. The algorithm and info about it is found here: http://www.lavishsoft.com/wiki/index.ph ... _Container

NearestChild is going to go through every "Child" of some region, and determine which one is nearest to some point. Standing still and performing NearestChild is still going to perform N checks, not 1 as in the "best container" algorithm. In other words, this is not optimized for tracking. This is more appropriate to use when you have a "best container" that is too broad and you want to narrow it by searching for a region that you're not necessarily *contained by*, just nearby to. For example, your "Best container" might be an entire Universe region (if nothing else in the tree contains you).

If you are calling these many times per frame, you should probably find a way to stop doing that ;)

blackwinter
GamingTools Subscriber
Posts: 74
Joined: Sun Jun 25, 2006 8:29 am

Post by blackwinter » Fri Apr 08, 2011 9:53 am

thank you !

Post Reply