Indiana University
College of Arts and Sciences

Summer 2003 Precollege Institute

Game Programming in Java

Instructor: Professor Christopher Haynes, email chaynes@indiana.edu. Please call me Chris.

Location: Lindley Hall 023

Time: 9-12 M-F and  TR 2-4, June 23 - July 11. Please be punctual.

Web: www.cs.indiana.edu/~chaynes/pi Check frequently for updates during the institute.

Description
 


On Monday, 6/7, we'll meet from 2-4pm as well as in the morning.

On Wednesday, 6/9, we'll meet from 1:30-4:30, as well as in the morning.

We will NOT meet at all on Tuesday, 6/8.

On Wednesday, 6/2, we'll meet from 1:30-4:30, and not in the morning.

Exercises and assignments (in reverse chronological order, so do them in reverse order)

Do Lab 10, ignoring the submission instructions.

Read chapters 9 and 10, doing exercises 9.2.3 and 9.3.1 and Lab 9 .

Read chapter 8 (recursion), omitting section 8.2 if you are short on time. Do exercise 8.1.3; you may skip the others in this chapter. Also do Lab 8, using the local starter zip file. Of course as before ignore submission and other stuff local to the Williams College environment.

Read chapter 6 and 7. Write out the exercises on paper you can turn in, except for exercise 7.3.2, which you may skip. Also study GuiDemo.java, which combines keyboard arrow keys, a graphics canvas, labels, a text box, and a button, all in one application, using two flow layout managers. Using these elements a variety of games can be handled, while avoiding the really tricky GUI aspects. Then do Lab 7

Syntax rules.

Lab 6 (Frogger!). This is a link to the text author's web, so ignore their grading and handin instructions and use the local frogger.jar starter files and images..To create an image (to use as the first argument to the constructor of objectdraw.VisibleImage), send the message getImagc((fileName) to the instance of the class that extends FrameWindowController. Here filename is a path to the image gif file relative to the directory from which the current class file was loaded.

Do the design indicated in the first paragraph of  Lab 5, and then complete the assignment.

Read chapter 5 in the eventful text.

Review the style rules and guidelines.

Read Eventful text sections 3.6 through chapter 4, doing all the exercises, as usual. Unless otherwise indicated, always do exercises in the eventful text. In exercise 3.9.2, you need only write the boolean expressions.
 

Lab 4: as usual,  ignore the class-specific stuff at the end, such as the grading rubric and submission directions. Download the local copy of the three starter files in the magnets directory.

Lab 3 Ignore the grading guidelines (except to note some things to pay attention to) and the turning-in instructions at the end.

Read system notes 1, 2, and 4.

Read Eventful text through section 3.5. Do all the exercises in this part of chapter 3 on paper and of course bring your work to class.

Class notes 2

Lab 2

Follow the getting started instructions.

Read chapter 1 (unless otherwise noted, all references are to the Eventful text).

Class notes 1

Lab 1
 


Texts, reference material, and development tools

Java: An Eventful Approach, by Kim B. Bruce, Andrea Pohoreckyj Danyluk, and Thomas P. Murtagh, manuscript draft of December 18, 2002, duplicated with permission. This very well done introduction to Java, which will be referred to as our eventful text, emphasizes handling events and early use of graphics, both of which are fundamental to game programming. See the summary, quick reference, and the local and downloadable documentation on the objectdraw packageThe authors also supply an AWT/GUI Cheat Sheet that summarizes basic Java GUI programming techniques.

Big Java, by Cay S. Horstmann, Wiley, 2002. There is vastly more here than we will cover, but this is a valuable reference that assumes no prior programming background.

If there is time and interest, we my also explore the Robocode system. It has API documentation, an introductory tutorial, and an advanced tutorial on SnippetBot.

The on-line Java API documentation  (SDK 1.4.0) is perhaps the single most useful reference for a Java programmer.

DrJava is an integrated development environment, or IDE, for Java especially designed for the needs of beginners (though it is also good for medium-size projects, such as its own development). An IDE incorporates in an integrated user interface an editor, compiler, and run-time system.

There are notes on setting up Java and DrJava on a personal machine.
 


Pair programming

An article in the Communications of the Association for Computing Machinery (May 2000, pp. 108-114) begins "Pair programming is a practice in which two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code, or test. This method has been demonstrated to improve productivity and the quality of software products. Moreover, a recent survey ... found that programmers were universally more confident in their solutions when programming in pairs as opposed to working alone. Likewise, 96% agreed they enjoy their jobs more when pair programming [ref]."