Friday, 25 September 2009

Creating Bots for SL/OpenSim

If you have any exposure to Second Life culture, then you will hear discussions about 'bots' - which are simply avatars controlled by computers, rather than by real human beings. For example, when you perform a search for places in SL, the results are ordered based on traffic, with the places that have had the most visitors listed at the top. Some unscrupulous people used bots to inflate their traffic stats to move up the search list. Also, how do you know that the preset grinding sequence of the SL stripper you just paid was initiated by a person and not a computer? Do you care? Should you care? Why are you there?

Regardless of the controversies, bots are very useful as NPCs. Compared to the alternative on in-world modelled and scripted bots, out-world bots will generally look better (using the avatar mesh and any of the high-quality garments and animations you choose to purchase) and have potentially better AI. I will now share with you the knowledge gained from a brief investigation into how to create these bots, with specific consideration to OpenSim.

Important note: Every bot neads a valid login account.

Easy-Peasy Method:

The Radegast client ( is a non-graphical client for SL. It supports almost everything you might want to do in SL, except look at it, and also includes a built-in AI agent based on A.L.I.C.E. You just turn it on as a setting, and when anyone enters chat nearby that includes the avatar's firstnname (this is very important), then Alice will repond.

I.e. If you log in as Rupert Marmaduke, and somebody says "Hello Rupert Marmaduke" or "Hello Rupert", then they will illicit some suitable response.

For OpenSim, you will need to set a URL and port in order to connect (e.g.

Personalising Radegast (Maybe):

As mentioned the Radegast chat-bot is built upon A.L.I.C.E, which uses aiml definitions. Basically these are xml files, listing patterns (what the user might say) and templates (how the bot might respond). For example:

<pattern>TELL ME ABOUT YOURSELF</pattern>
<template>I am a natural language chatterbot, that talks to people via computer networks such as the Internet.</template>

You can conceivably modify the aiml files that come with Radegast (stored in Program Files\Radegast\aiml) as you see fit. Whatever you put in the template section is regurgitated whenever the pattern is matched. I have not tried this, but I'm 90% sure that it would work.

Getting Complex: OpenMetaverse

If you want to get your hands dirty then you can download a C# library called Open Metaverse - and it is what Radegast was built upon. There are plenty of examples provided, and it is very easy to get an avatar to login and say something (i.e. follow 5 instructions then copy and paste). Capturing the surrounding chat and responding intelligently is obvioulsy the biggest challenge.

By default the library connects to SL, but you can switch to any grid using:

client.Settings.LOGIN_SERVER = "";
Full details are given here:

Monday, 21 September 2009

MCQs in SL

Shown in the video are various options for showing multiple choice questions (MCQs) in SL. The fundamental criteria was that the questions needed to be attached to an object in-world, and so there were 3 main options:
  1. Dialogs: MCQ presented through a series of dialogs. Only a certain amount of text can fit on a dialog button, and so longer options need an ABC-style system.
  2. HUD: Very similar to the dialogs, but allows for 'bigger buttons' to display options.
  3. Website: Displays a website using the in-built browser. In this case the website was made using software called Twine, but any html page would work (including javascript).

The dialog and HUD are roughly equivalent; with the HUD possibly just having the edge since its appearance can be customised, and it doesn't have the button size restrictions. The website option has many advantages, including support for images and larger passages of text, but requires a server somewhere to host the pages, and extra effort in authoring them.

In the video the Dialog questions load slightly faster because they are hard-coded, while the HUD is reading from a notecard. The notecard is the better option because it is easier to produce questions for. The system that I'm using requires lines to start with special characters, as shown below:

*Incorrect option
*Correct option<
*Incorrect option
+Positive feedback
-Negative feedback

I think that this is a fairly straight-forward, human-readable format, so putting together quizes shouldn't be too difficult.

I want to briefly mention Twine, which is a fantastic tool for creating branching scenarios. It was used in the website example to create a linear quiz, but it can be used in much more creative ways. Full details can be found here: