Está en la página 1de 26

Mr.

Giansante

Alice
3D Programming

February 2009
Table of Contents
Learning Outcomes .................................................. 3
NETS Standards for Students .................................. 4 PRINTING
What is Alice? ........................................................... 5
The Alice Environment ............................................. 6 Please consider the
Tutorials .................................................................... 7
environment before printing
anything from this document.
Example Worlds ....................................................... 8
Methods and Events ................................................. 9 Pages that need to be printed
Kangaroo Program ................................................. 10
are marked with a printer icon.

Continuous Motion .................................................. 11


Shark Program ....................................................... 12
Detecting Collisions with the Ground ..................... 16
Sample Programs ................................................... 17 Assignments

Posting on YouTube ............................................... 17 Assignment 1: 20 Second World ............................ 23


Animating Character Motion ................................... 18 Assignment 2: Interactive World ............................ 24
Elements of Game Design...................................... 19 Assignment 3: Three-Minute World........................ 25
Storyboards ............................................................ 20 Assignment 4: Large Interactive World .................. 26
Storyboard Example ............................................... 21
Storyboard Template .............................................. 22 Note: Students will choose either
assignment 3 or assignment 4.

Mr. Giansante 3D Programming with Alice - Table of Contents


Learning Outcomes
The student will ...

General

Demonstrate proper care of all computer equipment


Demonstrate positive attitudes and work habits
Demonstrate interpersonal and organizational skills
Demonstrate Problem Solving Skills
Make Productive Use of Time
Demonstrate independence skills and only seek help when necessary

The Alice Environment

Place objects into the Alice World


Change properties of the World
Manipulate objects (size, orientation) at design time
Use the Object Tree to select objects
Use the Details Area to manipulate properties
Use simple methods such as Move and Turn
Use decision statements such as If-Else
Use repetition structures such as Loop, Do Together and While
Play a World
Export a World to YouTube
Storyboarding a multimedia project

Advanced

Create Methods
Add a Key Typed Event
Add a Mouse Clicked Event
Add Mouse Clicked Details
Use the Object Clicked On

Mr. Giansante 3D Programming with Alice - Page 3


NETS Standards for Students
National Educational Technology Standards (NETSS)
and Performance Indicators for Students
"What students should know and be able to do to learn effectively
and live productively in an increasingly digital world ..."

1. Creativity and Innovation


Students demonstrate creative thinking, construct knowledge, and develop
innovative products and processes using technology. Students:

a. apply existing knowledge to generate new ideas, products, or processes.


b. create original works as a means of personal or group expression.
c. use models and simulations to explore complex systems and issues.
d. identify trends and forecast possibilities.

2. Communication and Collaboration


Students use digital media and environments to communicate and work collaboratively, including at a distance,
to support individual learning and contribute to the learning of others. Students:

a. interact, collaborate, and publish with peers, experts, or others employing a variety of digital environments and media.
b. communicate information and ideas effectively to multiple audiences using a variety of media and formats.
c. develop cultural understanding and global awareness by engaging with learners of other cultures.
d. contribute to project teams to produce original works or solve problems.

3. Research and Information Fluency


Students apply digital tools to gather, evaluate, and use information. Students:

a. plan strategies to guide inquiry.


b. locate, organize, analyze, evaluate, synthesize, and ethically use information from a variety of sources and media.
c. evaluate and select information sources and digital tools based on the appropriateness to specific tasks.
d. process data and report results.

4. Critical Thinking, Problem Solving, and Decision Making


Students use critical thinking skills to plan and conduct research, manage projects, solve problems, and make informed
decisions using appropriate digital tools and resources. Students:

a. identify and define authentic problems and significant questions for investigation.
b. plan and manage activities to develop a solution or complete a project.
c. collect and analyze data to identify solutions and/or make informed decisions.
d. use multiple processes and diverse perspectives to explore alternative solutions.

5. Digital Citizenship
Students understand human, cultural, and societal issues related to technology and practice legal and ethical behavior. Students:

a. advocate and practice safe, legal, and responsible use of information and technology.
b. exhibit a positive attitude toward using technology that supports collaboration, learning, and productivity.
c. demonstrate personal responsibility for lifelong learning.
d. exhibit leadership for digital citizenship.

6. Technology Operations and Concepts


Students demonstrate a sound understanding of technology concepts, systems, and operations. Students:

a. understand and use technology systems.


b. select and use applications effectively and productively.
c. troubleshoot systems and applications.
d. transfer current knowledge to learning of new technologies.

2007 International Society for Technology in Education.


ISTE is a registered trademark of the
International Society for Technology in Education.

Mr. Giansante 3D Programming with Alice - Page 4


What is Alice?
Alice is an innovative 3D programming environment that
makes it easy to create an animation for telling a story, VIDEO
playing an interactive game, or a video to share on the web.

Alice is a free and open source object-oriented educational Before starting this unit,
programming language with an integrated development watch the following videos:
environment (IDE). Alice uses a drag-and-drop environment
to create computer animations using 3D models. Alice Promo.wmv
(8 minutes)
Alice allows users to learn fundamental programming Alice Demonstration.wmv
concepts in the context of creating animated movies and (12 minutes)
simple video games. In Alice, 3-D objects populate a virtual
world and the programmer can write code to animate the Inserting Objects.wmv
objects. (7 minutes)
Basic Animation.wmv
Alice was developed by researchers at Carnegie Mellon (9 minutes)
University. The project leader was the late Randy Pausch,
famous for his "The Last Lecture" (look it up on YouTube).

The current version is Alice 2.0


The latest beta version is Alice 2.2

Game-maker Electronic Arts (EA) has agreed to help NOTE


underwrite the development of Alice 3.0 and provide
essential arts assets from The Sims - the best selling PC
video game of all time. The Sims content will transform the Alice Website
Alice software from a crude, 3D programming tool into a
compelling and user-friendly programming environment. From the Alice website, you
Experts predict that when the transformation is complete, the can download Alice onto your
new programming environment will be in position to become home computer.
the national standard for teaching software programming.
You can also download
Sources: alice.org, WikiPedia.org additional 3D models.

www.alice.org

Alice 2.0 Alice 3.0


Featuring characters from The Sims

Mr. Giansante 3D Programming with Alice - Page 5


The Alice Environment

Events Area
It allows you to tell
World Window Alice when to make
It shows you the world certain objects do
you are building. certain things.

Object Tree
It contains a list of the
objects in your world.

Details Area
It provides more
information about the
world or an object in
the world.

Editor Area
It allows you to make
objects in your world
do new things like
move and spin.

Mr. Giansante 3D
D Programming with Alice - Page 6
Tutorials
When you start Alice, the following window should
appear (you may need to click on the "Tutorial" tab).

If the window does not appear, go to File | New World

Complete the four tutorials included with Alice.

Tutorial 1

This tutorial will introduce you to the basics of Alice.

Tutorial 2

In this tutorial, you will learn how to teach Alice worlds and objects how to
do new things.

Tutorial 3

In this tutorial, you will learn how to make Alice worlds respond to mouse
clicks and key presses.

Tutorial 4

In this tutorial, you will learn how to create your own scenes.

Mr. Giansante 3D Programming with Alice - Page 7


Example Worlds
Once you have completed the four tutorials, you should
explore some of the example worlds that come with Alice.

When you start Alice, the following window should appear


(you will need to click on the "Examples" tab).

If the window does not appear, go to File | New World

Example World - lakeSkater

This example world is a very good example of what you can do using Alice.

Example World - amusementPark

Use the arrow keys to navigate through the Amusement Park world.

Example World - flightSimulator

Use the arrow keys to turn plane left/right/up/down.


Use the Space Bar to make the plane do a barrel roll.
Go through all 5 rings to get a prize.

Example World - snowLove

This example is a good guide for the first assignment "10 Second World".

Mr. Giansante 3D Programming with Alice - Page 8


Methods and Events

A Method is a sequence of instructions that will be carried out when requested.

A Primitive Method is a Method that characters already know how to perform.

Examples: move orientTo(asSeenBy)


turn roll(direction,amount)
say playSound(sound)

A Custom Method is a Method that is specific to a particular object.

For example, an object constructed from the Penguin class has the following
custom methods in addition to the primitive methods:

wing_flap glide
jumping jump
turn_head_right turn_head_left
walk walking

In addition to the primitive methods and the custom methods, it is also possible for the programmer
to create their own new methods for objects. These are known as User Created Methods.

An Event is some signal or action that can be detected and responded to by a program.

Examples: World starts


The mouse is clicked on an object
The user presses a key

An Event Handler is a method that performs some action when a particular event is triggered

Mr. Giansante 3D Programming with Alice - Page 9


Kangaroo Program
The following program will make a kangaroo jump forward three times.

The first command makes the kangaroo move up (jump) up 0.5 meters.
The second command makes the kangaroo move forward 1 meter.

Because they are in a "Do Together" loop, the two actions will happen simultaneously.

Now, we need to make the kangaroo return to the ground.

The first command makes the kangaroo move down 0.5 meters.
The second command makes the kangaroo move forward 1 meter.

Because they are in a "Do Together" loop, the two actions will happen simultaneously.

The above code, when done in sequence, will result in the kangaroo jumping forward once.
The kangaroo will reach a height of 0.5 meters and will have travelled a total of 2 meters
(1 meter on the way up, and 1 meter on the way down).

We can repeat this process 3 times by simply placing the above code in a "Loop" structure.

The motion could be made more realistic by turning the kangaroo's legs slightly when it jumps
up and also when it lands.

Mr. Giansante 3D Programming with Alice - Page 10


Continuous Motion
This world will illustrate how to create a simple game in which
the user can control a rabbit. The idea will be that the user
does not have to constantly press a key to make the rabbit
move, but rather that the rabbit will constantly move forward.
The user will be able to turn the rabbit left or right.

Create the method to turn the rabbit right ...

Create the method to turn the rabbit left ...

Create the method to constantly move the rabbit forward ...

Note the use of "Loop Infinity Times" as well as "Wait"

Finally, create events the trigger the methods you have just created ...

Mr. Giansante 3D Programming with Alice - Page 11


Shark Program - Part 1
In this example, we will create a world with a shark
that can be controlled by the user.

The user will be able to turn the shark left or right,


using the "left" and "right" arrow keys.

The user will be able to move the shark forward,


using the "up" arrow key.

If the user clicks on one of the scuba divers, the shark


will turn to face the scuba diver and then swim to it.

Begin by creating a new world using the water template.

Add one shark object (found in the "animal" category).


Add four scuba diver objects (found in the "people" category).

Arrange the items as indicated in the picture above.

Note: You will need to move the scuba diver down into the water.

Select the Shark object.

Create a New Method.

Name the Method "turnLeft".

In the shark.turnLeft code area, enter the following:

Mr. Giansante 3D Programming with Alice - Page 12


Shark Program - Part 2

Create a New Method.

Name the Method "turnRight".

In the shark.turnRight code area, enter the following:

Create a New Method.

Name the Method "swim".

In the shark.swim code area, enter the following:

The swimming motion could be made more realistic by having the shark's body
move left and right a small amount, but for simplicity, we will not do that.

Create a New Method.

Name the Method "gotoObject".

Mr. Giansante 3D Programming with Alice - Page 13


Shark Program - Part 3
Create a New Parameter

Name the Parameter: supper

In the shark.gotoObject code area, enter the following:

Now, we need to create Events and link them to the Methods we have created.

You will need to do this four times (once for each of the Events listed below,
excluding the first one which is automatically there).

Mr. Giansante 3D Programming with Alice - Page 14


Shark Program - Part 4
We will now add code to the program that will allow the shark to submerge.

The [SPACE] bar will control the sharks postion.


If the shark is above the water and the [SPACE] bar is pressed, it will submerge.
If the shark is below the water and the [SPACE] bar is pressed, it will return to the surface.

Declare a Boolean (True or False) Variable in the Sharks properties ...

The initial value of the variable is false since the Shark is at the surface.

Create the Method to turn the submerge or surface the Shark ...

Finally, create an Event that will trigger the above Method when the [SPACE] bar is pressed.

Mr. Giansante 3D Programming with Alice - Page 15


Detecting Collisions with the Ground
It is often useful to determine if an object has crashed with the ground (ex. flight simulator program).

The distance to function is not ideal since it measures the distance from the center of the object to
the center of the ground. So, unless the object is directly over the center of the ground, it will not
produce the desired effect.

We need to use the distance above function.

Inserting the distance above method into an If-Then statement is a bit tricky.

Begin by inserting the If-Then statement. Functions available in the Math category
of the World's functions ...
Now, insert a function from the Math category
of the World's available functions into the
condition part of the If-Then. Equal to

Not Equal to

Great Than

Greater Than or Equal to

LessThan

Less Than or Equal to

Finally, you can insert the distance above function from the object (in this case, a Blimp).

The best place to insert the If-Then statement is immediately after you move the object down.

The code above simly set's the Blimp object's opacity to 50% when it hits the ground.

Mr. Giansante 3D Programming with Alice - Page 16


Sample Programs
Open the following sample programs and play the worlds. You can view the code to
determine how certain effects were achieved.

