Computer Graphics Workshop '97 Lecture Notes


Today's topics
Final projects

The following projects were done by students taking this course over IAP 1997 at MIT, from January 6 to 31.

Chess - Madhulika Jain (

Download the source code

Chess Image

Chess is a networked chess board. Two people can play a game of chess by clicking and dragging the pieces around the board.

The pieces were created by hand using various geometric primitives in Open Inventor. Dragging of the pieces is implemented by setting the geometry of Translate2Draggers to be the pieces' geometry. Every time a piece is dragged, a MotionCallback writes a message to the network containing the piece's new position. In addition, an IdleSensor monitors incoming messages and keeps the local board synchronized with the other player's board.

To start the game, one person must start the chess application first, and the other must connect to the first one by using the -connect <machine name> command line option. The -texture option turns on texture mapping for the pieces, but this slows down the game on machines without hardware texture mapping.

Chess was written in C++ and requires the SocketMan networking library in order to compile.

Air Hockey - Dilong Zeng (

Download the source code

Air Hockey Image

Air Hockey is a networked two-player version of shufflepuck implemented in Scheme. Each player controls one paddle. Moving the mouse in the viewer's window causes the paddle to move on both players' screens.

The game is implemented using a TimerSensor to drive the main loop. At each time step the puck's new position is computed based on its current velocity, and it is constrained to lie within the game region. Then collision tests are performed on the local player's paddle to determine whether the puck should bounce off the paddle with some added velocity. A message is sent over the network to inform the other player of the collision, as well as the position and velocity of the puck after the collision. This allows both machines to maintain synchronization.

To start the game, type "ivyscm hockey.scm" on two different SGIs. The program will ask you whether it should connect to a remote server. On one machine, answer "n"; this will be the server. The other will be a client to the server and should be connected to the server by answering "y", and typing the server's name at the next prompt.

Lightcycles - Peter Ju (

Download the source code

Lightcycles Image

Lightcycles is a 3-D implementation of the game from TRON. Each player controls a biker which drags a trail behind him; the object is to get the other players to run into your trail, without running into a trail yourself. The camera view is a first-person view, pointing straight ahead from your biker. The left and right arrow keys turn your biker by 90 degrees; up and down make you accelerate and decelerate; the Z and X keys let you look left and right while they are held down.

The game is implemented with an IdleSensor driving the main loop. The bikes are hooked up to engines which control their forward motion; key presses cause network messages to be sent out to keep remote machines' view of your bike synchronized. A FaceSet is used to make each biker's trail; the last rectangle in the face set is continually modified to have its last two coordinates be the biker's current position. The geometry for the bikers was made by hand.

Lightcycles uses IP multicasting to perform its network communication, so it can (theoretically) handle any number of players.

To run, just type "ivyscm light-rand.scm".

Joust - Thomas Minka (

Download the source code

Joust Image

Joust Game

Hit enemies from above to turn them into eggs. Grab eggs. If you get hit from above, you are paralyzed for a few seconds while a new enemy appears. Move by accelerating left, right, or up (arrow keys).

This is not an easy game. Enemy cones will sometimes hover at the top, sometimes dart at you, and sometimes bounce off of each other.

Run the game with "ivyscm joust.scm".

Inheritance hierarchy

This game is designed in an object-oriented fashion, using the Scheme object modeling technique of Structure and Interpretation of Computer Programs. There is no "main loop" per se: each object moves and responds on its own volition. This makes it easy to add new kinds of objects to the game.


Each object has a simple role. Together they make up a fairly complex game.

Does nothing (no movement or collisions).

Elastic collisions with everything, including other eggs.

Can accelerate left, right, or up. Bounces off of barriers and playfield boundaries.

A kind of Horse which replaces Enemies with Eggs. Destroys Eggs. Paralyzes itself when hit from above by an Enemy.

A kind of Horse which tries to get near and above Players (brain is a TimerSensor). Elastic collisions with other Enemies.

Gravity is not an object, but just a TimerSensor which accelerates all heavy actors downward.

Generic Actor object

The parent of all actors in the game is the Actor object:

Collisions are detected by a FieldSensor callback that is executed whenever an Actor moves. Elastic collisions are physically correct, incorporating the masses of the Actors and the angle at which they contact in 3D. Joust could easily be made three-dimensional simply by adding a input key for accelerating along the z-axis.

Tags are used to identify types of Actors. An Actor can check for collisions with the specific Actor types it cares about. Some tags, like egg and enemy, simply identify the class of the Actor. Other tags, like heavy, identify attributes of the Actor. This makes gravity particularly simple: accelerate all heavy Actors. (Barriers are not heavy.) A global table efficiently maps tags into the Actors which hold them.

Run ball.scm for a demo of Actors.


The VelocityEngine object encapsulates a Calculator which computes p = v * t + d. t is output of an ElapsedTime engine. v, d are constants. When the timer runs, p will advance forever in one direction.

Note that setting d = p and resetting the timer (t = 0) produces no visible effect. The VelocityEngine uses this fact to change its velocity.

See test-ve.scm for a demo of the VelocityEngine. Use the arrow keys to change the velocity of the sphere/cone.

Back to the CGW '97 home page

$Id: index.html,v 1.3 1997/02/19 22:51:54 kbrussel Exp $