Wednesday, August 1, 2007

Real Agents working with virtual spaces

It's been a while since I looked at agents, but I was happy to see that Jade 3.5 had been released. That's actually old news for some. I'm working on a project that embeds a physical space within a virtual 'building', and utilizing the JADE agent framework to tie the virtual and the physical worlds together seems like the ticket.

Anyhow, the things that jumped out at me about 3.5 were the ability to communicate between agents using a pub-sub topic model, and a re-working of the web services integration gateway.

In a previous post, I had talked about a small framework to tie virtual space (in this case Second Life) to external applications. The framework uses sensors (and I'm looking at other means) to detect and inventory objects in the virtual space, and gives the facility to pipe messages to those objects from outside. Yesterday, I used that to create a control panel GUI that can run on a small tablet. This control panel uses the framework to send information into the virtual space, causing alterations to the environment.

Over the weekend, I added the facility to push events out of the virtual space to subscribing listeners. Objects in SL can generate events for touch, creation (on_rez), collision, and so forth. By dropping a script in an object, the framework can trap these events and communicate them to a hub. The hub takes these events and sends them to the framework. Here's a pic where the 'pyramid' is the event generator, and the sphere is the hub. I simply 'touch' the pyramid, and the hub is messaged, sending the event to the framework for dispatching to subscribed listeners.





Below is a shot of the 'touch' event in the framework. There is a facility that inspects events coming out of the virtual space, and compares it to subscribers. A subscriber picks the 'region', or island, the object name, and the desired event. The subscriber also sets up a callback, and receives the paramaters associated with each event. I want to add a more flexible subscription, using regular expressions, etc., but that's more than I need right now. It might also be cool to add the ability to specify a script to run when an event is encountered, but for now it can just callback to a subscriber at a given url. Here's the basics of the event as it arrived to the framework. What's not shown is a generic 'payload' field, where I plan on pushing in the variables associated with each SL event.




At any rate, the 'control panel' I wrote for the tablet uses the ability to push messages into the sim by using a known region and object name. The new addition of the ability to push events out of the virtual space to subscribers is next on the plate, hence the interest in using agents on the 'real life' side. I think topic-based subscriptions on the agent side will help me figure out cool things to do given that I can hook into virtual events, plus it is just plain geek-fun.

The first task will be to have an avatar push a doorbell button in the sim, pick up that event, push it to the agent, and have the agent kick off a real-life doorbell chime. A stupid pet-trick, true, but the point will be to exercise this thing end-to-end, and then I'll have established a workable 2-way bridge to interesting things later. So far, the scripting/framework approach works out. Time will tell how well it scales, how lag-inducing it can be, etc. I've gone the approach of using conservative ping and sense rates, and it's been pretty smooth and stable so far.

Something whack that would be a fun side-project would be to wrap virtual devices with Jini, and have discoverable virtual services under a framework like that. This gets back to an idea I had a while back, using virtual spaces, virtual sensors, virtual actuators, and virtual people, to develop and prototype smart, ambient computing services. Given the collaborative nature of these environments, it might make sense!

No comments: