33
By: Brian Cannella Andrew McCaffrey Thomas McConlogue

By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Embed Size (px)

Citation preview

Page 1: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

By:

Brian Cannella

Andrew McCaffrey

Thomas McConlogue

Page 2: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Alice In Python Land

Page 3: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Table of Contents

• Introduction to Alice

• Creating Simple Worlds

• Scripting (Python)

• Demos

Page 4: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

What Is Alice?

• Alice is a 3D Interactive Graphics Programming Environment for Windows 95/98/NT

• Alice was constructed by the Stage 3 Research Group at Carnegy Mellon University

• It was originally developed at the University of Virginia

• It was designed to easily make 3D Graphical worlds which can be view through a web browser. (Web browser viewing requires the Alice plugin)

Page 5: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

What Is Alice? (cont.)

• Alice is a scripting language to control 3D objects• Alice in NOT a 3D modeling program• Alice cannot create new 3D object, but it can

import many different types of 3D objects• Alice is based on the Python programming

Language, Microsoft’s Direct 3D Library, and Microsoft’s Visual Basic

Page 6: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

System Requirements

• Windows 95/98 with DirectX or NT 4.0 with Service Pack 3

• A VGA graphics card capable of high (16 bit) color

Page 7: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

System Recommendations

• A Pentium running at 90 Mhz or better• Fast VGA graphics. WRAM is better than VRAM

which is better than DRAM.• 16 megs of RAM• A Soundblaster-compatible sound card

Page 8: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Misc Points

• You don’t need to consider yourself a programmer to be able to use Alice.

• There is a tutorial available on the Alice Website (www.alice.org)

• If you can’t find what you are looking for on the extensive website there is a support staff to answer your questions.

• Alice has an infinite undo routine built in to encourage experimentation

Page 9: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Limitations

• Alice only runs on Windows machines. (It is not Mac or Unix compatable.)

• It does not support OpenGL

• It currently does not support VRML, but it may in the future

• It does not use java except to interface with web browsers

Page 10: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Limitations (cont.)

• Alice does not support POV Ray Files, and has no intent to do so. However, the developers would encourage an eager person to write a module that would.

• Alice cannot create stand-alone applications

• Alice cannot create 3D objects.

Page 11: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Creating Simple Worlds In Alice

• How To Create A World In Alice

• Moving And Using Built-In Objects

Page 12: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

The Alice Control Panel

• This is the Alice Control Panel

• The Different Elements Are Located On The Left

• The World And The Controls Are Located On The Right

Page 13: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

The Camera Window

• This Image Is What Alice Opens Up With

• There Is A Blue Sky• There Is A Green

Earth

Page 14: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Opening A World

• To Load An Existing World, Just Click Open Under File

Page 15: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Inserting An Object

• Select An Object From The List

• With The Mouse Move The Object Around The World

• Objects Can Be Rotated By Selecting The Direction In The Control Panel

Page 16: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Alice Commands

• If The Mouse Is Not Precise Enough For You Use Alice Commands

• bunny.move(forward, 1) Will Move The Bunny Forward One Unit

Page 17: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

More Alice Movement

• bunny.move(back, 1) Will Move The Bunny Backwards

• bunny.move(left, 1) Will Move The Bunny Left

• All Directions Are Relative

Page 18: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

The Turn Command

• bunny.turn(left, 1/4) Will Make The Bunny Do A 1/4 Revolution To The Left

Page 19: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Interaction Between Two Objects

• Adding A Second Object Is As Easy As Adding The First

• Moving Objects Is The Same For Objects Of Different Types

Page 20: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

The PointAt Command

• Using The bunny.pointat(helicopter) Will Cause The Screen On The Right To Occur

• The Rabbit Is Now Facing The Helicopter

Page 21: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Parts Of Objects

• The Bunny Is Actually Not One Object

• The Bunny Is Made Up Of Bunny.Drum, Bunny.Head and Bunny.Body