Bouncing Ball.a2w
Dragon Circling Castle.a2w
Dragon Descends to Drawbridge.a2w
Dragon Flapping Wings.a2w
Dragon Shaking Head.a2w
Girl Approaching Horse.a2w
Girl Riding Horse.a2w
Helicopter Flight Simulator.a2w
Jumping Fish.a2w
Marching Soldier.a2w
Wizard and Trolls.a2w

Posting on YouTube

It is possible to export Alice worlds to video.


VIDEO
Note: The newest beta release of Alice (Alice 2.2) has this
function built-in. Watch the following videos:

Posting on YouTube - Part 1

Posting on YouTube - Part 2

Posting on YouTube - Part 3

Mr. Giansante 3D Programming with Alice - Page 17


Animating Character Motion

Source: J. Foley
www.erain.com

Mr. Giansante 3D Programming with Alice - Page 18


Elements of Game Design
Game Development is the software development process by which a video game is developed. Development is
undertaken by a game developer, which may range from a single person to a large business. Mainstream games are
normally funded by a publisher and take several years to develop. Indie games can take less time and can be
produced cheaply by individuals and small developers. The indie game industry has seen a rise in recent years with
the growth of new online distribution systems and the mobile game market.

Mainstream games are generally developed in phases. First, in pre-production, pitches, prototypes, and game design
documents are written. If the idea is approved and the developer receives funding, a full-scale development begins.
This usually involves a 20100 man team of various responsibilities, such as designers, artists, programmers, testers,
etc.

Source: Wikipedia.org - Video game development

Game Design, a subset of game development, is the process of designing the content and rules of a game in the pre-
production stage and design of gameplay, environment, storyline, and characters during production stage. Game
design requires artistic and technical competence as well as writing skills.

Source: Wikipedia.org - Game design

Components of a Game
A game is made up of elements that work closely together.

Space The look and feel of a game come from the design of its space.

Compontents Compontents are the parts of your game like your avatar, blocks and enemies.
These are known as "nouns".

Mechanics Mechanics are the actions in the game like jumping or collecting.
These are known as "verbs".

Goals Players try to achieve goals to win the game.

Victory Conditions - Actions that will result in a player(s) winning the game.
Failure Conditions - Actions that will result in a player(s) losing the game.

Rules Rules guide the player on how the game should be played.

Source: GameMaker documentation, FETC 2012 Presentation.

Challenge vs. Reward


The best video games balance challenge and reward.

Bad video games have too much challenge and/or little reward.

Good video games also have "replay value". In other words, something about the game makes players want to play it
many times.

Mr. Giansante 3D Programming with Alice - Page 19


Storyboards

A storyboard can be loosely defined as a visual script. That visual script is a sort of comic strip,
based on a written script. A good storyboard clearly and explicitly explains what happens in a film
(for instance), where it happens, and how it happens.

Storyboard Example
A scene from "Moon Escape", by Josh Sheppard

Mr. Giansante 3D Programming with Alice - Page 20


Storyboard Example
The storyboard example on the previous page was produced by professional designer. Such results
are very time-consuming and require specialized drawing skills. For the purposes of this class, you
should use the storyboard template on the following page and the results should look something like
the example below.

Mr. Giansante 3D Programming with Alice - Page 21


Title: Page _____ of _____

by: Date:

_________________________________________________ _________________________________________________

_________________________________________________ _________________________________________________

_________________________________________________ _________________________________________________

_________________________________________________ _________________________________________________

_________________________________________________ _________________________________________________

_________________________________________________ _________________________________________________

Mr. Giansante
Lincoln High School 3D Programming with Alice Mark (10)
Mr. Giansante
20 Second World
Assignment Description

Create a 20 second Alice world.

A good example of what your finished product should look like is the snowLove world that can be found in the example
worlds that come with Alice. However, your world should contain a minimum of 10 objects and last a minimum of 20
seconds.

You must submit a storyboard for approval before starting this project. Storyboard should be 1 to 2 pages.

Please fill out all the information in this column Production 4 Marks
using a pen before getting this assignment marked.
Minimum length requirement met
Indicative of amount of time allotted
Storyboard turned in
_____________________________________________ Storyboard complete and accurate
Name

_____________________________________________
Date

Computer Science
_________ Computer Applications
Block

Animation 4 Marks
Academic Honesty
Realistically Timed
The work I am submitting is completely my own creation Smooth Animation
and has not been copied from anyone else's work. If I Animation is not limited to a few objects
have received help on this project, the names of those Simple Methods are used
who have assisted are listed below. (example: move, turn)

