mercredi 6 février 2008

SL connects to RL (scripting)

Second Life is a world in itself. A world, what is a world? Something which exists in itself and provides the means for its inhabitants to exist like humans. A world has to have enough variety, being a whole, being “closed” in itself. Being closed means here that things in “the world” stay in this world, it is more or less self contained.
Stay ''mainly'' into itself, because only RL is in this sense a world: we cannot get outside of reality, example: the world of music.
All worlds we make up finally reside in reality somehow. Also Second Life!

Unlike Real Life, this Second Life has connections to another world, outside of it, which is, of course Real Life. Quite a few! Besides its own structure, of rendering, objects and avatars here is input of images, sounds, even video, and on the constructive level of course input of ideas and energy of its residents. What would be SL if there were not any avatars having their proper behaviour, well, we see that sometimes: emptiness, void, silence!
Avatars in this world have motives and are independent of each other.
A drive for a lot of people is the money; Linden money can be exchanged in real money and the other way around, this is a connection too! But for some, money is not everything! Some avatars like to program.
Using the Linden script you can enter information in this 3D world, and get it out again. Not as thoughts or memories, but as real hard data!
Linden script has a special function for this, the httprequest. It is a call to a page on the internet, or a page connected to a server. This is it:

key llHTTPRequest(string url, list parameters, string body)

where url is the web address, parameters can simple be [HTTP_METHOD,"GET"], and the body left empty, that is to say the empty string “”.

This request gives a reply, being the text of the web or php page called back into Second Life as a string, a text, and this response can be monitored by the method

http_response(key request_id, integer status, list metadata, string body)

Well and this server can be connected to other “worlds”. The world of internet for instance. Doing statistics of visitors can be stored on a server. Also a microphone can be installed in SL, recording what has been said in its neighbourhood. This microphone can store the recordings on a server.
Connections to servers can be made from a PC, using progs made for instance in C# (or whatever language also allows to make a http-request, say, FLASH, DIRECTOR). So information retrieved from the server can be stored and used on the PC.
This same PC program can make a Bluetooth connection. These connections have two directions. So a cell-phone can tell something to this PC program, telling it the server, and an object in Second Life can ask the server what happened, so through Bluetooth, PC, and server a Second Life object can be commanded.
The other way around is the second direction:
Some object give information on movement, speed and angle to the server, the server is asked for speed and angle by a PC prog and this prog provides a small robot for motor speed and steering angle using a Bluetooth connection. The small robot being for instance a NXT, the Lego robot. And this all works!



Five March was flying around with a sender and this flying around caused the robot to move!
Very funny, but imagine, sometimes it doesn’t work! What can be the reason? In the end it turned out that quite a few owners of land don’t give permission to run scripts! So the http request doesn’t work, and the robot bumps into a wall!
This robot can be steered also using an in between script called GlovePie with a wii remote control. So this means again that the wii remote control can easily get information into Second Life, moving object.
Connecting worlds is wonderful. It is where the cold technical world becomes social.

Big fun also is: I am writing two blogs, one about the NXT and the other is about Second Life. Now these two blogs have met!

Aucun commentaire: