intro to alice programming: software life cycle general
TRANSCRIPT
Intro to Alice Programming: Software Life Cycle
• General process describing steps used to develop programs:
1. Analyze
– Basic problem-solving
∗ Identifying exactly what the problem is
– Generate program requirements/specifications:
∗ Id input and output
2. Design
– Designing algorithms for various tasks
∗ Algorithm: Sequence of unambiguous steps used to solve a problemin a finite amount of time
· In Alice, this is represented by a story
– Identify program constructs and processing required to solve problem
∗ This where tools like story boards and flow charts are used
3. Implement
1
Intro to Alice Programming: Program Design and Development -Animation/cinematic Hierarchy
• From the perspective of story creation, we can decompose plot using standardcinematic concepts:
1. Action
– Single parameterized change
2. Shot
– Continuous sequence of frames
– Represent single time span, single point of view
– Consist of one or more actions, all shot at same time
– Actions may span several shots
3. Scene
– One or more shots at a single location
– Represent a single topic
4. Sequence
– Group of related scenes that compose a major thematic component
5. Act
– Major cinematic division
– Marked by turning point
6. Play
– Plot carried out from beginning to end
– Intended to be viewed in one sitting
7. Serial
– Set of related plays of similar duration
– Contain common characters, locations, ...
– Plot may extend over multiple plays
2
Intro to Alice Programming: Program Design and Development - Story Boards
• These are a means of representing story development
• There are two kinds:
1. Visual
– Storyboard is essentially an enhanced comic book
∗ Consists of a sequence of illustrated panels
∗ Panels are annotated
∗ May use sheets containing multiple panels, oruse one panel per sheet
∗ Use one or more panels per shot
∗ Panels labeled with scene
∗ Panels numbered as to shot
– 2 general purposes:
(a) Technical: specifies
∗ Actions
∗ Camera actions
∗ ...
(b) Artistic
∗ Mood
∗ Lighting
∗ ”Feel” of shots
∗ ...
3
Intro to Alice Programming: Program Design and Development - StoryBoards (2)
– Examples:
4
Intro to Alice Programming: Program Design and Development - StoryBoards (3)
5
Intro to Alice Programming: Program Design and Development - StoryBoards (4)
– Contents of a storyboard may include
(a) Illustrations
∗ Purpose is to indicate
· Relative positions of characters and props
· Poses
· Camera specs
· ...
∗ Quality of artwork not critical
(b) Actions
∗ Indicated with arrows within the panel
(c) Camera actions
∗ Also indicated using arrows
∗ Appear below or beside panel
∗ Camera has 6 degrees of motion:
· 3 linear (along x, along y, along z)
· 3 rotational (about x, about y, about z)
∗ Linear motion:
i. Dolly - along z
ii. Truck - along x
iii. Boom - along y
∗ Rotational motion:
i. Pan (yaw) - about y
ii. Tilt (pitch) - about x
iii. Roll - about z
∗ Camera may also be zoomed
· Indicated as
2. Textual
– Instead of using pictures, this form simply describes what happens
– The description is in terms of actions that usually are close to the oper-ations available in the programming language being used
6
Intro to Alice Programming: Classes and Objects
• Alice is an object-oriented language
– In object-oriented programming, you start with a class
∗ A class is a template - a description - a blueprint - a model - for creatingsomething
∗ A class is described by a set of prooerties (values) and a set of methods(actions)
– Objects are specific instances of a class
• In a story, objects correspond to nouns and methods to actions
7
Intro to Alice Programming: The IDE
• An Integrated Development Environmet (IDE) is a graphical interface for de-veloping programs
• The following indicates the major components of Alice 3’s IDEThis is the Edit Code perspective
• The language preference should be set to Java
8
Intro to Alice Programming: Programming in Alice
• Programming consists of creating a scene, adding objects to a scene (and settingtheir properties), and adding methods and control structures in the scene editor(by clicking Setup Scene in the Scene Viewer)
• A program is represented by a scene (called this)
• When you start Alice , you will be prompted to select a project (either a newone or one already existing)
9
Intro to Alice Programming: Setting up a scene Alice
• To add objects to the scene, change to the Setup Scene perspective (using theobvious button), and dragging them into the scene from classes
• When adding objects to the scene, Alice will give them default names (basedon the class) that are numbered.
– It is usually advisable to give them unique, meaningful names of your own
– Alice’s naming conventions use camel case:The first letter of each embedded word is capitalized (but not the first forobjects)
• An object’s properties are displayed in a pane to the right
• Objects can be transformed using handles
– Translation (movement along X, Y , and Z axes)
– Rotation (along local X, Y , and Z axes)
– Scaling (change in size)
10
Intro to Alice Programming: Setting up a scene Alice (2)
• An object tree is displayed in the upper left of the Setup Scene perspective
• Every scene has a camera whose controls are at the bottom of the pane
– By default, Setup Scene uses camera view
– This can be changed using the menu in the top center of Setup Scene
– These alternate view are useful for orienting objects wrt each other
11
Intro to Alice Programming: Setting up a scene Alice (3)
• The Rule of Thirds: Impose a 3 X 3 grid on the scene. The main featuresshould line up on the intersections
12
Intro to Alice Programming: Objects
• Each object represents a specific instance of a class
• A class provides a basic set of components for each instance created
– Properties are values that describe the instance
– Methods are actions that an object can take
∗ They implement the behavior of an object
∗ There are two types
· Procedures that produce no value
· Functions that produce a value
∗ Objects interact with each other by sending messages to each other (viamethods)
• Objects inherit the properties and methods of their class and customize theirvalues for that particular object
• Objects consist of a collection of other objects, each of which is an object inits own right
– To access an objects components:
∗ From the object tree (Setup Scene perspective)
∗ From the object drop down menu (Edit Scene perspective)
Select an object and expand using the black expansion arrow (triangle)
13
14
Intro to Alice Programming: Creating a Program
• A program consists of a method that contains a sequence of statements
• Programming in Alice consists of adding statements to methods in the EditCode perspective
• The top-level default method is named myFirstMethod
• A statement is an instruction for the computer to execute
– There are several types:
1. Assignment
2. Method callsSyntax: object name.method name(parameter list)
3. Control
• Adding method calls to a program
– The procedures and functions associated with an object appear in the meth-ods area under the scene viewer in the Edit Code perspective
– They are dragged into the appropriate place in the editing pane
– If a method requires one or more parameters (values), they can be dragged,selected, or typed (depending on the method)
– The add detail button allows you to specify modifiers to the statement
– duration is used to specify how long the action takes
– Note that there is a hierarchy of methods: Those associated with a class,those with an object
15
• Adding control statements to a program
– Control statements (among others) are listed underneath the editing pane
– They are dragged into the appropriate place in the editing pane
– doInOrder() executes its statements sequentially (one after the other)
– doTogether() executes its statements in parallel (all at the same time)
• performCustomSetup is a method that executes before myFirstMethod
– It is used to assign values and perform actions to set up a program beforeit starts running
– It can be added from the Scene tab of the editing pane
• To execute a program, click the Run button
• Don’t forget to save your project
– Alice 3 programs have a file extension of .a3p
16