Unreasonable Uber

Matthew Key

CSC 471 - Winter 2020

I set out to make a clone of an old video game, titled "Crazy Taxi," in which you drive around a city picking up and dropping off passengers, earning points the faster and crazier you drive. Of course I wouldn't and wasn't able to match the gameplay, but I believe this project represents some barebones graphics that are on the right track. I was also keen on learning and implementing a new lighting scheme and multiple lights, which I was able to do, although not to the full extent that I had originally hoped.

Computer Graphics Technologies

Program Controls

Further Explanations

The first technology I focused on past the course content was Spot lighting. This wasn't very difficult, and LearnOpenGL.com has a very good tutorial here. The same site has a useful tutorial for attenuation, which was also easily implemented and helped to achieve the desired "night time" lighting.

I intended on implementing multiple street lights, but this proved challenging as, without special methods, number of lights in a single openGL scene is limited both by the language and the hardware. I also found later on that additional factors tend to slow down my program anyway, so I went for a lighter approach: two spotlights for the headlights of the car, one above the car to show off its texture, and one street light above the passenger/goal.

Collision detection is simple in my case, as I felt a sort of "bounding ring" approach was appropriate and, in my head at least, computationally lighter. I achieve this by calculating the distance between two objects then checking if the distance is less than or equal to the two objects' assigned radii summed together. Collisions are detected on buildings vs. car, passenger vs. car, goal vs. car, and world edges vs. car.

I used this distance calculation to fix a problem I had run into early on in my process, which was that too many instances of the building model I had chosen would slow down the program. Instead of rendering the entire world, I only render the buildings that are within a certain range of the player car. I also used distance as a variable in a mathematical formula to change the height of where the buildings are, that way they were given a sort of rising out of the ground effect as the player drives closer to them.

Finally, I use input from a text file to generate the world around the player. The text file contains a 100x100 ASCII representation of the world, using '-' to represent empty space and 'b' to represent a building. The program reads the file into a 2D array, then references this array during the rendering loop. The rendering loop also references this array to find an open space to place the passengers and goals, randomizing positions in the grid until an open space is found.

Example Screenshots

Above the car is an arrow, pointing to either a passenger to pick up or a goal to drop them off at.

You can collide with passengers to pick them up.

Once a passenger is picked up, take them to the randomly spaned goal point to earn a point.

Resources