Richard G Baldwin (512) 223-4758, NRG Room 4238, Baldwin@DickBaldwin.com, http://www.austincc.edu/baldwin

GAME 2342 Game Development Using C++

This material applies to classroom sections and Open Campus (PCM) sections taught by Professor Baldwin.

Lab Projects

Fall 2011

Revised 08/04/11

The official web page for this course is GAME 2342


Laboratory Software

The following required software will be provided in the Game Programming lab (room 3136) at NRG.

Microsoft's Visual C++ 2008 Express (or possibly Microsoft Visual Studio 2008).

August 2007 DirectX 9.0c SDK

The Dark GDK Game Developer Kit

If you have a compatible Windows machine, you should also be able to download and install this software free of charge.  See the Installation Guide.

My version of the programs

I have provided a zip file for each project containing my version of the program along with the image and/or sound files required by my program.  Note however that even though these are executable files, you apparently must have August 2007 DirectX 9.0c SDK installed on your computer before you can execute them.

Extract the contents of the zip file into a folder and double-click on the exe file to run my version of the program.  Be sure to use your headphones or speakers to listen for any sounds that might be produced by my version of each program.

Examples only

You should think of my programs simply as examples of the kinds of things that I expect from you.  I don't expect you to replicate my program.  I would prefer to see you go off on your own, be creative, and write programs that are different from mine.

A caution on schedule

The schedule in the syllabus shows a project due approximately every other week.  Please note, however, that Project #8, which counts for twenty-percent of your final grade, will probably represent a major programming effort on your part.  Be sure to complete the first seven projects sufficiently early to allow yourself plenty of time to complete Project #8.

Lab Project #1

Do Chapter 5, Programming Exercise #3, Landing Spaceship, on page 211 in the textbook.

Additional requirements:  Each time the user presses a key, the distance to the surface should be reduced by a factor of two. (Move half way to the surface on each key press.) The space ship is assumed to be on the surface after five key presses. The program should terminate on the sixth key press.

You can download a zip file containing my version of the program along with appropriate image files here.

Figure 1 shows a screen shot taken while my program was running.

Figure 1.  Screen shot for my version of Project #1.

 

Lab Project #2

Do Chapter 7, Programming Exercise #9, Lunar Lander, Part 2, on page 343 in the textbook.

Additional requirements:  Use a screen refresh rate of 60 frames per second.  You can download a zip file containing my version of the program along with appropriate image files here.

Figure 2 shows a screen shot taken while my program was running.

Figure 2.  Screen shot for my version of Project #2.

 

Lab Project #3

Do Chapter 8, Programming Exercise #3, Stormy Weather, on page 406 in the textbook.

Additional requirements:  Cause each lightening bolt to have a different shape, to originate at a different random point in the sky, and to strike a different random location on the ground.  Cause a victim (human or otherwise)  to be struck by each lightening bolt.  Place the victim approximately at the random location where the lightening bolt strikes the ground in a manner similar to that shown in Figure 3.

There are no speakers on the laboratory computers and this project requires that you produce audio output.  Therefore, you will have to bring your own headphones so that you can hear the audio output produced by the program.  You can download a zip file containing my version of the program along with sound files here.  Run my version of the program and pay very close attention to what you see and hear.

Figure 3 shows a screen shot taken while my program was running.

Figure 3.  Screen shot for my version of Project #3.

 

Lab Project #4

Do Chapter 9, Programming Exercise #4, Mouse Crosshairs, on page 469 in the textbook.

Additional requirements:

You can download a zip file containing my version of the program here.

Figure 4 shows a screen shot taken while my program was running.

Figure 4.  Screen shot for my version of Project #4.

 

Lab Project #5

Write a side-scroller program.

You can download a zip file containing my version of the program here.

Run my version of the program to see how it behaves.  Then use the image files contained in the zip file (or other image files of your own design) to write your own side-scroller program.

Figure 5 shows a screen shot taken while my program was running.

Figure 5.  Screen shot for my version of Project #5.

 

