# GL-ASTEROIDS

## video game program

### HYPERSPACE • THRUST CONTROL • MANEUVERS

#### PRESENTATION VIDEO

#### ANIMATION TECHNIQUES

- Dynamic Keyframes • The core goal of the project was to implement dynamic keyframing. In assignment 1, we implemented keyframes that were set at compile time. For my project, the user is able to trigger dynamic keyframed animations with the press of a button. The the positions of the keyframes and the time it takes to interpolate between them are functions of the position and velocity of the ship at the moment the animation was triggered.

- Particle Effects • I also decided to implement a particle system to better convey actions and events in the game. Particles are generated whenever the ship accelerates in the forward direction. As the particle approaches the end of its lifespan, its color transitions from a deep red to a light yellow.
  Particles are also created whenever the asteroids are destroyed. A particle explosion can be seen following the collision of a beam and an asteroid. If the ship collides with an asteroid and it has no more lives left, the ship will explode as well.
  My explosion system was adapted from the `Particle` class provided for Lab 6, which uses `GL_POINTS` drawn as "billboarded" quads with alpha blending.

- Collision Detection • Collisions are managed through bounding spheres for both the asteroids and the spaceship. When initialized, each asteroid has a predetermined radius that is used to calculate the size of its hitbox. Continuous sphere-to-sphere collision detection is performed for the spaceship and all of the asteroids. Laser beams are represented internally by line segments, and line-sphere intersections are performed to check if they collide with any asteroids while they are "active".

Whenever the hitbox of an asteroid overlaps with the hitbox of the spaceship, the spaceship either explodes or takes damage in the form of a life. The ship will turn red to convey that it took damage.

#### CONTROLS

- The WASD keys can be used to move the ship around the map.
- The Q and E keys trigger left and right barrel-rolls, respectively.
- The SPACEBAR key triggers a somersault.
- The J key can be used to fire a plasma beam. Use this to destroy the asteroids!
- The V key can be used to switch between third-person, top-down, and first-person cameras.
- The P key can be used to pause the game.
- The B key can be used to toggle bounding spheres.
- The F key can be used to increase the field of fiew.
- The G key can be used to decrease the field of view.

#### RESOURCES

- The following libraries were used for the development of this project:

- CMAKE for "out-of-source" build compilation. Available here.
- GLM for useful data structures and OpenGL-like syntax. Available here.
- GLFW for creating windows and input detection. Available here.
- GLEW for OpenGL extension loading. Available here.
- EIGEN3 to map vector values to a specific location in memory. Available here.

- Spaceship model was obtained from Sketchfab.
- Asteroid model was obtained from Free3D.
- Line-segment-sphere collision detection code was based off of a guide from Baelung.
- Random float generation was obtained from this Stack Overflow post.
- Website PumpOpti font was obtained from FFonts.
- Website background was obtained from reddit, and was created by u/astrellon3.
- Music in the presentation video background is called Asteroid Run. It is from the game Cybernator for the SNES.

#### DOWNLOAD