Projects / Project 2

Project 2 - Trains and Roller Coasters

 

1.  Overview

In this project, you will create a train that will ride around on a track. When the track leaves the ground, the train becomes more like a roller coaster. If you're curious, you can look at previous years' projects (2007, 2006, 2005, 2003, 2001, 2000, 1999) to see what to expect. Each year's requirement is slightly different, but the basic ideas will be the same. Historically, students have really liked this project.

The main purposes of this project is to give you experience in working with curves (e.g. the train and roller coaster tracks). It will also force you to think about coordinate systems (to make sure that things move around the track correctly). In the past, a big part of this project (especially in terms of time) was to make the 3D user interface, but this year, we will give you framework code so that you don't need to worry about that so much.

The core of the project is a program that creates a 3D world, and to allow the user to place a train (or roller coaster) track in the world. This means that the user needs to be able to see and manipulate a set of control points that define the curve that is the track, and that you can draw the track and animate the train moving along the track. We'll provide the framework code that has a world and manages a set of control points. You need to draw a track through those points, put a train on that track, and have the train move along the track.

In the past, we expected students to build the system from scratch. Last year, we created a new sample solution that better shows off some of the features you might want to include. In the process, we decided that we would give you most of the code so you can focus on writing the interesting parts (in terms of the assignment). Yes, it will take you some time to figure out our code, but it will be much less than it would take you to write it yourself. (Although, if you want to work hard, you are welcome to do that - see below).

