NPC
From OpenSimulator
Contents |
Introduction
Broadly speaking, there are 3 ways in which Non Player Characters (NPCs) aka bots, can be operated in OpenSim.
1. Client side approaches
For instance, use libopenmetaverse to operate an avatar as if it were being controlled through the viewer.
This wiki does contain some information on how to do this - see
- Building a bot - Getting started with bot design using libomv from the client side
- pCampBot - A facility for stress-testing opensim which can be used as bot example code.
However, better information can be found elsewhere, since this method applies to both Linden Lab and other third party grids.
This is how bots have been traditionally done in SL, since Linden Lab provide no scripting methods for NPCs or direct access to the server software. One advantage of this method, as stated above, is that it can easily be ported between Linden Lab and third party grids, since it only relies on the client interface (leaving aside whether the grid has a policy about allowing bots). It also allows bots to go anywhere and do anything that a human could do, with the right programming. One disadvantage is that it requires user accounts to exist for the bots.
2. osNpc*() scripting functions
OpenSim provides a set of OSSL NPC functions for creating and manipulating bots. Please see OSSLNPC for more details.
One advantage of this approach is that no external client is necessary for a bot, and bot appearances can be saved in OpenSim Archives (OARs). One disadvantage is that there is a much more limited subset of functionality available, since script methods have to be written to control different aspects of an NPC. Also, such bots cannot move out of the region in which they are created.
3. Region Module
In OpenSim, the osNpc*() script methods use the internal NPCModule to actually manage and manipulate bots. Another region module could call the NPCModule methods directly. One advantage of this approach is that bot management may be easier in C# than in LSL/OSSL. One disadvantage is that any change to a region module requires recompilation and restart of the simulator in which it is hosted.