Assignment 4 - Interactive Graphics

Due - Midnight Wednesday May 12

You are going to create a small interactive game using Java3D. To get you past a lot of initial boilerplate, I'm providing a game template here. You will need all the java files and gifs in this directory to make the game. Main is in the class LittleGame, so to build this, put all of these files into your working directory, then do "javac". If you have trouble with this, make sure you have the directory "/p/lib/j2sdk1.3.1/bin" in your PATH before "lusr/java2/bin" appears. Also, you may need to define a CLASSPATH variable that has the pathname of your working directory in it. Finally, if you are doing this on your own machine, you will also have to put the file j3dtree.jar into the {\bf lib/ext} directory of your java runtime environment (jre) before running this. To execute it, just run "java LittleGame". You should get a pair of windows, one with a picture of an environment in it, and the other with a diagram of the scene graph that you are using (that's what j3dtree is used to produce). You can navigate around it the environment by putting your focus into that window and then using the keyboard in a way similar to that used in DOOM (assuming, of course, that you are familiar with DOOM). The arrow keys let you move forward and back and rotate side to side. If you use CTRL or ALT with these keys, you will get different functions, try them and see.

You can use the mouse to rotate, translate and scale the cube in the center of the room by pressing the appropriate button of a 3 button mouse to select the operation and then moving the mouse to give the amount of the transform desired. Otherwise, this game template is pretty boring, nothing much happens except for wandering around amidst the not too menacing "evil cones". So your job will be to turn this into a more interesting game.

The basic idea is for you to create an articulated robot to be controlled with keyboard and mouse. The robot should be designed by you, but need not look like it is walking (it is okay to have some wheels on it that it cruises around on). It should, however, have two arms, each controllable separately. The arms should have a shoulder joint and an elbow joint. The shoulder should be maneuverable through the entire hemisphere of directions centered away from the rest of the body. The elbow should have a 360 degree range of motion about the upper arm, whatever its position. You should be able to walk the robot around the room much as the viewpoint can currently move around the room.

What will this robot do? Well, the idea is to have it be able to throw darts at your (least) favorite target. To practice building a target, put a picture of yourself on the wall someplace, inside a nice frame. Then put your target picture up somewhere. (I'm hoping to see more pictures of politicians than pictures of me as targets ;-}) The robot should be able to pick up a dart by touching it with the end of its arm, and throw it by rotating its arm and letting go at an appropriate time. One way to control this is to have the mouse rotate the arm and mouse buttons control grabbing and releasing the dart. Once thrown, the dart should stick where it hits. It's fine to make other objects in the room legitimate targets for the darts as well. Don't let darts pass through objects. Don't let the robot pass through objects either.

You need not implement gravity for the dart to get a 90 on this project, but more points will require more stuff. Give the darts some weight and put gravity in to make them fly in an arc to get 100. That way, both the direction and the velocity of the throw will matter in getting the dart to the target. Without gravity, all you will be doing, is trying to release the dart with a vector pointing at the target.

This dart throwing could be a pretty hard task. Experiment with ways to get the interface to make it tractable. Sensitivity of the controls is one important one. Another is point of view. You should make it possible to look at the robot in the room from a viewpoint of an observer, much like you can look at the cones now. You should also be able to switch to a robot's eye view that allows you to aim your darts better.

Of course, if you really want to get fancy, you can go from robots throwing darts under your control to you throwing darts at the robot under your control, which the robot tries to throw at you under its own AI control Don't try this unless you have a lot of time on your hands if your trying to make the robot behave interestingly and "intelligently".

To turn in this program, use turnin for all files needed to build your system and a readme file that provides instructions for building and using the program. You may, in addition, schedule a demo with the TA within two days of turning it in to make sure that he sees all the capabilities of the program. The demo is not required, but if the TA cannot figure out how to use your program from your readme file, you could lose credit for the untested functionality.