By: Brian Cannella Andrew McCaffrey Thomas McConlogue.

Post on 26-Dec-2015

223 views 0 download

Tags:

Transcript of By: Brian Cannella Andrew McCaffrey Thomas McConlogue.

By:

Brian Cannella

Andrew McCaffrey

Thomas McConlogue

Alice In Python Land

Table of Contents

• Introduction to Alice

• Creating Simple Worlds

• Scripting (Python)

• Demos

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)

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

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

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

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

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

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.

Creating Simple Worlds In Alice

• How To Create A World In Alice

• Moving And Using Built-In Objects

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

The Camera Window

• This Image Is What Alice Opens Up With

• There Is A Blue Sky• There Is A Green

Earth

Opening A World

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

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

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

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

The Turn Command

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

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

The PointAt Command

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

• The Rabbit Is Now Facing The Helicopter

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

Manipulating Parts

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

Undo Is Your Friend

• The Undo Command Fixes Your Boneheaded Mistakes

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)

Summary Of Direction

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

Summary Of Turn

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

Using the Script Tab

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

single line code.

Making Barney Move

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

Running Barney

Hyperlink to Barney

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)

)

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)

Re-Running Barney

Hyperlink to Barney

Demos of Alice

• Octopus

• Fred’s Head

• Palace