Lab Project #6

Do Chapter 12, Programming Exercise #4, Floating Asteroids, Part 1, on page 679 in the textbook.

You can download a zip file containing my version of the program along with the image files here.  You may use, but are not required to use my image files.

Run my version of the program to see how it behaves.

Figure 6 shows a screen shot taken while my program was running.

Figure 6.  Screen shot for my version of Project #6.

 

Lab Project #7

Do Chapter 12, Programming Exercise #5, Floating Asteroids, Part 2, on page 679 in the textbook.

You can download a zip file containing my version of the program along with the image and sound files here.

Run my version of the program to see how it behaves.

Figure 7 shows a screen shot taken while my program was running.

Figure 7.  Screen shot for my version of Project #7.

 

Lab Project #8

Write an object-oriented graphical game program of your own design and be prepared to demonstrate it to the class.  Try to make all of the players in the game objects of classes that you design, or classes that you obtain from others.

There should be very little code in your program other than class definitions, the code needed to manipulate the objects, and the code required to produce large custom text on the screen. (I will have more to say about this code later.)

Figure 8.  Game-play screen for my version of Project #8.

In addition to a game-play screen similar to that shown in Figure 8, your program must also provide informational screens using large text similar to the images shown in Figure 9 and Figure 10.

Your game must allow the player to progress through multiple levels with game play at each level being more difficult than game play at the previous levels.

Your game must make effective use of sounds and/or music.

The code required to produce large text like that shown in Figure 9 and Figure 10 is not straightforward.  However, you should be able to adapt the code that you will find in the following file for this purpose:

C:\<Dark GDK installation folder>\The Game Creators\Dark GDK\Tutorials\Dark Invaders\Dark Invaders\Invader Text.cpp

Note that the code that you will find in the file named Invader Text.cpp is not object-oriented, and I don't expect you to make it object-oriented.  Just adapt it and use it pretty much as is.

In addition, you will need an image file named font.png that you will find in the zip file containing my version of this program.  The image contained in that image file is shown in Figure 11.

You can download a zip file containing my version of an OOP game program along with image files and sound files here.  A screen shot of my game in action is shown above in Figure 8.

My game is a significant upgrade to Project 7, intended to turn Project 7 into an interesting game.  As in Project 7, the position of the UFO can be controlled with the arrow keys.  The asteroids and the red energy pills are constantly in motion at different speeds.  The objective is to cause the UFO to collide with and to consume the red energy pills and to avoid the asteroids.

Each collision of the UFO with an asteroid reduces the UFO's energy level by one unit.  Each collision of the UFO with an energy pill increases the UFO's energy level by one unit.  A collision between an asteroid and an energy pill causes them both to disappear and to be regenerated in new random locations with no effect on the energy level.

All collisions are accompanied by sound effects and the informational screens are accompanied by music.

The game starts out in Level 1 with three energy pills and only three asteroids, all moving very slowly.  Therefore, it is easy to progress to Level 2.  The number of energy pills remains at three for all levels.  However, the number of asteroids increases each time the player advances to the next level.  This is one mechanism for causing game play to become more difficult from one level to the next.

The UFO starts out with an energy level of 10 units.  If the energy level is decreased to zero, the UFO disappears, the program plays the funeral march, displays a "Game Over! You Lose" screen, and waits for the user to press a key to cause the program to terminate.

If the energy level is increased to 20, the program plays a happy tune, displays a screen similar to Figure 10, and waits for the user to press a key to progress to the next level.  The energy level is reset to 10 at the beginning of each level.  Also, as mentioned above, the number of asteroids increases by one at each level change with the number of energy pills remaining the same at all levels.

In addition, the speeds of the UFO, the asteroids, and the energy pills all increase as the game progresses, causing the game to become more difficult over time.

Figure 9.  Startup screen for my version of Project #8.

 

Figure 10.  Level transition screen for my version of Project #8.

 

Figure 11.  Font image file used in my version of Project #8.

-end-

File: GAME2342LabProjects.htm