• These Parts Can Operate Independent Of Each Other

Page 22: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Manipulating Parts

• bunny.head.pointat(helicopter) Will Cause Only The Head Of The Bunny To Turn And Face The Helicopter

Page 23: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Undo Is Your Friend

• The Undo Command Fixes Your Boneheaded Mistakes

Page 24: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Summary Of World Creation

• Commands Follow A Pattern Of object.command(detail, detail)

• Example:– object.move(direction, distance) – object.turn(direction, revolutions)– object.pointat(another_object)

Page 25: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Summary Of Direction

• Objects Can Move In Six Directions– forward – back – left – right – up – down

Page 26: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Summary Of Turn

• Objects Can Turn Four Ways– Forward– Back– Left– Right

Page 27: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Using the Script Tab

• Use this to create more advanced worlds• Use to run blocks of code, instead of

single line code.

Page 28: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Making Barney Move

A short program to show the use of the Script tab in Alice

Page 29: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Running Barney

Hyperlink to Barney

Page 30: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Code to Barney Programlookleft = DoTogether (

purpledinosaur.rightarm.turn(back,.1),

purpledinosaur.leftarm.turn(forward,.05),

purpledinosaur.head.turn(left,.07),

purpledinosaur.rightleg.turn(back,.1),

purpledinosaur.rightleg.foot.turn(right,.2),

purpledinosaur.tail.turn(left,.05),

purpledinosaur.head.righteye.turn(up,.15),

purpledinosaur.head.lefteye.turn(up,.15)

)

centerfromleft = DoTogether (

purpledinosaur.rightarm.turn(forward,.1),

purpledinosaur.leftarm.turn(back, .05),

purpledinosaur.head.turn(right,.07),

purpledinosaur.rightleg.foot.turn(left,.2),

purpledinosaur.rightleg.turn(forward,.1),

purpledinosaur.tail.turn(right,.05),

purpledinosaur.head.righteye.turn(down,.15),

purpledinosaur.head.lefteye.turn(down,.15)

)

lookright = DoTogether (

purpledinosaur.rightarm.turn(forward,.05),

purpledinosaur.leftarm.turn(back, .1),

purpledinosaur.head.turn(right,.07),

purpledinosaur.leftleg.turn(back,.1),

purpledinosaur.leftleg.foot.turn(left,.2),

purpledinosaur.tail.turn(right,.1),

purpledinosaur.head.righteye.turn(left,.1),

purpledinosaur.head.lefteye.turn(left,.1)

)

centerfromright = DoTogether (

purpledinosaur.rightarm.turn(back,.05),

purpledinosaur.leftarm.turn(forward, .1),

purpledinosaur.head.turn(left,.07),

purpledinosaur.leftleg.foot.turn(right,.2),

purpledinosaur.leftleg.turn(forward,.1),

purpledinosaur.tail.turn(left,.1),

purpledinosaur.head.righteye.turn(right,.1),

purpledinosaur.head.lefteye.turn(right,.1)

)

Page 31: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Code To Barney Program

dance = DoInOrder(

lookleft,

centerfromleft,

lookright,

centerfromright

)

dancemany = DoTogether (

Alice.PlaySound('i_love_you_song'),

Loop(dance, 6)

)

diebarney = DoTogether (

Alice.PlaySound('03_start'),

purpledinosaur.destroy(duration=2.5)

)

controls = acontrolpanel(caption="Things Barney Does")

label = controls.makelabel(caption="Click on a button and watch Barney go.")

button = controls.makebutton(caption="Watch Barney Dance",

command = dancemany)

button2 = controls.makebutton(caption="Die Barney Die",

command = diebarney)

Page 32: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Re-Running Barney

Hyperlink to Barney

Page 33: By: Brian Cannella Andrew McCaffrey Thomas McConlogue

Demos of Alice

• Octopus

• Fred’s Head

• Palace