#SL Pathfinding API Documentation

Path by richardefreeman Flickr

Rand Linden has been adding information about the Pathfinding API to the SL Wiki. Also, a beta testing page is up in the wiki too. The testing page is incomplete. But, it is looking like we will soon see the new feature arriving in the Preview Grid ADITI.

What It Does

Non-Player Characters (NPC) or Non-Played Character, depending on who one talks to, is what we often call bots. A computer runs them. The SL Wiki has a page on the software that runs bots. See: Second Life Bot Software Comparison.

In addition to the more familiar bots we can have other NPC’s. The Linden Scripting Language (LSL) has a function named llCreateCharacter() that can turn any collection of prims, sculpties, and/or mesh into a NPC. The function is described as: Converts the current linkset to an AI [artificial intelligence] character. By default, the character’s shape will be an upright capsule approximately the size of the linkset, adjustable via the options list. The linkset must use mesh accounting.

A problem one has with an automated bot or NPC is walking it through SL without walking into things. The Pathfinder API is the feature that will allow us to easily teach a NPC how to navigate the Second Life world.

In Myst Online and Ryzom NPC’s where used to provide players help. Zandi was an NPC in Myst Online Uru Live (or Ages Beyond Myst) and the raw materials buyers and mission assigners were NPC’s in Ryzom. Ryzom’s NPC are more like what the Lab seems to be trying for.

Alpha Level

Any Beta level software has known problems and Alpha level even more. The Pathfinding API has a number of problems. I think the problems say lots about how pathfinding can be used.

  • Phantom Prims are seen as barriers. – Your avatar, bot or not, can walk through a phantom prim. However, a NPC cannot. The Lab is classing that as a bug.
  • Water is seen as a barrier/borked. – I suspect this means the barrier doesn’t work well or else water is not supposed see water as a barrier. What’s the point of having NPC’s that are afraid of the water?
  • Saving scripts sometimes doesn’t work – post save the character is frozen. Picking up the object with script running and rezzing makes the character activate. – This would probably be a problem when the region restarts.
  • Can’t set an offset to the vertical height that the object hovers at, or make it lower so that it appears to hug the ground, or move through the ground. In other words pathing is only script modifiable in X and Y coordinates, not Z, but pathing functions in all three coordinates, albeit with Z hugging the terrain or objects it is passing over. – I think they mean the NPC is ignoring changes in elevation. Walk one off a cliff and the walk on air.
  • When creating a fleeing script, has to be set to flee one AV at a time, ideally needs to be possible to flee everyone. – Sounds like an NPC is going to need to run for its life. Probably payback for the rock monsters in Linden Realms.
  • Replacing an existing script doesn’t stop the pathing behavior, in the same way as particles and hover text, use llExecPathingCmd(PATH_CMD_STOP, []) – Once they learn to walk one has to wipe their memory to stop them… doesn’t everyone know you have to shoot zombies in the brain to stop them? Think Walking Dead.
  • Occasionally a script fails with no explanation – no path related elements work but pathing silently fails. Putting the same script contents in another prim works perfectly. – that’s kinda trick. Bet that’s gonna be a PITA to track down.
  • Getting occasional “database content cannot be loaded” error when reopening an existing script. – I’m sure the is PITA for the user but otherwise I’m not sure what’s happening.
    • Need a reproducible case. Server logs seem to indicate something about full parcels which lead to objects going deeply underground.
  • If a targeted agent flies the agent becomes invisible to path script.
    • This doesn’t seem to be always valid: I can be flying near the ground and still be followed. If I fly out of the vertical bounds of the path volume it then loses me.

 The Pathfinding Overview

The wiki page warns that this is the alpha level trial and that things may change. It also explains what navigation type actions you can tell the NPC to take.

  • llEvade() – run from a specified object (garlic?) or avatar.
  • llFleeFrom () – run away from a location.
  • llNavigateTo() – find your way to a given location.
  • llPatrolPoints() – patrol an area based on a list of way points.
  • llPursue() – Pursue an object (?) or avatar. I’m pretty sure this is not a romantic function…
  • llWanderWithin() – Randomly move around a given position and remain within a given distance.

Pathfinding does not animate the object/avatar. Walking animations have to be added via other script commands. I’m unclear whether an avatar controlled by pathfinding would trigger an AO or the standard walk/waddle.

Other functions being provided are;

And there is an event for pathfinding;

Tutorial

The wiki has a page set aside for a tutorial. There is almost nothing on the page. I expect that to change as we get closer to the announced release of the feature.

Summary

Most of this information began appearing on February 14, Valentine’s Day.

Reading through the definitions of the new functions we are getting tells us what we will be able to do. We can walk NPC’s across regions and from region to region.

These new function were probably not used in Linden Realms. I suspect the building of LR revealed how lame our NPC movement has been. So, we are getting some awesome new functions for scripting.

6 thoughts on “#SL Pathfinding API Documentation

  1. Pingback: Pathfinding Moves Closer » Ciaran Laval

  2. Pingback: Pathfinding prepares to blaze a trail on Aditi | Living in the Modem World

  3. Pingback: 2012 Reviewed – January To March » Ciaran Laval

  4. Pingback: 2012 Reviewed – The Full Monty » Ciaran Laval

Leave a Reply to Henry Cancel reply

Your email address will not be published. Required fields are marked *