Interactive Systems Class 9. Creature of the week.
-
Upload
della-kelly -
Category
Documents
-
view
214 -
download
0
Transcript of Interactive Systems Class 9. Creature of the week.
![Page 1: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/1.jpg)
Interactive Systems
Class 9
![Page 2: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/2.jpg)
Creature of the week
![Page 3: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/3.jpg)
Outline
What you should know by nowOn wagging tailsNotes on the assignmentSome big ideas – artificial lifeMoving objects in the world, timers,
collision detection
![Page 4: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/4.jpg)
What you should be able to do by now
Rotate an objectCo-ordinate between objects to start
rotationsAnimate an avatar
![Page 5: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/5.jpg)
Hints about wagging tails – problem!
You need to attach the tail to an anchor object which is can rotate around (like a ball and socket joint)
The problem is that once you join the tail to the body, it no longer rotates around the ball and socket
We are looking into this to find a solution and will let you know when we do.
In the mean time if you want to keep working, look into llSetLinkPrimitiveParams(tail_number, [PRIM_ROTATION, r]);
![Page 6: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/6.jpg)
Notes on the assignment
Remember you will be peer reviewing each other's pets next week in the labs. This means two things:
1.You have to have a pet ready to be reviewed. It does NOT need to be finished, but it should be a work in progress
2.You must attend the labs in weeks 10 /11to take part in the peer review, or miss 25% of your assignment mark. 1st year: Fri 21st Nov 3.15 – 5.15pm 2nd year: Tues 25th Nov 2.15 – 4.15pm
![Page 7: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/7.jpg)
A tip
For the assignment, you are expected to do something more than write a couple of lines of code within a function or event.
You should be working on a more complex program: putting the bits and pieces you have learned in lab class into a coherent whole
If this sounds hard, discuss it with the lab helper this week
![Page 8: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/8.jpg)
Interactive behaviour of the pet
40 – 49%. Poor. Pet has major bugs, or is extremely derivative. Limited scripting skills demonstrated (e.g. just basic text output)
50 – 59% Adequate. Pet has at least one interactive behaviour. It demonstrates that basic scripting skills have been learned and used to respond to user input (typed text, or button clicking). Output could be text, sounds or animations.
![Page 9: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/9.jpg)
Interactive behaviour of the pet
60 – 69% Good. Pet demonstrates a couple of interesting behaviours. It can respond to the surroundings and other creatures as well as the user.
70% + Excellent. Exhibit demonstrates a complex behaviour which requires more advanced scripting. For example, it could execute a sequence of behaviour under script control, or behave as a member of a flock.
![Page 10: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/10.jpg)
Artificial Life
“Artificial life (commonly Alife or alife) is a field of study and an associated art form which examine systems related to life, its processes, and its evolution through simulations using computer models, robotics, and biochemistry.[1]” Wikipedia
Strong alife: "life is a process which can be abstracted away from any particular medium" John von Neumann
What do you think about this?
![Page 11: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/11.jpg)
Artificial Life
“(the) law of ``uphill analysis and downhill synthesis'' applies... it's easier to design a mechanism from scratch to do something, than to figure out just how nature has contrived to do it; this suggests that maybe the natural way isn't really insuperably complicated.” Cosma Shalizi
![Page 12: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/12.jpg)
Braitenburg’s Vehicles
An example of behaviour based robotics See http://www.amazon.co.uk/gp/reader/0262521121/ref=sib_dp_pt/277-
3507346-2749668#reader-page
A creature which is afraid of the light:More light produces faster movement. Less light produces slower movement. Darkness produces standstill.
![Page 13: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/13.jpg)
Braitenburg’s Vehicles - example
“This run has three vehicles, each of a different type, and two lamps. Green is the obsessive one. She singlemindedly and frenetically searches for and attempts to ram the nearest and brightest light source, and has no regard for anything else (behaving like Braitenberg's Vehicle 2b). Blue has more self-control and more intelligence. She likes to find a cozy spot near a lamp and settle down, but she will flee if a predator comes too close. Red is the predator; Light doesn't interest her, only the movement of possible prey.”
http://people.cs.uchicago.edu/~wiseman/vehicles/animation-1.mov
![Page 14: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/14.jpg)
Boids
An algorithm used for simulating flocking behaviour
Used in games and 3D animationshttp://www.red3d.com/cwr/boids/Complexity emerges from 3 simple rules:
Separation: steer to avoid crowding local flockmates Alignment: steer towards the average heading of
local flockmates Cohesion: steer to move toward the average position
of local flockmates
![Page 15: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/15.jpg)
Scripting you will learn today
Cookie monster gets hungry again after a bit
Cookie monster grazes for foodCookie monster side-steps round
obstaclesCookie monster mummy and daddy make
babies
![Page 16: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/16.jpg)
Delaying hunger pangs
How would you stop the monster getting hungry as soon as he has eaten?
![Page 17: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/17.jpg)
Delaying hunger pangs
integer hungry = 0;
timer(){
llOwnerSay("Getting hungry again");
hungry =1;
}
eat(){
llOwnerSay("I found a cookie");
llSay(42, "eaten");
hungry = 0;
llOwnerSay("Burp. Not hungry anymore");
//set a timer so he doesn't get hungry for 30 seconds
llSetTimerEvent(15.0);
}
![Page 18: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/18.jpg)
How would you make the cookie monster graze?Monster will sense a cookie and move
towards it. When close enough he will eat it.
Need to use sensor, llTarget and llMoveToTarget
![Page 19: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/19.jpg)
Grazing solution part 1moveToCookie(vector cookiePos){
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
// Ask to be informed when we’re 0.5 metres from cookie
targetID = llTarget(cookiePos, 0.5 );
//start moving to cookie
llMoveToTarget(cookiePos, 0.9);
}
![Page 20: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/20.jpg)
Grazing solution part 2sensor(integer num){
vector targetPos;
targetPos =llDetectedPos(0) + <1.0, 0.0, 0.0>;
if (hungry){
moveToCookie(targetPos);
}
else{
llOwnerSay("Quietly digesting");
}
}
![Page 21: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/21.jpg)
Grazing solution part 3 at_target( integer number, vector targetpos, vector ourpos )
{
llOwnerSay("We've arrived!");
eat();
// Stop moving towards the destination
llStopMoveToTarget();
// Stop notifications of being there or not
llTargetRemove(targetID);
// Become non-physical
llSetStatus(STATUS_PHYSICS, FALSE);
}
![Page 22: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/22.jpg)
Side step to avoid obstacles //we have detected that we have collided, so move out of the way
collision(integer num_detected){
llOwnerSay("Oi!");
vector pos = llGetPos() + <0.0, 2.0, 0.0>;
llSetStatus(STATUS_PHYSICS, TRUE);
llMoveToTarget(pos, 0.2);
}
![Page 23: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/23.jpg)
Mating behaviour //we have detected that we have collided, so move out of the way collision(integer num_detected){ if (llDetectedName(0) == "CookieMonsterGreen"){ breed("green"); } else{
llOwnerSay("Oi!"); vector pos = llGetPos() + <0.0, 2.0, 0.0>; llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(pos, 0.2); }}
![Page 24: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/24.jpg)
Mating behaviour //called under collision detection with another monster
breed(string name){ offset = <0.5, 0.0, 0.0>; vector velocity = <0.0, 0.0, 0.0>; llOwnerSay("Well, hey there gorgeous"); if (name == "green"){ llRezObject("babycookiemonster",
llGetPos() +offset, velocity, ZERO_ROTATION, 1);
}}
![Page 25: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/25.jpg)
Mating behaviour (attached to baby) on_rez(integer startParam) { birth(startParam); }
birth(integer colour){ //mum was blue, dad was green, I should be cyan if (colour == 1){ llSetColor(<0.0, 1.0, 1.0>, ALL_SIDES); llSetLinkColor(LINK_SET, <0.0, 1.0, 1.0>, ALL_SIDES); } }
![Page 26: Interactive Systems Class 9. Creature of the week.](https://reader030.fdocuments.us/reader030/viewer/2022032703/56649d0f5503460f949e50a3/html5/thumbnails/26.jpg)
Homework
Work on your pet so you have something to show your reviewers next week
Finish off previous lab exercises (this will give you practice at writing the kinds of scripts you need for your pets)