CPSC370 - Tools

Operating System

We will be using Windows XP for development and demonstration. While you are welcome to use the operating system of your choice, any problems with the tools on operating systems other than Windows will be your own responsibility to fix and diagnose.

Java Development Kit

We will be using JDK1.5.0_06. You can download it from java.sun.com.


Many of the programming samples use the Java3d library. Even many of the regular 2d games. You will have to install this from the beginning. You should download the 1.3.2 version. There are earlier and later versions, but this one will be the most useful for the class.

Installing Java3d is easy. The basics of the install are that the .dll files end up in the ./jre/bin directory and the .jar files end up in the lib/ext directory. What you download from the Java3d website contains a zip file within a zip file. That internal zip file is the one you want to unpack into the jre directory.

In setting this up I had problems with the error:

java my3dapp
Exception in thread "main" java.lang.UnsatisfiedLinkError: no j3dutils in java.library.path

Everything was compiling fine, it was just when I went to run that I got that error. It turned out that while javac was running from 1.5.0_06, the java command was coming from 1.5.0 in another application which was also installed on my machine. Make sure that the c:\jdk1.5.0_06 is the first entry in your path. Look at the following setup.bat script for more details. The way I found the solution to this problem was by typing java -version on the command line.

Java Setup

I always install the java sdk in the root directory of the c: drive. For my current version, the directory is c:\jdk1.5.0_06. This is the default install location.

My personal preference is to use Java from the command line. To do this, I create a batch file in the java sdk directory I will use that sets up my command line for that sdk. I somtimes place setup.bat files in specific projects that require specific behavior. This is useful because you may need to switch between multiple java versions on a single project. I always call the batch file setup.bat and place it in the sdk directory.

This is what my setup.bat file looks like:

set JAVA_HOME=c:\jdk1.5.0_06

When I start a windows command prompt the first command I type is:



The use of an IDE (Integrated Development Environment) is not frowned upon, but for most examples I will be using the command line. You should be familiar with command line development and this is a good opportunity to practice an important skill. My personal choice of IDE for Java development is currently NetBeans. You can download it for free with the JDK. If you will be using an IDE for this class and you have trouble compiling or running your application, you are on your own.


When using the command line for development in a windowed environment it is still best to use a windowed editor. My preference is to use TextPad which is fairly inexpensive but very functional. I recommend against using Windows Notepad because it changes the file extension automatically to .txt and causes problems. It is perfectly fine for quick and simple changes, but it is simplistic and not very functional for a full time editor.

When developing on linux or Solaris, I open multiple shell windows (one per file) and use vi as my editor. vi is a strange editor and I only learned it because of need when there was nothing else available. Once you learn the 20 or so commands that are required it is a very functional and efficient environment.

Sample Code From the Book

The source code samples from the book are available at http://fivedots.coe.psu.ac.th/~ad/jg/. You should down load them to your local disk. I have downloaded them into c:\gamedev\book. That directory contains all the zip files for the various chapters (ch2Code.zip) and the uncompressed versions. For instance, the ch2Code.zip files extracted into the c:\gamedev\book\Timings directory.

Using the Java SDK

After uncompressing the ch2Code.zip files you can use the following commands to run some of the samples.

cd \gamedev\book\Timings
javac SleepAcc.java
java SleepAcc
Slept: 1000 ms J3D: 1000.59 ms err: -0.06 %
Slept: 500 ms J3D: 494.07 ms err: 1.2 %
Slept: 200 ms J3D: 199.67 ms err: 0.16 %
Slept: 100 ms J3D: 99.68 ms err: 0.32 %
Slept: 50 ms J3D: 49.44 ms err: 1.13 %
Slept: 20 ms J3D: 19.54 ms err: 2.38 %
Slept: 10 ms J3D: 9.58 ms err: 4.36 %
Slept: 5 ms J3D: 59.7 ms err: -91.63 %
Slept: 1 ms J3D: 0.61 ms err: 63.97 %


CPSC370 - Games Development
Chapman University
Instructor: W. Wood Harter
(c) copyright 2006 - W. Wood Harter - All Rights Reserved
Screen shots on banner (c) copyright their resprective owners