Programming with objects in Alice 3

0
13483

Alice 3

In this article, the author, who likes to explore different kinds of software, introduces readers to Alice 3 and indicates how to go about installing it as well as create games and stories with it.

My first exposure to the Alice learning environment was when I listened to the remarkable Randy Pausch’s Last Lecture. Alice has been on my list of software to explore for years now, and I finally got around to doing that after exploring Scratch.

Like Scratch, there is a stage, or rather, a 3D world, in Alice. You populate your world with objects and then program the objects to do what you want. As with Scratch, it is an excellent way to tell stories or create interactive games. Alice is more complex than Scratch as there is one additional dimension, and a special object—the camera. You view the world through the camera, which you may also program.

You can download Alice 3 from alice.org. Note that it is almost 1.5 GB. The reason for the large download size is that it comes with a large gallery of artwork, which made it possible even for me, who has trouble drawing stick figures, to experiment with 3D animation.

A programmer’s perspective

As a programmer, the first thing you may notice when you start Alice 3 is the keyword, this! The connection to Java is obvious.

When you set up the scene to add the objects you want, you will notice that you can browse the gallery by Class Hierarchy. The classes include:

  • Biped: Adult, teen, alien, rakshasa, skeleton, etc
  • Flyer: Chicken, peacock, penguin, etc
  • Swimmer: Fish classes, marine mammal classes, etc

In the Edit Code mode, you can browse the procedures and functions associated with each object in your scene.
Chances are that a non-programmer may not even notice the above!

Getting started

A non-programmer is more likely to browse the gallery by themes, e.g., Africa, Amazon, fantasy, ocean, wonderland, etc. Choosing wonderland will allow you to create objects like Alice, Mad Hatter, Mushroom, and so on.

The best way to learn is to follow some video tutorials. You can find a set of these from Duke University. The beginner’s tutorial, Witch’s Cauldron, consists of seven videos, each lasting only four to five minutes. It is an excellent way to acquire an understanding of how to use Alice 3.

You will learn to:

  • Create a world and add objects to it
  • Position, orient and resize an object
  • Position and orient the camera
  • Code the actions of various objects

Creating a simple game

The next tutorial to try is how to create a simple game—the UFO Alien Rescue game — at the ICE Distance Learning Site.

Here, you will learn more about creating objects and changing their properties.

On the programming side, you will learn how to control the game flow using the arrow keys and the space bar to move the spaceship over the aliens, and how to pick up each one. The programming constructs needed are the usual Conditional Statements, Creating and Using Variables, Handling Events, and Creating Procedures and Adding Parameters.

Alice 3 makes it easy to program a game like this one with functions like isCollidingWith to test if a beam has located an alien. You can set the opacity of the beam so that the aliens continue to be visible even if surrounded by the beam. You can then use the moveTo method to move an alien to the UFO, and set the vehicle of the alien to the UFO so that both move together.

Telling a story

Entertainment will continue to be what people need, even if robots do all the work. Apart from sports and games, the other major entertainment for all of us is story-telling. Hence, the final tutorial you should try is creating a trailer for ‘Finding Nemo’ from an Alice 3 workshop.

The story you will tell in this case is:

Create a 5-10 second animation that shows Marlin’s (a small fish) frightened reaction on meeting a shark

As SharkEncounter.a3p does not seem to be available for download, you can create a new project using the sea floor. Add Marlin (ClownFish), Dory (BlueTang), a shark and a treasure chest from the gallery of the Ocean theme. You can now follow the tutorial.

Considerable time and effort will be spent in setting up the scene. Programming is easy once the scene is set up. Animations rely upon the duration option to indicate how long a particular step should last. It is fun to play around with Alice 3 and you are now ready to create your own stories!

LEAVE A REPLY

Please enter your comment!
Please enter your name here