Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Alice
Last updated at 10:26 pm UTC on 8 December 2006

What is Squeak-Alice?
Alice http://www.alice.org is an authoring tool designed to allow people without programming experience to build interactive 3D worlds. The Stage 3 Research Group (Randy Pausch director) started the Alice project at the University of Virginia, and is continuing their work at Carnegie Mellon University http://www.cs.cmu.edu/~stage3. Squeak-Alice brings the ideas and the ideals of Alice to Squeak, with the goal of introducing even more people to 3D graphics and allowing them to author in the medium.

See the PlayWithMe-7 window in Squeak 2.4. You must have the Squeak3D plugin in the same folder as your Squeak application (VM).

How do I create Wonderlands?
You create a Wonderland by evaluating:

Wonderland new.

This creates a new Wonderland, along with a camera window looking into the Wonderland, a few controls, and a scripting editor.

How do I add Actors to my Wonderland?
Currently Wonderlands prefer to create Actors from Alice .mdl files. As a service to the community, the Alice team has agreed to make their models available to Squeak users. The model library can be downloaded from:

ftp://st.cs.uiuc.edu/pub/Smalltalk/Squeak/alice/Objects.zip

To add a model, you evaluate the following in the script editor:

w makeActorFrom: 'path/to/actor.mdl'

ex. w makeActorFrom: 'C:\Program Files\Squeak\Actors\Animals\bunny.mdl'

This creates a WonderlandActor instance for the actor and adds it to the Wonderland. By default actors are named using the name of the model file; in our example the first actor we create with this model file will be named bunny, the second bunny2, etc.

Actors are hierarchical objects, which means that they are made up of different parts. In the Actors pane of the script editor you can see a list of the actors currently in the Wonderland and the parts that make up each Actor. To access the parts of an Actor you use the name of each part of the Actor from the top level part down to the part you want.

Thus, to access the bunny's left arm you'd use:

bunny body leftArm

What can Actors do?
Actors have a number of built-in primitive behaviors. The most commonly used behaviors are:

move - moves the actor in the specified direction
moveTo - moves the actor to a specified position
turn - turns the actor in the specified direction
turnTo - turns the actor to a specified orientation
roll - rolls the actor left or right
pointAt - points the actor at the specified actor
resize - changes the size of the actor
place - place an actor relative to another actor
standUp - causes the actor to stand up
destroy - destroys an actor

Each of these behaviors can be used in different ways and with different levels of control. One of the bumperstickers from Alice is "controlled exposure to power"; the simple commands you learn first can also be used in more powerful ways.

Some useful combinations are:

bunny move: forward
bunny move: forward distance: 2
bunny move: forward distance: 1 duration: 4
bunny move: forward distance: 1 duration: 2 asSeenBy: camera

bunny moveTo: { 0. 1. 0} duration: 2
bunny moveTo: {0. 0. 1} speed: 4
bunny moveTo: {asIs. 0. asIs}

bunny head pointAt: camera
bunny head pointAt: camera duration: eachFrame

For other combinations (until I've written the Squeak-Alice active essay)
look at the WonderlandActor class.

Composing animations
Right now there are two ways to compose basic behaviors to build more complex behaviors. They are:


ex. w doTogether: { bunny move: forward. bunny turn: right }


ex. jump := bunny move: up.
fall : = bunny move: down.
hop := w doInOrder: { jump. fall}

You can also start and loop these animations.

hop start
hop loop: 2
hop loop
hop stopLooping

What are Cameras?
Cameras are a special type of Actors. Although they have all the behaviors that Actors do, they also provide windows into the 3D world. You create a camera by evaluating:

w makeCamera

The first (default) camera is named camera. Subsequent cameras are named camera2, camera3, etc. Each camera displays into a camera window. These windows are named cameraWindow, cameraWindow2, etc. You can also animate these windows. Try:

cameraWindow move: right distance: 200

Moving the Camera Around
There are two ways of moving the camera around. One is to type commands for it in the script editor. The other is to mouse around using the camera controls.

cameraWindow showCameraControls

Click in the controls morph and drag. The controls currently work as
follows:

no modifier keys: move forward/back, turn left/right
shift: move up/down, move left/right
ctrl: turn left/right
shift + ctrl: turn up/down

Blending 2D and 3D
One of the goals of Squeak-Alice is to explore using 2D and 3D elements together. To blend the 3D world with the 2D desktop try the following:

ground hide
camera turnBackgroundOff

Work in Progress
Squeak-Alice is a work in progress that's only a few months old. Although it draws heavily on Alice for inspiration, there is some new functionality that has not yet been fully user tested, and any bugs are completely my own. You can direct questions, comments, bug reports, and complaints to yours truly at:

jpierce@cs.cmu.edu

I also encourage you to try out the Alice authoring tool yourself; you can download the authoring tool and web browser plug-in free from
http://www.alice.org. There's also an Alice tutorial on the web site, and although the syntax is different most of the concepts are the same.

Enjoy,
Jeff