Finding Lotso

CPE 471 Final Project - Fall 2021 - Created By Chloe Lo

Overview

In this project, I created a maze game, which you need to navigate inside the maze and find the lotso bear in the at the end. You will be able to re-entry the maze and find the lotso bear at the other end of the maze. The main techniques I want to focus on this project is the hierarchy model, camera, and collision between the objects.

Video Demo

Screenshots

example image example image example image example image example image example image example image example image example image

Feature

Create Maze

To form this maze, I created a 11 X 11 matrix (ASCII table, W means wall) in a text file, and store it into a 2D array. Therefore, when I draw the maze, I can draw it in a correct scale and right coordinates. This 2D array is very useful, which also helped a lot of implementing collision between the wall of the maze and dummy.

Here is the breakdown of the hierarchy model:

                        → Hip
                            → right upper leg
                                → right lower leg
                            → left upper leg
                                → left lower leg
                            → head and neck
                            → torso 
                                → right upper arm
                                    → right lower arm
                                → left upper arm
                                    → left lower arm
                                → belly
                    

Hierarchy Model

I used dummy as the hierarchy model. There is a challenge while implementing the motion of the dummy because the dummy in the obj file is facing down. Therefore, when I rotated it to face up, the y-axis and z-axis will be switched. So, I have to be careful on it and do the correct rotation in the corresponding axis.

Camera

I used third person camera in this game. It is one of part that take me a while to make it work. Finally, I am inspired by the first person camera we learned from class. First of all, I need to make dummy as the look at point, so when I do WASD control, the camera will follow its movements. However, I don’t want the dummy followed the camera move when I scroll to any direction, but I want the view is started and central from dummy’s will. Therefore, I need to reverse the look at point and camera location. The angle of movement will only affect for scroll function.

Collision

There is a collision between the dummy, soldier, maze. I used point to bounding box to form the collision. As I have a 2d array to store all the coordinates for each cube, I create the bounding box of each cube by its coordinates, max, min. The action of collision will dummy and maze is that dummy cannot go through the maze and stay in the same location. When dummy was caught(touched) by solider, the dummy’s location will be reset to the start point. When the dummy found the one end and hit the lotso, lotso’s location will move to the other end and the dummy can find it again.

Instancing

I used instancing to draw all the tree in the scene. This is a really useful technique to draw the duliplicate object in different location. It shorten the running time of the program, also make the code cleaner. Before I used instancing, I need to using 5 parts to draw the tree in 3 sides, which is pretty long and not include all sides either. Therefore, I chose to use instancing instead of drawing it one by one. The challenge I have is that when I tried to store the location of each tree into a vector of vec3, I cannot load the data into the shader. After several hours attempts, I figured it out that I need to use a float pointer to get each vec3 and load it into the shader.

Texture and Skybox

I used different texture to make the scene more realistic. The ground and the maze are using different type of grass texture. Also, the skybox is using the picture with sky and mountain. Besides, when I draw the skybox, I tried to draw a bigger box, so that it won't be too close to the ground. However, it will form a gap between the 2 sides. Therefore, I found the maximum size I can scale is 45.0, which is not bad and still not too close to my ground and all the object.

Key Control

Key Action
A move the dummy to the left
D move the dummy to the right
S move the dummy backward
W move the dummy forward
Srool-Up look the scene 80 degrees up
Srool-Down look the scene 80 degrees down
Srool-Left look the scene 360 degrees start from left
Srool-Right look the scene 360 degrees start from right