_____________________________________________
Signature Advanced
2 Marks
Camera Motion
Object Re-sizing
Complex Methods are used
(example: turntoface, moveto)
Lincoln High School 3D Programming with Alice Mark (20)
Mr. Giansante
Interactive World
Assignment Description

Create an Interactive Alice World.

A good starting point is the flightSimulator and amusementPark worlds that can be found in the example worlds that
come with Alice. The "Shark Program" example in these notes can also serve as a simple guideline. Your world
should contain a minimum of 20 objects.

You must submit a storyboard for approval before starting this project. Storyboard should be 1 to 2 pages.

Please fill out all the information in this column Production 5 Marks
using a pen before getting this assignment marked.
Indicative of amount of time allotted
Storyboard turned in
Storyboard complete and accurate
_____________________________________________
Name

_____________________________________________
Date

Computer Science Animation 10 Marks


_________ Computer Applications
Block Realistically Timed
Smooth Animation
Animation is not limited to a few objects
Academic Honesty A variety of Methods are used
Sound and/or Music is used
The work I am submitting is completely my own creation
and has not been copied from anyone else's work. If I
have received help on this project, the names of those
who have assisted are listed below.

_____________________________________________
Signature Interactivity
5 Marks
The user can control the motion of
an object(s) or the camera.
The program responds to key presses
The program responds to mouse clicks
The user is given feedback
Lincoln High School 3D Programming with Alice Mark (100)
Mr. Giansante
3 Minute World
Assignment Description

Create a 3 minute Alice world that is similar to a movie


(ie. limited or no user interaction).

This is a major assignment. You will have roughly five to six weeks Make sure you avoid ...
to complete it. Marks will be indicative of effort, time spent and quality
of the finished product. References to alcohol and drugs
Scenes involving or related to sex
You must submit a storyboard for approval before starting this project. Scenes involving or related to violence
Storyboard should be 3 to 5 pages. Scenes that could be hurtful to others

Please fill out all the information in this column Pre-Production 10 Marks
using a pen before getting this assignment marked.
Storyboard turned in
Storyboard complete and accurate
_____________________________________________
Name
Production 10 Marks

_____________________________________________ Minimum length requirement met


Date Indicative of amount of time allotted
Original Storyline and Plot
Computer Science
_________ Computer Applications
Block Animation 40 Marks

Realistically Timed
Academic Honesty Smooth Animation
Animation is not limited to a few objects
The work I am submitting is completely my own creation Simple Methods are used
and has not been copied from anyone else's work. If I (example: move, turn)
have received help on this project, the names of those
who have assisted are listed below.

Advanced
30 Marks
_____________________________________________
Signature Camera Motion
Object Re-sizing
Complex Methods are used
(example: turntoface, moveto)

Sound and Music 10 Marks

Background Music
Sound Effects (pre-recorded)
Sound Effects (custom-made)
Recorded Voice
Lincoln High School 3D Programming with Alice Mark (100)
Mr. Giansante
Large Interactive World
Assignment Description

Create a large interactive Alice world.

A good starting point is the flightSimulator and amusementPark


worlds that can be found in the example worlds that come with Alice. Make sure you avoid ...

This is a major assignment. You will have roughly five to six weeks References to alcohol and drugs
to complete it. Marks will be indicative of effort, time spent and quality Scenes involving or related to sex
of the finished product. Scenes involving or related to violence
Scenes that could be hurtful to others
You must submit a storyboard for approval before starting this project.
Storyboard should be 3 to 5 pages.

Please fill out all the information in this column Pre-Production 10 Marks
using a pen before getting this assignment marked.
Storyboard turned in
Storyboard complete and accurate
_____________________________________________
Name
Production 10 Marks

_____________________________________________ Indicative of amount of time allotted


Date Original Storyline and Plot

Computer Science
_________ Computer Applications Animation 30 Marks
Block
Realistically Timed
Smooth Animation
Academic Honesty Animation is not limited to a few objects
Object Re-sizing
The work I am submitting is completely my own creation Simple Methods are used
and has not been copied from anyone else's work. If I (example: move, turn)
have received help on this project, the names of those Complex Methods are used
who have assisted are listed below. (example: turntoface, moveto)

Interactivity 40 Marks
_____________________________________________ The user can control the motion of
Signature an object(s) or the camera.
The program responds to key presses
The program responds to mouse clicks
The user is given feedback

Sound and Music 10 Marks

Background Music
Sound Effects (pre-recorded)
Sound Effects (custom-made)
Recorded Voice