Alice Introduction to Alice Alice is named in honor of Lewis Carroll s Alice in Wonderland A 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 1 2 Demo: Getting started Starting Alice Load and run a world AppendixA_FirstWorld.a2w (movie) AppendixA_DancingBee.a2w (interactive) Kinds of Animations Two kinds of animations: Movie Passive user watches the animation Interactive Active user clicks on mouse, types a key on keyboard Actions of user are called events 3 4 Demo: A new world Demo: Adding objects Create a new world File! New Choose template 5 6
Techniques and Tools Mouse is used to approximately position objects in the scene Camera Navigation is used to set the camera point of view Drop-down menu methods are used to resize objects more precisely position objects in the scene Quadview is used to position one object relative to another object Objects An "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 perform tasks it can carry out 7 8 Object Parts Objects may be composed of parts 3 Dimensions, 6 Directions A 3D object has 3 dimensions height, width, depth 6 degrees of freedom (directions of movement) 9 10 Center of an object (depends on the object!) At the center of mass Class Objects are categorized into classes harry ron Person Where it stands on the ground hermione Each object is an instance of the class. fang fluffy snuffles Dog Where it is held 11 12
Galleries Classes (3D models) are found in the galleries Local gallery (installed with the software) CD Gallery (only if CD is in the machine) Web gallery 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) 13 14 Getting Started With Alice The secret to getting started is quite simple: Play!! Animation Programs: Scenarios and Storyboards Alice 15 16 Step 1: Design Decide 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 design Break 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 Step 1: Design Design a solution We will use a storyboard design technique, commonly used in the film industry 17 18
The scenario is: Example Several snow-people are outdoors, on a snowcovered 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? Create Initial World 19 20 Storyboard Option 1: Sketches Initial scene Storyboard Option 2: Screen Shots Snowman tries to catch snowwoman s attention Snowwoman looks around None 21 22 Storyboard Option 3: Text Animation Artists sketch their storyboards You 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. Creating An Animation Program Alice This is like a "to-do" list. The Learning to Program in Alice textbook puts a textual storyboard in a box. 23 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 Writing the Program Our 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. 25 26 Translating the Design Some steps in the storyboard can be written as a single instruction The snowman turns to face the snowwoman Other 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 Action Blocks in Alice Sequential Action Block Simultaneous Action Block 27 28 Ch02Snowpeople Demo 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 29 30
Testing An 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. 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. 31 32 Demo Ch02SnowpeoplewithComments Comments 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