Jump to content

llGetAngetList vs llSensor


Xander Lopez
 Share

You are about to reply to a thread that has been inactive for 209 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Lets say you are scanning for list of avatar keys within 5 meters from you. Would llGetAngentList be better or llSensor would be better? lets assume the sim has 60 people.

I know the fact that llGetAngentList scans for all avatars within the region and you can cherry pick those angels within 5 meters from you.  when there are 60 people within the sim, wouldn't it be faster to just use llSensor?

Link to comment
Share on other sites

llGetAgentList isn't "scanning" anything.  It's just returning a list of all people that the servers know to be in the region.  You then need to filter that list with llGetObjectDetails and OBJECT POS to figure out which ones are within range.  Again, no scanning involved.  At worst, there's a small amount of script time in doing the filtering.  There IS a limit to the number of avatars in the list, though.  I believe it maxes out at 100.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

I think wading through the results of llGetAgentList will always win in performance. A couple of considerations, nonetheless:

  1. llSensor's detections will be sorted nearest-first, so the script could terminate processing when it gets to one that's further away than the radius of interest
  2. llSensor will only ever return 16 detections, if there are more than that in the radius of interest (a very real likelihood in the example of a 5m radius somewhere in a region crowded with 60 avatars), things get very complicated: to be sure the script hasn't missed anybody, it must divide up the sensing arc and repeat until it gets lucky enough that no more than 15 are detected in any of the arcs. This isn't impossible, but it's a pretty advanced algorithm that can involve an unbounded number of attempts.

Although #1 may seem tempting, #2 falls off a cliff of complexity.

  • Like 1
Link to comment
Share on other sites

If it is a one-time use, you can check how many agents are in the sim with llGetRegionAgentCount() and if it is 17 (counting yourself) and under then llSensor() plus llDetectedPos() querying would be faster than looping through llGetAgentList() and querying each key with llGetObjectDetails() and OBJECT_POS.

On 8/30/2020 at 1:01 AM, Wulfie Reanimator said:

The wiki agrees, but what I wonder is what happens when there are more than 100 avatars in a sim? (Since there's a "bonus capacity" for premium users.)

llGetAgentList() just caps at 100. Before skill gaming there used to be a casino with 100+ bots in it that had a 100k+ traffic rating everyday which was the best/only place to test.

  • Confused 1
Link to comment
Share on other sites

  • 3 years later...

GetAgentList allows for more avatars and more control over things like list sorting. In your case, A sensor would probably better since you're wanting to return such AVs in such a limited radius. Otherwise, with llGetAgentList you would have to filter results by distance to check if the AV was within 5 meters of you.

 

Link to comment
Share on other sites

24 minutes ago, Xavier Novelli said:

In your case, A sensor would probably better since you're wanting to return such AVs in such a limited radius.

That's not a good bet. You are trying to guess which of two limits is most likely to give you trouble here.  On the one hand, llGetAgentList has a detection limit of 100 avatars.  On the other hand, llSensor has a limit of 16.  Most regions will never have anywhere near 100 avatars in them, but it's quite possible to have 50 or more, especially in a Linden-sponsored area like SLB or Stop and Shop. When you have that many people, llGetAgentList will still work, but chances are pretty high that there will be at least 16 people close enough to overwhelm llSensor. In general, llSensor is most appropriate for detecting people relatively nearby in a sparsely populated region.  Otherwise, use llGetAgentList and filter the results.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

I mostly find llSensor good for "is there anyone nearby"…  or when you're watching for one specific person.  For much else, that limit it has is woeful.

( Also, good for, "is there NOT anyone nearby"…  don't forget that handy no_sensor event…! )

Edited by Bleuhazenfurfle
Link to comment
Share on other sites

As I think about it, the setup for this thread (lo, three years ago!) was kind of perfect for making the solution not entirely obvious. Sixty avatars spread uniformly around a region would never approach sixteen within a five meter radius, so with that unrealistic assumption, llSensor would be the answer. On the other hand, sixty shopping avatars won't disperse themselves far / fast enough to not exceed sixteen within five meters of a sensor at the landing spot.

I think a case could be made to just fire a five-meter sensor and see the num_detections in the event. If less than 16, stuff them into a list and we're done; if 16, just ignore the sensor results, instead call llGetAgentList and wade through the results.

  • Like 2
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 209 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...