4451 - Fall 2005 - Project 1

P1a: Subdivision, Render, Animate, Web page

Develop or adapt a 2D polygon editor and subdivision code to produce an interactive tool for designing race-tracks. Render the race track as a thick curve (road) with a centerline. Animate a small dot moving along the track. Implement two modes: parametric speed, which moves to the next vertex of the subdivision at each time step, and constant speed, which advances at uniform speed along the track.

On your web page, post a link to P1a. On the P1a page, describe briefly the project requirements, explain how you have implemented them (language, system, what code was your inspiration and starting point, how you have modified/enhanced it), provide a link to your source code with detailed comments (almost each line). Include pictures with captions showing the track before and after an editing operation, and showing keyframes of the two animation modes.

Explain precisely how you have computed the subdivision (provide equations, figures) and which subdivision scheme have you chosen and why.

Explain precisely how you implement the two animation modes and discuss the numeric accuracy of your implementation.

P1b: Show acceleration static and during animation, Optimize

Compute acceleration vector at each sample along the track centerline for each mode (constant and parametric speed). Draw them as line segments proportional to a force (acceleration) that would push the runner into the turn. (If the runner turns left, the line segments should be on her right.) Select an appropriate scale for these segments, based on trial and error or some heuristics. Design a track that clearly show that the two modes may produce drastically different acceleration fields.

Select an upper bound on the magnitude of the acceleration felt by the runner (remember that the acceleration has a tangential and normal component) so that about half the time it is exceeded. Show in a different color the places where that threshold is exceeded.

Now assume that the dot starts from a stationary position and has control over its tangential acceleration, which must be in [-1,+1], where the unit is a pixel side. Devise a strategy for reducing the time for going around the track (staying on the centerline) without ever exceeding the force threshold for which you tested above. (You control the tangential acceleration, but ensure that the acceleration vector combining tangential and normal acceleration does not exceed the threshold, if it did, you would start skidding.)

On your web page, put a P1b link to a new page in which you should describe this part of the assignment, present your solutions, pictures, results, and link to commented source code.

Specifically, you must explain how the acceleration is computed (use formulae and figures to clarify) and how it is decomposed into its tangential and normal components. Also explain how you have chosen the threshold. Then discuss several strategies for racing and explain which one you have chosen and why. Provide detailed explanations on how you have implemented it. Explain how you would evaluate its performance against the optimal strategy and how we could make races between student solutions.

Make a stroboscopic picture (showing the dot positions after constant time intervals) illustrating that the point must slow down when approaching sharp turns and then accelerate for long straight runs. Optionally, capture a short animation and post a link to the video (it can be low resolution to save storage).

P1c: Follow (2D), Fly behind (3D), Draw 3D runner, Lean runner

Replace the dot by a pointy triangle whose sharp tip constantly faces the travel direction.

Then, use view rotations to translate and rotate the whole space (track and triangle) so that the triangle appears to be stationary and at the center of the screen with its tip pointing up.

Then, apply a 3D rotation to the whole space that tilts it so that the camera appears to follow the triangle, looking at it from behind and higher up. Use a perspective view.

On the triangle, position a 3d model of a human runner made of simple primitives (cylinders, spheres, triangles...). Then, lean the model to compensate the tangential and normal accelerations during the race.

In your P1c page, as usual, provide a write-up, figures, links. In particular, explain how you orient the sharp tip of the triangle (providing and explaining equations, pseudocode...). Explain how you do the rotation of the view for the 2D and 3D parts, providing pseudocode

Compare this viewing style with what is used in some of the racing video-games. What is good about it? What is missing?

Explain how you compute and implement the leaning. Justify your solution by physical principles and clarify your assumptions about the dynamics.

Study how abruptly the leaning angles of the runner change. Relate these changes to the continuity of the curve and to your racing strategy.

P1d: Control acceleration of second runner, Detect skidding, Skid motion

Add a second runner (different color) whose tangential acceleration and turning radius are controlled by the mouse. Use local coordinates. Vertical mouse motions control the tangential acceleration. (click and drag the mouse down will make you slow down.) Horizontal mouse motions control the radius of curvature of your trajectory. (Click and drag the mouse left will make you turn left).   Fine-tune the parameters until you get a natural feel and can drive the second runner.

Have the second runner lean to compensate acceleration. Attach the camera to the second runner. Have both runners start at the same time. Fine-tune your acceleration range so that you can compete with the first runner, while staying on the road (the first runner stays on the centerline).

Detect when the second runner exceeds that acceleration threshold and if so, induce a skidding motion, during which there is a friction force and a reduce traction.

In your write up, provide the details on how you implement the controls of the second runner, how you detect and animate the skidding.

P1e: Detect off-road, increase Friction, Shake camera

Detect when your runner gets off the road. When so, impose a strong friction force.

While the runner is off the road, make the camera shake. The frequency of the shaking should be proportional to the speed.

Usual write up on a separate web page. Include details of how you detect that the runner is off the road, how you implement the friction, how you make the camera shake.

P1f: Moving obstacles, collision Detection, collision Reaction, Report Timing

Design periodic trajectories for other runners, who are not in the race, but cross your tracks a few times. Show scenes/animations with the two competing runners and several of these other guys.

Detect collisions with the other guys. You may use 2D collision tests with enclosing disks.

First show that you detect collisions properly by making the other guy invisible for a second. Then, implement proper collision reaction (using a model of a 2D elastic shock between disks).

Time the race and report how well the player did and whether he outrun the first runner.

Usual write up on a separate web page. Include details of how you designed the trajectories for the other runners, how you test for collision, how you compute the velocities after collision, what happens with the other runner after collision, what you do with the orientation during collision reaction.

Also, provide a roadmap of how you would extend/improve your program to produce a more engaging and more realistic game.