Presentation is loading. Please wait.

Presentation is loading. Please wait.

Interactive Systems Class 9. Creature of the week.

Similar presentations


Presentation on theme: "Interactive Systems Class 9. Creature of the week."— Presentation transcript:

1 Interactive Systems Class 9

2 Creature of the week

3 Outline What you should know by now On wagging tails Notes on the assignment Some big ideas – artificial life Moving objects in the world, timers, collision detection

4 What you should be able to do by now Rotate an object Co-ordinate between objects to start rotations Animate an avatar

5 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]);

6 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.  1 st year: Fri 21 st Nov 3.15 – 5.15pm  2 nd year: Tues 25 th Nov 2.15 – 4.15pm

7 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

8 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.

9 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.

10 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] ” Wikipediasystemslifesimulations computer modelsroboticsbiochemistry [1 Strong alife: "life is a process which can be abstracted away from any particular medium" John von Neumann What do you think about this?

11 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

12 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 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.

13 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/v ehicles/animation-1.mov

14 Boids An algorithm used for simulating flocking behaviour Used in games and 3D animations http://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

15 Scripting you will learn today Cookie monster gets hungry again after a bit Cookie monster grazes for food Cookie monster side-steps round obstacles Cookie monster mummy and daddy make babies

16 Delaying hunger pangs How would you stop the monster getting hungry as soon as he has eaten?

17 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); }

18 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

19 Grazing solution part 1 moveToCookie(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); }

20 Grazing solution part 2 sensor(integer num){ vector targetPos; targetPos =llDetectedPos(0) + ; if (hungry){ moveToCookie(targetPos); } else{ llOwnerSay("Quietly digesting"); } }

21 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); }

22 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() + ; llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(pos, 0.2); }

23 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() + ; llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(pos, 0.2); }

24 Mating behaviour //called under collision detection with another monster breed(string name){ offset = ; vector velocity = ; llOwnerSay("Well, hey there gorgeous"); if (name == "green"){ llRezObject("babycookiemonster", llGetPos() +offset, velocity, ZERO_ROTATION, 1); }

25 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(, ALL_SIDES); llSetLinkColor(LINK_SET,, ALL_SIDES); } }

26 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)


Download ppt "Interactive Systems Class 9. Creature of the week."

Similar presentations


Ads by Google