Fall 2003
While this is the "official" project description, some details may be added as the deadline gets closer.

Project 3: Graphics Town

Project due date: Sometime after December 2nd. Probably December 9th. We want to give you as much time as possible for the project, but we need to have everything graded before the exam.

Note: for this project you may work together. If you plan to do this, BOTH teammates must send mail to the TA before November 21st.

You will be required to create a writeup as a web page. This will both describe your project (so we can make sure that we give you credit for everything you do) as well as ask you questions about the techniques that you used. Details will be posted after Thanksgiving, and the web page will be due on December 9th. (note: this is a hard deadline for the web page, it is not necessarily the project deadline). Instructions for turning in the webpage will be provided after Thanksgiving.


The goal of this project is to create a city. But, since you only have 3 weeks, it may be more like a town.You will create a program that allows the user to explore the town by flying around in it, or by looking at it from the vantage point of an inhabitant.Your town cannot be a dead place: there must be things moving around in it.

What is in your town, as well as what is happening there is up to you. We hope you will be creative. Make houses, trees, stores, cars, roads, helicopters, construction equipment, people, boats, ...What goes on in the town is up to you - make the cars drive around, drawbridges open and close, construction equipment operate, ...

If this sounds like its arbitrarily open-ended, you have the right idea. Clearly, you could make this as fancy as you want. Obviously, we will try to set our expectations to be only somewhat unreasonable :-) Our goal is to give you the opportunity to demonstrate your competence at writing 3D graphics programs, as well as an opportunity to experiment with some more advanced topics that you think are interesting.

The basic requirements are very simple. You should try to achieve them in a manner that provides flexibility so you can add fancier features as time permits. In terms of which fancier features to implement? You should pick the things that are most interesting to you. We will give you lots of ideas...

You will be allowed (encouraged, actually) to work in pairs on this assignment. That will be discussed below.

Pep Talk

Plan before you do any hacking. Decide on how to structure your program so that you can represent your town in a way that allows adding new things in the future.

A basic version of this assignment is no harder than project 2. Be sure to allow the user to fly around, and be sure to set things up in a way that allows for adding new features as you want.

Hopefully, by now you realize that bigger is not necessarily better for projects in this class. A well designed project will have much less code than a poorly designed one, and will make it much easier to debug and add fancy features.

In terms of choosing what features to add: pick things that you think will be interesting. If you are interested in a topic, this is a chance to try it out.

Be sure to look at the sample code that we provide. We will try to give you pieces that allow you to avoid some of the trickier OpenGl nuances, and allow you to focus on the graphics aspects.

I am giving you a lot of sample code. In fact, you can start with a complete working assignment and build from that.


Our goal in this assignment is to give you an opportunity to explore what it takes to make interactive graphics that look interesting.

Some of this is artistic. And your project should display some degree of artistic taste. However, in terms of your grade, effort spent on programming tricks are more valuable. For example, it is better to spend your time making a simple "blocky" car drive around in an interesting way and be lighted in a nice way, then to carefully model a gorgeous model of a car.

Basic Features

You must allow the user to fly around your town - that is, to see your town from any vantage point. While the prefered view might be as a pedestrian on the street, you must also provide the ability to get a "birds-eye" view of the town. The reason that we want this is so we can see more of what you've done.

The implementation of the flying interface is up to you. Be sure to document how to use your flying interface. Also, be sure to be able to use it yourself as we will ask you to take us on a tour of your town when you give your demo.

Things do not have to look right from inside of buildings.

Your town must include at least 3 types of buildings, roads, some foliage (e.g. trees), and at least 2 types of vehicles.

Your town must be "alive" - some of the things must be moving by their own accord. It is OK if some objects can be controlled by the user too, but some objects must just go about their business.

At least 5 objects must be moving around at any time. You might have cars driving on the roads, planes and helicopters flying through the air, people walking on the sidewalks, windmills spinning, trains, roller-coasters (hey- code re-use!) ...

At least one object in your town must be an articulated (hinged) object that animates. You might have a windmill that spins, a dumptruck that dumps, a drawbridge that opens and closes, a hook-and-ladder fire truck that raises and lowers.

At least 2 objects in your town must be texture mapped. Hopefully, you will use lots of textures to make things look more interesting.

You must have both a "day" mode and "night" mode. For one, the color of the sky should change. The lighting should change too. Besides just getting darker, lights "in the town" should come on (car headlights, streetlamps, ...). You may even want to environment map stars into the night sky and clouds onto the day sky.
Be warned: OpenGL supports only a limited number of lights at any time, so you might want to be clever to fake having more lights that you really do.

You must make at least one of your textures yourself. Your program must have more than one texture in it.

User Control

You should provide "shortcuts" - methods to automatically point the camera at places of interest. This will make it easier for you to give a quick tour of the town, or to show off something interesting.

You should provide the user with the ability to view the town from the vantage point of the vehicles. You might let the user select the vehicles in the town and view the world from that vehicle. You might even allow the user to "drive" the vehicle.

You might try to make a game out of it. As long as you are letting the user drive, let them race. Or achieve some objective.


Some of the objects in your world will move "by themselves." This means that you have to implement some method for making them move around. This could be very simple (e.g. a car just drives around in a circle), or as complex as you like (e.g. a car chooses a goal and drives there obeying rules of traffic).

Even with cars randomly driving around on roads, there are many different levels of challenge. For example, cars might just follow roads and turn abruptly. Or they might make "proper" arcing turns. If you're really fancy, they might even use turn signals!

Vehicles that follow predefined paths are easier to create than vehicles that randomly generate "correct" behavior. Start with making pre-defined motions, and then try to have your system generate the motion itself - be sure to let the vehicles avoid crashing into things.

