Jump to content

Animesh Beta testing is HERE!!


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

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

Recommended Posts

3 hours ago, Hadet Sonnenkern said:

Any decent scripted would never script an NPC or Turret system using a sensor it is laggy, and in every way inferior to using AgentList for that sort of thing.

Veering off-topic because it applies equally for Animesh and other scripted items: It's risky to say "never". Sensors are not inherently laggy, and can be more efficient than llGetAgentList() in a busy sim where most avatars spend most of their time outside the script's range of interest (unless that range can be made to correspond to a fixed parcel boundary). That's mostly because list operations are inherently slow in LSL, so there's real cost to stepping through a big list of agents checking their OBJECT_POS, especially if all of them end up irrelevant to the script. (Lists were way worse before Mono, but they're still painfully slow compared to native code.) It can also drive up dynamic memory use because it will return up to 100 avatar keys, whereas a sensor will always cap at the nearest 16 -- especially valuable if you're really just responding to the nearest one, and only if any at all are in range.

Also, for NPCs and other systems that cross region borders, llGetAgentList() stops right at the line (in contrast to sensors that don't respect region boundaries, and llGetObjectDetails() that can see 34m into the next sim). It's certainly possible to share data between scripts across region borders, but that all adds complexity, too.

It may help to realize that sensors and llGetAgentList have a lot in common behind the script library API, so efficiency inside the script drives most of the load.

Edited by Qie Niangao
  • Like 2
Link to comment
Share on other sites

If I know I want my zombies to think about attacking only avatars within 20 metres or so, then I think under most circumstances I'd want to use llSensorRepeat on a slow timer to look for targets.  While I can think of circumstances in which I'd rather use llGetAgentList, I don't think those would be particularly usual in that particular use case.    Whichever way I do it, the simulator ends up doing the calculations, and I think usually it's almost certainly going to be more efficient to have the simulator filter out all avatars more than 20 metres away and then give me llDetectedPos(n) when I want it rather than to have the script tell the simulator to return llGetAgentList and then calculate the positions of everyone on the parcel, rejecting those more than 20 metres away.  

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
You are about to reply to a thread that has been inactive for 2293 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...