Sunday, May 31, 2009

Second Life Written Project

Second Life Written Project

GAME & ANIMATION

Title: Jedi Master – Darth Vader

Teacher: Dr. 梅興




Made By:
Robin 林坤建
495511648
資工三甲
Outline
1. Introduction to Second Life
2. Introduction to Star Wars
3. Connections between SL – SW (Background)
4. How to make it done (Scripting lightsabers)
5. Introductions to Economy in Second Life
6. How to make it done (Scripting the force)
7. Problems met within
8. What to expect in the future


1. Introduction to Second Life
Second Life (SL) is a virtual world developed by Linden Lab. It's almost like Maxis' The Sims, but with online architecture. Although SL can be categorized as an MMORPG, but it's obviously quite different from the likes of WoW, Lineage, etc. There's no leveling inside the SL world. What's most important in the second life concept is to give the users (residents) a second chance to build their lives.

Residents in SL have their own avatar. They can create their own things (or just buy them with the SL world's currency). SL used 3D dimensional modeling tools that were built around simple geometric shapes. If you aware of software like 3dsMax or MAYA, you could also import them to the SL world.

Nowadays, there are branded companies such as IBM, CISCO, Adidas, Sony, Vodafone, etc that mostly share their new concepts in SL world.
To sum everything up, SL is not just a game, but it's a virtual world that could connect to the real world, and maybe in the future, it could change the way of living. Imagine, a CEO that needs to be in two meetings, by using SL, he could just send his avatar to substitute his body.



2. Introduction to Star Wars
Star Wars is an epic space opera franchise initially conceived by George Lucas. The first film in the franchise was simply titled Star Wars, but later had the subtitle Episode IV: A New Hope added to distinguish it from its sequels and prequels. It was originally released on May 25, 1977 by 20th Century Fox, and became a worldwide pop culture phenomenon, spawning two immediate sequels released in three-year intervals. Sixteen years after the release of the trilogy's final film, the first in a new prequel trilogy of films was released, again released in three-year intervals, with the final film released on May 19, 2005.
As of 2008, the overall box office revenue generated by the six Star Wars films has totalled approximately $4.3 billion, making it the third-highest grossing film series, behind only the James Bond and Harry Potter films.
Darth Vader(達斯•維德) who is the third biggest villain movie of all time was a hero before. Lightsaber(光劍) and The Force(原力) was introduced in star wars.


3. Connections between SL – SW (Background)
The Idea is to make something cool between our real life fantasies to be implemented inside our second life (popular culture inside a game). I made homework about lightsabers, so I’m thinking to include it inside the project. Children dream come true… :D

4. How to make it done (Scripting lightsabers)
This script is for the Hilt of Lightsaber. so it could be turned on or off if it's clicked. If the lightsaber is worn, than it will automatically be worn on the right hand. The idea is to throw the part of lightsaber if it's on or off.


integer myswitch;

default
{
state_entry()
{

myswitch=FALSE;
llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );
}

run_time_permissions( integer vBitPermissions )
{
if (PERMISSION_ATTACH & vBitPermissions)
{
llAttachToAvatar( ATTACH_RHAND );
}
else
{
llOwnerSay( "Permission to attach denied" );
}
}

on_rez(integer rez)
{
if(!llGetAttached())
{ //reset the script if it's not attached.
llResetScript();
}
}

attach(key AvatarKey)
{
if(AvatarKey)
{//event is called on both attach and detach, but Key is only valid on attach
integer test = llGetAttached();
if (test) {
llOwnerSay( "May the force be with you" );
} else {
llOwnerSay( "The force is not with you yet");
}
}
}

touch_start(integer total_number)
{
llSetStatus(STATUS_PHYSICS, TRUE);

if(myswitch==FALSE)
{
//Turn saber ON
llMessageLinked(LINK_ALL_CHILDREN, 0, "start", NULL_KEY);
myswitch=TRUE;
}
else
{
//Turn saber OFF
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY);
myswitch=FALSE;
}
}
}


This here is for the lightsaber to play animations on key press. Inside the object, there is choke, stand, slash, backslash and simple slash animation. There're also the sound of opening and closing sound of lightsaber. The llSetPrimitiveParams is used for the lights of the lightsaber. Start when it's on, stop when it's off. We also need permission for keypress and playanimation.

default
{
state_entry()
{
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
}

link_message(integer sender_num, integer num, string str, key id)
{
if(str=="stop")
{
llPlaySound("88a4ff4e-12c7-5679-e349-1a443b333495", 1.0);
llSetTexture("8dcd4a48-2d37-4909-9f78-f7a9eb4ef903", ALL_SIDES);
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
llSay(0, "Force-OFF.");
llReleaseControls();
llStopAnimation("stand");
}
if(str=="start")
{
llPlaySound("4366aeb3-4cbc-2362-0088-68aace7ede28", 1.0);
llSetTexture("59facb66-4a72-40a2-815c-7d9b42c56f60", ALL_SIDES);
llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);
llSay(0, "Force-ON");
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
llStartAnimation("stand");
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TAKE_CONTROLS)
{
llTakeControls(CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT | CONTROL_FWD | CONTROL_BACK, TRUE, FALSE);
}
}

control(key id, integer level, integer edge)
{
integer just_pressed = level & edge;

if (just_pressed & CONTROL_ROT_RIGHT)
{
llSay(0,"slash");
llStopAnimation("slash");
llStartAnimation("simple_slash");
}
else if (just_pressed & CONTROL_ROT_LEFT)
{
llSay(0,"stab");
llStartAnimation("slash");
}
else if (just_pressed & CONTROL_FWD)
{
llSay(0,"back slash");
llStartAnimation("backslash");
}
else if (just_pressed & CONTROL_BACK)
{
llSay(0,"Choke Releaser");
llStopAnimation("choke");
}
}
}



5. Introductions to Economy in Second Life
Second Life has its own currency, which is called Linden Dollar (L$). L$ can be used as a mean of tradings inside the SL world. There‘s also a currency exchange available for L$ as in the First Life (Real World), which is 250L$ for 1USD. 壹元台幣大概吧捌~玖元L$ .


6. How to make it done (Scripting the force)
This here is to make the force on other avatar clicked on the mask. Inside the object, there is choke and forceSTART animation. The idea here is to make a controller of other avatar, like the teleporter. But it's in the mask. we use runtime permission to make it happen.

reset()
{
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}

default
{
state_entry()
{
llSetText("DON'T TOUCH DARTH VADER's MASK", <1,1,1>, 1);
}

touch_start(integer startup_param)
{
reset();
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("choke");
llSay(0,"choked");
llStartAnimation("forceSTART");
}
else
{
llSay(0,"The force is strong with you, But you can't fight Darth Vader!!!");
llStartAnimation("choke");
llStartAnimation("forceSTART");
}
}
}

7. Problems met within
a) The script for the force need to be activated by the user itself
b) We can’t throw parameters to the other script
c) Free animation editor is limited
d) Second life scripting code examples are mostly not open source
e) Limited Money

8. What to expect in the future
a) The real Force
b) Better lightsabers
c) Double Lightsaber (connected)
d) Better animations
e) Force Lightning
f) HUD usage
g) Weapons can be used in the jedi-arena

for the DEMO on youtube, go to part1, part2, and part3

No comments:

Post a Comment