prof. susan rodger computer science dept

32
Creating Animations and 3D Virtual Worlds – Programming for Beginners April 2, 2006 Prof. Susan Rodger Computer Science Dept

Upload: others

Post on 12-Sep-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Prof. Susan Rodger Computer Science Dept

Creating Animations and 3D Virtual Worlds –

Programming for BeginnersApril 2, 2006

Prof. Susan RodgerComputer Science Dept

Page 2: Prof. Susan Rodger Computer Science Dept

What is Computer Science?• Computer science is no more about

computers than astronomy is about telescopes. - Edsger Dijkstra

• Computer science is not as old as physics; it lags by a couple hundred years. However this does not mean that there is significantly less on the computer scientist’s plate than on the physicist’s: younger it may be, but it has had a far more intense upbringing! - Richard Feynman

Page 3: Prof. Susan Rodger Computer Science Dept

Computer Science is a young discipline• First computer science department formed

in 1962

Page 4: Prof. Susan Rodger Computer Science Dept

What is Computer Science?• Artificial Intelligence

Roomba CMU’s Sandstorm

Mars Rover

Page 5: Prof. Susan Rodger Computer Science Dept

What is Computer Science?

• Animation

Page 6: Prof. Susan Rodger Computer Science Dept

What is Computer Science?

• The Organization of Data, and Searching

Page 7: Prof. Susan Rodger Computer Science Dept

What is Computer Science?

• Medicine, Genomics

Page 8: Prof. Susan Rodger Computer Science Dept

What is Computer Science?

• Devices

Page 9: Prof. Susan Rodger Computer Science Dept

Computer Science and Programming

• Computer Science is more than programming– Called Informatics in many countries– Elements of both science and engineering– Elements of math, physics, cognitive science,

music, art, and many other fields• To some programming is an art, to others a

science, to others an engineering discipline.

Page 10: Prof. Susan Rodger Computer Science Dept

Why is Programming Fun?• What delights may its practitioner expect as a

reward– First is the sheer joy of making things.– Second is the pleasure of making things that are

useful.– Third is the fascination of fashioning complex

puzzle-like objects of interlocking moving parts.– Fourth is the joy of always learning.– Finally, there is the delight of working in such a

tractable medium. The programmer, like the poet, works only slightly removed from pure thoughtstuff.

Fred Brooks

Page 11: Prof. Susan Rodger Computer Science Dept

Programming via Animation and 3D Virtual Worlds

• Introduce the programming language Alice– Free at www.alice.org– Taught in CompSci 4 at Duke

• Demos• Hand-on Alice programming

Page 12: Prof. Susan Rodger Computer Science Dept

What Is Alice?

• A modern programming tool– 3-D graphics– 3-D models of objects

• Animation– Objects can be made to move around virtual

world • a story simulation• video game

Page 13: Prof. Susan Rodger Computer Science Dept

What does Alice run on?

• Alice is written in Java – should run on many systems– supports Mac and PC

Page 14: Prof. Susan Rodger Computer Science Dept

Fast Start Up

• Can quickly learn to create– A simple animation in a few minutes– A non-trivial animation in a few class periods

• Can learn to use the Alice interface after a few more class periods

Page 15: Prof. Susan Rodger Computer Science Dept

The Power of Alice

• Automatically keeps track of 3-D objects– What objects are in the virtual world– Types of objects– Positions of objects in the world

Page 16: Prof. Susan Rodger Computer Science Dept

Objects in Alice

• Objects already exist• Objects have parts

Page 17: Prof. Susan Rodger Computer Science Dept

Demo1 – A story

Page 18: Prof. Susan Rodger Computer Science Dept

Demo 2 – Animated Title Slide

Page 19: Prof. Susan Rodger Computer Science Dept

Demos 3 and 4 - Events

Page 20: Prof. Susan Rodger Computer Science Dept

Demo 5 – Binary Code game

• Three digit code – 0 means switch up– 1 means switch down

• Code is randomly generated

• Example: 101• Guess the code by

moving the switches

Page 21: Prof. Susan Rodger Computer Science Dept

Demo 6 – Sorting by heights

Page 22: Prof. Susan Rodger Computer Science Dept

Demo from Scratch: Objects in Alice

• Objects already exist• Objects have parts

Page 23: Prof. Susan Rodger Computer Science Dept

Add Chicken to World

• Click on “add objects”

• Select object from gallery

• Double click on it• It is added to your

world

Page 24: Prof. Susan Rodger Computer Science Dept

Adjust placement of Chicken

• Adjust placement of chicken with controls

• Don’t use copy

• When done, select “Done”

Page 25: Prof. Susan Rodger Computer Science Dept

Program the Chicken• Objects appear in

“Object tree”• Click on Chicken to

program it

• It’s methods (things it can do) appear

• Drag methods over to insert in the program

Page 26: Prof. Susan Rodger Computer Science Dept

Also Drag up Tiles for Ordering commands

• Do together– Put commands to

be done at the same time

• Do in order– List of commands

to be done one at a time

Page 27: Prof. Susan Rodger Computer Science Dept

Program - Chicken

Page 28: Prof. Susan Rodger Computer Science Dept

Adding an Event• Create a new method to

get the bunny to hop

Page 29: Prof. Susan Rodger Computer Science Dept

Attach the method to an Event

• Create an event

• When “up arrow”is pressed, bunny will hop

Page 30: Prof. Susan Rodger Computer Science Dept

Now Your Turn to Experiment• Start Alice

– Click on Alice.exe• Run the Demo worlds (click Play to run)

– lakeSkater – movie– amusementPark – movie– LightDemo – movie– almostAllAboutAlice – movie, click to continue– snowLove – movie, click to continue– flightSimulator – use arrow keys to control

plane through hoops

Page 31: Prof. Susan Rodger Computer Science Dept

Experiment (cont)

• Try to build the chicken and bunny demo• Create your own demo

– Choose objects and place in world– Create a story scene– Create some events

Page 32: Prof. Susan Rodger Computer Science Dept

Thanks for Coming

• Alice is available for free– www.alice.org

• At Duke, Alice is taught in CompSci 4