Introduction to Alice
Alice is named in honor of Lewis Carroll’s Alice in Wonderland
1
AliceA modern programming tool
3-D graphics 3-D models of objects
Animation Objects can be made to move around the virtual world (a video game or simulation implemented in 3-D)
Install the software on the CD (or downloaded)
Do a complete install
2
Demo: Getting started
Starting AliceLoad and run a world
AppendixA_FirstWorld.a2w (movie) AppendixA_DancingBee.a2w (interactive)
3
Kinds of Animations
Two kinds of animations:Movie
Passive user watches the animationInteractive
Active user clicks on mouse, types a key on keyboard …Actions of user are called events
4
Demo: A new world
Create a new world File ! New Choose template
5
Demo: Adding objects
6
Techniques and ToolsMouse is used to
approximately position objects in the sceneCamera Navigation is used to
set the camera point of viewDrop-down menu methods are used to
resize objectsmore precisely position objects in the scene
Quadview is used toposition one object relative to another object
7
ObjectsAn "object" is
any thing that can be identified as unique from other things
How is an object unique? has a name has properties:
width, height, color, location can perform actions (methods):
associated actions it can performtasks it can carry out
8
Object PartsObjects may be composed of parts
9
3 Dimensions, 6 DirectionsA 3D object has
3 dimensionsheight, width, depth
6 degrees of freedom (directions of movement)
10
Center of an object(depends on the object!)
At the center of mass
Where it stands on the ground
Where it is held
11
ClassObjects are categorized into classes
Each object is an instance of the class.
Person
Dog
harry
hermione
ron
fang
fluffy
snuffles
12
GalleriesClasses (3D models) are found in the galleries
Local gallery (installed with the software) CD Gallery (only if CD is in the machine) Web gallery
13
Demo: Saving a world
Writing and testing an animation is an intense load on the computing system – a crash can occur.Best solution:
save your world every 15 minutes (Or at least every half hour)
also save to a backup system (for example, a zip disk or memory key)
14
Getting Started With Alice
The secret to getting started is quite simple:
Play!!
15
Animation Programs: Scenarios and Storyboards
Alice
16
Step 1: DesignDecide on the problem to be solved
Often the problem to be solved is given to you by your instructor, team leader, etc.Other times, you get to make it up!Here we will practice both (but emphasize the latter)
Design a solution We will use a storyboard designBreak down a long scenario into sequences of many short scenarios.For each (short) scenario, a story board is created to depict the sequence of scenes.This makes our task easier: short scenarios are easier to implement than long, monolithic ones
17
Step 1: Design Design a solution
We will use a storyboard design technique, commonly used in the film industry
18
ExampleThe scenario is:
Several snow-people are outdoors, on a snow-covered landscape. A snowman is trying to meet a snowwoman who is talking with a group of her friends (other snowwomen.) He says "Ahem" and “blinks” (widens) his eyes, trying to get her attention. The problem is:
How can we create this animation?
19
Create Initial World
20
StoryboardOption 1: Sketches
None
21
StoryboardOption 2: Screen Shots
Initial scene Snowman tries to catch snowwoman’s attention
Snowwoman looks around
22
Storyboard Option 3: Text
Animation Artists sketch their storyboardsYou may not have such expertise, so here is a textual form that can be used:
Do the following actions in order snowman turns to face snowwoman snowman calls out to the snowwoman and “blinks eyes” snowwoman turns around.
This is like a "to-do" list. The Learning to Program in Alice
textbook puts a textual storyboard in a box.
23
Creating An AnimationProgram
Alice
24
Step 2: Implementation
To implement the storyboard, translate the actions in the storyboard to a program.Program (a.k.a. script)
a list of instructions to have the objects perform certain actions in the animation
25
Writing the ProgramOur planned storyboard (to-do list) is:
Do the following actions in order snowman turns to face snowwoman snowman calls out to the snowwoman and “blinks eyes” snowwoman turns around.
The idea now is to translate the design steps to program instructions.
26
Translating the DesignSome steps in the storyboard can be written as a single instruction
The snowman turns to face the snowwomanOther steps are composite actions that require more than one instruction
The snowman tries to catch the snowwoman’s attention is two actions
The snowman says “ahem”The snowman widens his eyes
27
Action Blocks in Alice
Sequential Action Block
Simultaneous Action Block
28
Demo
Ch02Snowpeople
29
Concepts in this first program
Program instructions may have arguments Example: for the resize instruction, the argument we used in this example was
size of the eye (multiply x 2 or 1/2)
DoTogether and DoInOrder blocks can be nested one inside the other
30
TestingAn important step in creating a program is to run it – to be sure it does what you expect it to do.We recommend that you use an incremental development process:
write a few lines of code and then run it write a few more lines and run it write a few more lines and run it…
This process allows you to find any problems and fix them as you go along.
31
Comments
While Alice instructions are easy to understand, a particular combination of the instructions may perform an action that is not immediately obvious. Comments are used to document the code – explain the purpose of a particular segment of the program to the human reader.
32
Demo
Ch02SnowpeoplewithCommentsComments in this example world illustrate
description of the action performed by the entire method description of the purpose of a small segment of code
33