Slytherin Snake Game

Tristen Miller - CPE 471 - Fall 2016 - Zoe Wood

Features

Hierarchical Modeling

Hierarchical Modeling

The snake itself is comprised of hierarchically modeled cubes. Each cube is in a direction relative to the previous cube. Directions are stored in a queue. When the snake is turned, the last item in the queue is removed and the new current direction is placed at the the beginning.

Skybox

Skybox

The game is on a floating platform surrounded by an skybox open-world. It uses GL_TEXTURE_CUBE_MAP to bind the images into a cube, and glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) to make edges unnoticable.

Collision Detection

Collision Detection

The game maintains a 2D array of locations of where the snake currently is. It stores 1 if there is a cube at that location and 0 otherwise. It checks against itself and the borders of the platform to determine whether a crash occured. Apples are also eaten this way.

Text Rendering

Text Rendering

2D text on the screen is rendered as a texture using the library FreeType. FreeType is what linux uses to render text. It loads a font at a large size, converts it to a texture, and displays it in world space billboarded towards the camera.

Camera Control

Camera Control

Camera is either fixed two cubes behind the snakes head (first person) or is significantly above the snake (third person). When the snake is turned, the position and the yaw of the camera is smoothly pivoted to the new direction.

Textures & Lighting

Textures & Lighting

The platform, the snake, the apples, and the lasers each have unique textures. Everything is lit using traditional phong lighting. The lasers are semi-transparent with varying transparency to simulate a flickering effect.

Controls

A Turn Left D Turn Right V Switch View

Resources

LearnOpenGL - Text Rendering

LearnOpenGL - Cubemaps

Anton Gerdelan - Cubemaps

Moon Skybox Image

Image Library

Text Library