CPE 471 Spring Quarter


Ugs McBugs: Spidey McGee and the Curious Case of the Forbidden Temple tells the story of Ugs McBugs, an ugly spider on a quest to get rich or die tryin'. Inspired by the popular game Temple Run, Ugs McBugs is a game where players need to collect coins and avoid falling off the platforms while the camera is moving the character forward. A giant gem await our ugly friend at the end of the maze. Our goal for this project was to implement a fun and beautiful game that shows off the core concepts we learned in class.


Vivian Fong (
Jacob Johannesen (

Run Commands

> mkdir build
> cd build
> cmake ..
> make -j4
> ./UgsMcBugs ../resources

Game Controls

m - Start/pause game
z - Turn left
x - Turn right
, - Move left
. - Move right

The camera can be controlled with the WASD keys to observe the scenery.

Features and Implementation

The following graphics techniques were utilized:


All models were created from scratch using Blender.

Blinn-Phong shading & texturing with normal maps

We utilized Blinn-Phong shading for our lighting scheme and incorporated texturing with normal maps to provide a more realistic and three-dimensional feel to the models. There is a centralized light source at the center of the sky.

Particle systems

We incorporated the fountain-like particle system from Lab 11 to the instances when a coin or gem is collected and also when Ugs explodes. In order for the particle system to be at the right spot and only spawn once, we maintained a vector of activeParticleSystems to keep track of particle systems that have ignited and are still rendering. For example, when a coin is collected, we create a particle system at that location and add it to the vector of activeParticleSystems. The program will render all particle systems in the collection. If all particles within a particle system have reached their full lifespan, the particle system is then erased from the vector.

Maze randomization

In order to construct a random maze, we decided to run a probability check after every five platforms to determine whether the direction of the maze should be changed, and if so, to which direction. We keep track of the current direction and assign a list of booleans to each platform representing its edges. For example, the first 5+ platforms will be going forward, meaning these platforms will all have edge booleans of [false, true, false, true] representing north, west, south, and east. This means that the platform has an edge on the west and east sides. Then, if a right turn is introduced, the last platform before the turn will now have its edge booleans changed to [true, true, false, false]. The current forward direction will now be west, and the next 5+ platforms will follow this direction.

Maze maintenance

We constructed bounding boxes for each platform in the maze. To keep track of which platform Ugs is currently on, we store a variable currPlatform that we increment once Ugs has stepped out of the bounds on the current platform. We compare the minX, maxX, minZ, and maxZ of the platform's bounding box with Ugs' location. If Ugs is within bounds, then we are still on the same platform. If Ugs is out of bounds, then we check which side he has stepped off. If the edge booleans assigned to the platform indicates that it has an edge on that side, Ugs has fallen off the platform. Otherwise, Ugs has moved on to the next platform and we increment currPlatform.

Bounding spheres & collision detection

In order to perform collision detection against the floating coins, we constructed bounding spheres for each object. Each time Ugs is rendered, we conduct a sphere-to-sphere collision test between him and each existing coin. A sphere-to-sphere collision test entails comparing the Euclidean distance between the origins of both spheres with the sum of the two spheres' radii. If the distance is less than or equal to the sum, the two spheres are colliding. If the objects are colliding, we delete the coin in question and spawn the particle system for that particular coin.

Animated camera turns

Ugs moves in the forward direction of the camera. To make Ugs turn in the maze, we turn the camera ±90 degrees. The rotation is successful, however the camera immediately jumps to the new angle making gameplay confusing and difficult. To counteract this, we decided to animate the camera rotation. To do this, we had to instead increment the rotation matrix by a small delta each time the game is rendered until the full 90 degrees is reached. This allowed for the camera to turn smoothly and not leave the player confused with sudden camera shifts.


Similar to a skybox, but instead of using a cube we decided to use a sphere. We added to the sphere a lovely sky texture and rotated the texture clockwise along the y-axis to emulate a moving cosmic sky.


Audio Player library
Several Textures