Actually, that gives me an idea. Up to now I've been filtering the entity list for certain qualities. I haven't, however, tried making a new entity list altogether that has references to the mobs I want to mess with. A good question would be /when/ exactly to make the list, how to update it without writing a bunch of mind numbing code, and manageing two lists with mob info and hoping to keep both in relative sync (make sure global list contains mobs in child list).
That would cut down the number of mobs to cycle through. But, I'm not sure if it'd actually eliminate enough of the problem to make it worthwhile (such as you can flock only 4 mobs before performance goes out the window...).
But, it still hits the fundamental problem of comparing self to others within a subnode. Maybe more complicated searching algorthims (e.g., A* -- it seems pretty popular for strategy games) might be a better approach to searching the list.
There's something on the tip of my tongue ... it's eluding me tonight.
|