Sunday, 29 May 2011

Week 14 - Linden Scripting Language

The first thing we did during this lecture is adding all the class mates as friends and we all met in a place called 'Fermi Sandbox'. We went in this place because we have permission to build object in this land; in a sandbox you can build objects freely. Sandboxes are usually cleaned every four hours. There are places where you are not to build objects.

Building Objects in Second Life

As I have mentioned in the previous blog, a prim is a 3D shape which can be linked to form shapes either larger or smaller sizes.

To start building, right click on the ground and select 'Build'. A 'Build Toolbox' will appear on screen and the mouse cursor will be turned into a magic wand so that you can click on the ground and a plywood looking shape will be created. Using this toolbox, you can move the shape, rotate (Ctrl), stretch (Ctrl+Shift) and Select face. You can also do this using the X, Y, Z coordinates found in the 'Object' tab using, 'Position (meters)', 'Size (meters)' and 'Rotation (degrees)'. The material of the object can also be chosen; whether Stone, Metal, Glass, Wood, Flesh, Plastic or Rubber. Various shapes can be chosen; such as Box, Cylinder, Prism, Sphere, Torus, Tube, Ring or Sculpted. In the 'Texture' tab, you can add texture, color, transparency and glow to the object. If you have created multiple objects and would like to join them together, you can use the 'link' tool, either from 'Build -> Link' or using (Ctrl+L).
Build Toolbox
Linden Scripting Language
When scripting in second life, you always have to start with the 'default' keyword. The default word is used to specify the name of the state that the code enclised belongs to. The following is a script that is generated automatically by second life when a new script is created:
1:  default  
2:  {  
3:    state_entry()  
4:    {  
5:      llSay(0, "Hello, Avatar!");  
6:    }  
7:    touch_start(integer total_number)  
8:    {  
9:      llSay(0, "Touched.");  
10:    }  
11:  }  
The state_entry() event takes place each time a new state is entered. Using llSay(), whenever the script is saved or reset, "Hello, Avatar!" will be written in the chat pop up and "Touched" will be written in the chat pop up when touched using touch_start() event.

I modified the above code so that when the object will be touched it will be turned into one colour and when the object is touched again, it will be turned into another colour as shown in lines 1-24.
1:  default  
2:  {  
3:    state_entry()    
4:    {  
5:      llSay(0, "turning on!");  
6:      llSetColor(<1.0, 0.0, 1.0>, ALL_SIDES);  
7:    }  
8:    touch_start(integer total_number)  
9:    {  
10:      state off;  
11:    }  
12:  }  
13:  state off  
14:  {  
15:    state_entry()  
16:    {  
17:      llSay(0, "turning off!");  
18:      llSetColor(<0.0, 1.0, 0.0>, ALL_SIDES);  
19:    }  
20:    touch_start(integer total_number)  
21:    {  
22:      state default;  
23:    }  
24:  }  
In the above code, when the object is turned on, it will turn into pink from all sizes and when the object is turned off, it will turn green.
Object turned off

Object turned on

Conclusion

I also did a but of a research of what can be built in second life. From what I found, you can build anything you want; houses and vehicles such as cars, boats and planes and a script can be attached to a vehicle, to make it move. Something I found interesting is the choice of material; for example the wheels of a car should be made up of glass, because glass is a material with the least friction. I am looking forward for the next lessons to see what more can second life offer.

Sunday, 22 May 2011

Week 13 - Introduction to Second Life

This week a new topic known as 'Second Life' have been introduced in class.

What is Second Life?

Second life is an online virtual world where a user can fly, meet other people and go to various destinations.

Second Life Basics

The following are names that are being used in second life:
  • Sim - Also known as Region is a 256m x 256m area found on the map, running on a simulator. A sim can be broken down into areas which are called 'parcels' and can contain a specific number (usually 15000) of objects, known as 'prims'.
  • Parcel - A parcel is an area of land which will be owned by a user or group, which is a minimum of 16m2 and maximum of 65,536m2, all within one region. Parcels are made up of square blocks measuring 4m x 4m
  • Prim - A prim is a 3D shape which can be linked to form shapes either larger or smaller sizes. Texture, colour and various other attributes can be added to it
  • Estate - is a collection of regions with a particular set of rules being shared
  • Avatar - is a representative of the user in the virtual world

Using Second Life

The first thing I did is downloading the Second Life Viewer. You can download on http://secondlife.com/support/downloads/. Then an account will be created and an Avatar will be chosen. When you log in for the first time you will start on an island called 'Welcome Island'. This island is designed to teach the users the basics of Second Life, such as walking, zooming with the camera, flying, sitting/standing, chatting and teleporting. Once you go to another destination, you cannot teleport back into the 'Welcome Island'.

Second Life Controls

When I logged in for the second time, I chose the 'Advanced mode', so that I can make use of a lot of tools. At the bottom there are the following tools


  • Gesture - In general, a gesture is a sort of non-verbal communication that include movement of the face, hands and other parts of the body. In second life, an avatar can do a lot of gestures such as '/bow', '/clap', '/muscle' and '/laugh'. Gestures can also be written in the chat text box.
  • Move - In the move tool, you can set the avatar into three modes 'Walking Mode', 'Run Mode' and 'Flying Mode'. A shortcut for flying is using the keys 'PgUp' and 'PgDn'.
  • View - The view tool helps the users move the camera around. For example you can zoom in and out and set the camera position to 'Rear View', 'Front View' and 'Size View'.

Teleporting

Another thing which you can do in second life is going from one place to another, known as 'teleport'. To teleport, you can either search for destinations using the keyboard shortcut 'Ctrl + F' or else by going to 'World' -> 'Search'. Apart from this, if you would like your friend to join, you can offer teleport to your friend into that destination.

Destinations Visited

  • Middlesex University
  • The first destination I went after the 'Welcome Island' is 'Middlesex University'. I went to this destination first because I thought that since I'm taking a 'Middlesex University' course, I might meet people that are doing the same module; at first no one was there. When I tried another time, there where people that not only are taking this module, but also are in my class. 
Middlesex University
  • Munich Germany
  • I also visited Munich, the capital city of Bavaria in Germany. Since the city contains alot of buildings and alot of avatars, it took quite some time to load. I was curious if Munich in second life was going to be like the real Munich (as in interesting buildings). I searched for the 'Townhall' and 'Frauenkirche', which are two known buildings. I was surprised when I found them in second life. Another thing I liked in second life is the 'snapshot' tool. Generally when we visit an interesting building we take a picture either of the building alone or of the person in front of the building. In second life you can do this as well; in addition you can fly and take the shot from a different angle.
Munich - Townhall
Munich - Frauenkirche

My Inventory

My Inventory is a place where all my things will be gathered such as clothes, houses, furniture, cars and so on.

My Appearance

In the 'Wearing' tab, everything you are wearing will be shown and the 'My Outfits' tab is used to switch between outfits.

Conclusion

What I liked in second life is that I can go from one place to another, explore new things and meet with various people. I think that in future second life will be used for everything, to learn instead of going to the campus, to meet friends and so on. On the other hand I think that if everything will be through second life, the user will be sitting infront of the PC all day and night and will not continue to explore the real life.