Start with some simple behaviors (to meet the basic demands of the assignment) and add more complex behaviors if you like.


In this assignment, making things look interesting is important. A big part of this assignment is learning to use the facilities of a modern graphics system (like OpenGL) to achieve nice visual effects.

Making things look nice requires a combination of good hackery (using the graphics features like texture maps) and creativity. To make things look nice, create objects that have "realistic" shapes, and apply textures to them. As you increase the details of your town, it will become more interesting to look at.

Not everything needs to be texture mapped. However, some things are obvious candidates: put street and traffic signs, billboards, signs on stores, ...

Lighting details also make things more interesting. At very minimum, your program should use GL's lighting such that the scene looks 3D. Adding lighting effects such as shadows, "anti-shadows" (cones eminating from directional light sources), and atomospheric effects can make a big improvement. Experiment with the various hacks for creating these things by drawing geometry.

One specific suggestion: rather than just having day/night mode, allow the user to control the time of day. Have the shadows and lighting react accordingly.

Ground Rules and Grading

This is a completely open-ended assignment. However, there are some basic requirements. These were described in the Basic Features section above.

Implementing the basic features is more important for your grade than anything else. If you do something totally amazing, we might ignore the fact that you are missing something basic.

So, you might make some really nice looking cars; have them drive around in a completely realistic way; build a system of roads for them that they always follow; implement collision avoidance so they don't crash into each other, ... BUT: if you don't meet one of the basic requirements of the assignment, it will be harder for you to get a great grade. (not impossible, but harder)

For fancier features, things that have technical merit are more valuable than things that have purely artistic merit. For example, implementing spot-light cone effects from streetlights (which requires some hacking tricks) is more valuable than having very detailed models for your cars. In general, if a feature illustrates that you've used some advanced graphics concepts it helps your grade more.

We have no hard rules about what is worth what. Each project is usually different from all other projects. If you're curious as to whether something is worthwhile to do, feel free to ask. Originality is definitely worth a lot.

As a generally rule of thumb, to get an A, you must do something that is impressive.

Working Together

For this assignment, we allow you to work with a partner. However, there are some rules for doing this:

  1. Each person on a team gets the same grade for the project. We appreciate honesty in saying who did the work, but if you are lucky enough to find a partner who does everything for you, well, ultimately you will lose out because you won't learn as much.
  2. Before the checkpoint, you must send the TA email saying who you will be working with.
  3. After the checkpoint, you may not break up your group.
  4. All team members must be present at the grading demo.
  5. Each person must create at least one texture (plus any that you find off the net or we give you). Each person must create at least 2 types of moving objects (including defining its behavior), and 1 type of building.

This project is easily broken into pieces. If you give some thought to your basic framework, each person can add different types of objects to the world without interfering with the other person. Some coordination is required in designing the framework.

Note: we will expect more from teams than from people working by themselves.


If you're feeling overwhelmed at this point, don't worry. It's to be expected when starting a big project. Here are some thoughts on how to get started:

  1. The most basic piece is probably the infrastructure to represent objects in your world. Design a base class for objects in your world. It should include a "draw" method, and probably some other stuff too.
  2. Someplace, you will probably want to keep a list of "objects in the world."
  3. Make a few very basic objects first, to make sure things work.
  4. Build some simple viewing infrastructure, including camera controls. It will be hard to test your objects if you can't look at them.
  5. Use simple lighting first. Add more complex lighting after you have basic pieces working.
  6. Give some objects simple behaviors to begin with. Once you have a framework for objects to independently "behave," start experimenting with more complex behaviors.
  7. Make use of the code from other projects! For example, you know how to read TGA images using libtarga, so you can use that to load in your textures.
  8. Consider using the sample code as a starting off point.

We will provide you with some resources to make this easier.

One thing that should be of use are some notes on how to get textures working with OpenGL. This includes my Texture Manager - a piece of code you might find useful. Remember: you must make at least one of the textures yourself!

The Sample Solution

We will also let you look at parts of our sample solution. The executable is available, as are some of the files. Actually, the compelete source code of the sample is there. The whole thing is in a zip archive.

If you want to run the program on a CS machine, a built version is in "p:/course/cs559-gleicher/public/bin/grtown.exe" (or it will be there soon).

You may use this sample solution as the starting point for your own project, however, you will be graded on what you add to the sample. That means that all the requirements of the Basic requirements must be made in addition to what is already there (e.g. you have to define two more behaviors, ...).

If you do use the sample solution, you must do the following:

  • The flying UI is lame. You must fix it.
  • The "following" camera is bad - you must fix it.
  • You must make at least 3 objects that are moving around at any time (in addition to objects I've defined).
  • You must define at least 2 new types of buildings.
  • You must define at least 2 new types of vehicles (or moving objects).
  • You must make at least one articulared object (there isn't one in the current demo)
  • You must make at least 1 texture yourself.
  • Your grade is based on what you add to my program. If you start with my program, what you end up with had better be really good.

Each of the last 2 times I gave this assignment, about half the students started with my program. There was almost no correlation between grade and whether or not they used my code; there were some excellent things built on my program, and there were some barely acceptable things build from scratch. (all in all, people did really well - it's a fun assignment, so people get into it).

Some Fancier Examples

You could make a fire truck that drives around. Periodically, a building could catch on fire (draw flames), the fire truck would drive to the building, extend its ladder, ...

You could have a train track that crosses the streets of the town. When a train comes, crossing gates should go down to prevent cars from being hit.

You could have a bus that stops at bus stops. People get on and off the bus when it is stopped.

You could have traffic lights at street intersections. Have the cars stop at red lights.

Even more advanced topics ...

Put into a seperate file (since this is already is getting long...).