Basically in this project you will need to:

  • Find your way around the framework code.
  • Add the basic functionality: draw a track (curve) based on the control points and draw a train on that track. If you do the latter part correctly, the framework will make it easy to animate the train going around the track. You will also need to implement a "train view" (so the user can "ride" your train).
  • Add more advanced features: nicer drawing of the track, arc-length parameterization, more kinds of splines, physics, ...
  • Add special effects and extra features to make it really fun. Really nice looking train cars, scenery, better interfaces for creating complex tracks, ...
  • I must emphasize that the basic functionality is most important, and the core advanced features (arc-length parameterization) are the next most important things. Fancy appearance (like using textures and pretty lighting) aren't the focus here - add them only if you have time after doing the more important things.

    We have provided a sample solution (also see the discussion of the source and framework) of the possible features (at least the most common ones). We recommend that you play with it a bit to understand how it works. The example also has options that lets you see some of the most common mistakes and simplifications that students make.

    There are two example solutions to this project in /p/course/cs559-lizhang/public/train-examples. One is a version that Prof Mike Gleicher wrote and another was written by a really good student (robs-train, requires glut32.dll under the same directory). I recommend that you try them out to get an idea as to what you'll be doing.

    Mike's sample train, circa 1999

    Rob Iverson's A+ assignment from 1999

    While the assignment was a little bit different in 1999, the basic idea was the same. For a totally crazy solution to this assignment, check out RocketCoaster.

    Note: at the beginning of the project, you might not understand all the things we're going to ask you to do. Don't worry - you'll be learning it all soon enough!

    2. Basic Rules

    Historically, this project is done individually. This semester, you are expected to complete the assignment in groups (two people in each group).

    Your program must use OpenGL and run on the XP computers in the department computer lab (like everything else in this class). While we strongly recommend you use the framework code, this is not a requirement. The Framework/Example solution uses FlTk, but you can use any UI toolkit that you wish, providing it's available on the department machines as we need to be able to build your program.

    If you want to use other external libraries/code, please ask us. Something like a math library or data structures library is probably OK, but please check.

    The project is due on Monday, April 4th. Late projects are accepted according to the class late penalty. We will probably grade these assignments with scheduled live demos - these will be announced before the due date, so you'll know when they start (and very late projects will not be accepted).

    3. The Basic Functionality and Framework

    The most basic part of this assignment is to provide a "world" for the train track. Your program must do the following things (all of these are provided by the provided framework): If you make your own framework, please make sure you can do all of these things. You won't get many extra points for writing it yourself, but you will lose points if you don't have the basic features.

    The basic/essential features you must add:

    The framework code is designed to make it easy to add all of those things. In fact, there are "TODO:" comments explaining where to plug them in. See the the discussion of it in the provided framework.

    The framework code was used to make the sample solution. We didn't give you all of the files, but you can see the "hooks" to the parts we didn't give you (they are turned off with a macro). In some places, we intentionally left extra code for you to look at as a hint. The framework has some spiffier features (like drop shadows), and some features you may not need (the control points have "orientation").

    Among the two sample solutions (Mike's and Rob's), Mike's sample solution (mikes-train.exe) does not do all of these. (the train doesn't have a front, and the only scenery is the point light source - also, there's a wierd bug where the train stretches out when it goes down a hill).

    4. Advanced Features

    Meeting the basic requirements will get you a basic grade (definitely a C or better). But to get a better grade, and to really make the assignment fun, you should add some advanced features to your train.

    Note: the exact point values for each of these is not given. The rough guide here will give you some relative importance (big features are worth more than small ones).

    We will only check the features that you say that you have implemented correctly. Partial credit will be given for advanced features, but negative credit may be given for really incorrect features. (so, its better to not say you implemented a feature than to show us something that is totally wrong).

    Also, remember that in your demo, you will have to show off the feature, so think about what demonstration will convince us that it works. For example, with arc-length parameterization, you're best off being able to switch it on and off (so we can compare with the normal parameterization), and think about a track that really shows off the differences.

    5. Bells and Whistles

    These are really advanced features. It is much better to have the advanced features (that are really central to the assignment) than these frills, but frills can be fun. And we will give you points for them (but remember, you can't get points for frills unless the more basic stuff works)

    We divide this project as 5 stages.

    6. Phase 1 - Written assignment: Model Transformations

    This written assignment is described on this page.

    7. Phase 2 - OpenGL OpenGL Programming Signs of Life

    The purpose of this phase is to:

    1. Make sure you have worked out the mechanics of getting and OpenGL program to compile.
    2. Can work out the basic mechanisms for making interactive programs.
    3. Can make programs that do animation in OpenGL.

    These are all essential elements for your roller coaster. So we want you to try doing these things without all of the added complexity of curves and 3D.

    You must turn in a program that:

    Once you are able to do these simple tasks by yourselves, you are in a better position to read and understand our skeleton code for this project, which does much more complex tasks.

    The tutorials will guide your through learning the basic skills you need to complete this assignment. Be sure to read the OpenGl Survival Guide for help getting started. The Main.Tutorials will help you with the mechanics of getting your program to compile and give your some ideas for user interfaces. The Main.SampleCode will provide you with useful elements for building things (particularly RunButton). Here is another simple sample code for building the RunButton.

    6. Phase 3 - Written assignment: Curves and perspective transformations

    In order to make a roller coaster, you need to understand curves and perspective transformations. So we'll give you a written assignment described here designed to give you some practice.

    The exam will cover the same material, so this assignment will be good practice for the exam. In fact, a portion of the problems from this written assignment will appear on the exam (with some of the details changed to discourage you from trying to just memorize the answers).

    If you work hard enough, you may be able to find the answer sheet to these howemwork questions. However, we discourage you from doing so because you won't have a chance to do so in the exam. Also, the previous answer sheets may have errors. It's embarrassing that you give a wrong answer that is the same as in the previous answer sheet. It happened when I taught last time.

    7. Phase 4 - Programming Checkpoint

    We want to make sure that everyone is making good progress on the project. In particular, we want to make sure that by March 24th (about 10 days before the project is due), you've at least gotten the basic 3D interactions working. Here is a skeleton solution code for this project that has many UI functions implemented for you as a good starting point this phase.

    For this phase, you need to read the skeleton code, well understand what it has done and what remains to be done, and where you should add code to get these additional things done. We're just checking for the first pieces to make sure you've started.

    Be warned: if you only have these basic requirements done by the checkpoint, you still have a lot of work to do. To avoid having a hectic week before the project is due, we recommend that you have more than the checkpoint requirements done.

    Your roller coaster program will need to have the following features.

    If you download the skeleton code, you will notice it has many of these features already. We actually encourage you to use the skeleton code to make your interface. Your main job is to read and understand it.

    8. Phase 5 - The Roller Coaster!

    For this part of the project, you will turn in the actual roller coaster simulator, and the required documentation. As with all projects, we will evaluate your project both in a demo session (where you get to show it off) and by evaluation of your code and documentation.

    You must implement all the basis functions, and advanced functions if you want a higher grade, and some of bells and whistles if you enjoy doing so.

    This is the actual project when you turn in your train/roller coaster program and feel the big sense of accomplishment that you've created something really cool. Along with the program itself, you'll turn in documentation as to how it works. >Remember: while the majority of you project grade will come from our evaluation of your final program, the earlier stages do count too! In addition, the written assignments are important practice for the exams, so blowing them off will also hurt you there. Finally, the checkpoints are important to make sure you're making progress over the entire 5 weeks of the project: this project is a lot to do in 1 week, but not so bad if you think of it as a 5 week effort.

    7. What to turn in

    By the deadline (Apri 5th) you must turn in:

    6. Documentation

    Your README.txt should explain the following: