Project 4
Required Features:
Continuous Movement
Walls & Doors
Keys
User Input
Collision Detection
Floors & Ceilings
Lighting
New Maps
Additional Features:
Lighting & Materials:
(x) Add multiple Point Lights to the scene file
The program can create up to 20 point lights based on the map file.
(x) Create a flashlight that moves with the player (must be a spot light)
Press 'l' (lower case L) key to turn on/off the flashlight. The flashlight is pointing at the player's forward direction by default. Moving the mouse to make the camera view point down a little will display the flashlight on the floor better.
(x) Texture map the walls and floors (use different textures for different models)
I textured walls, floor and ceiling with 3 distinct texture images.
( ) Bump map or normal map the walls and floors
User Interface
(x) Integrated keyboard and mouse control (must support strafing/sidestepping)
'a', 'd' makes player side step left and right
'w', 's' and UP/DN arrow makes player move forward and backward
+ many other key controls specified in the User Control session below
(x) Jumping (must be smooth & realistic for full credit)
Press space key to make player jump up. Press space key while holding other movement control key such as 'w' / UP, 's' / DN, 'a', 'd', makes the player jump to the respective directions.
Jumping is illustrated in the Controls Demo
Dynamic Environment
(x) Add characters to the environment which move on their own (perhaps chase the user slowly). These characters should not move through walls.
The game supports unlimited number of skeleton adversaries specified in the map file.
( ) Character interaction: Allow the user to freeze or shoot the other characters at a distance (you cannot freeze or shoot through walls!).
( ) Place items in the environment that alters a character’s abilities (power ups).
(x) Animate the process of doors opening after they are unlocked.
Doors opens gradually from its initial position to its final opening position when player approaches it with the matching color keys.
Currently the game supports two axis aligned orientations and two swinging directions.
Environment
(x) Procedurally generate levels (there should always be a solution)
Levels are controlled by preset maps hard-coded in application.cpp. Player moves to the next level when he/she reaches the goal. Level information is displayed in the console. A score is displayed in the console after the player wins the game (reaches the goal in the final level).
All 8 maps included in the game have solutions.
(x) Create your own 3D models to represent the user, keys, doors, non-player characters etc.
I created a door using wings3D software. This model is used in the game. (an image is captured below)
(x) Load existing models in the OBJ 3d format: http://enwp.org/Wavefront_.obj_file
I wrote a simple python program to convert obj files to the model txt file format that the game program accepts. Using this program I generated the player, key, treasure chest, and skeleton models used in the game (images of those models are captured below)
(x) Make a video of yourself playing, showcasing your features
A 9min video demonstrating me playing the game is below. (I fast played the game to keep the video from getting too long)
(x) Two artistic/well-composed screenshots from your game
See below.
Team Member:
Hailin Archer
Code:
https://github.com/CyberHolmes/CSCI5607/tree/main/Project4
How to compile the code
$ make clean
$ make
How to run the program
$ ./app
start with level 1 scene map
$ ./app ./maps/<FILENAME>.txt
start with the scene map specified in the command line. However it will proceed to level 2 when the goal is reached.
$ python ConvertObj.py
Convert 3D obj files to the .txt file format that this game program accepts.
User Controls
Player Keyboard Control:
'w' / UP: Move player forward
's' / DOWN: Move player backwards
'a': Move player to the left
'd': Move player to the right
'l': Turn on flash light
'space': Make player jump up (combining with forward/backwards/left/right key makes the player jump to corresponding direction)
LEFT: Turn the player to the left
RIGHT: Turn the player to the right
SHIFT: Speed booster - double movement speed and turn speed when pressed together with the respective movement key
*Note: Unit moving and turning speed is hard-coded as global variables specified in camera.h
Player Mouse Control:
Holding down left mouse button while moving the mouse - Adjust the player's view angle
Scrolling mouse wheel - Zoom in/out (Adjust FoV)
Controls for Debugging Purpose
't' key - Toggle between top view and first person view.
'o' key - Turn on/off direction light
'r' key - reset the scene to the beginning (does not modify level, also keeps current player facing angle)
Game Control
'escape' - quit program
Map File Legend
0 - Nothing
W - Wall
A,B,C,D,E - Color coded doors
a,b,c,d,e - Color coded keys
S - Player's start position
G - Goal
L - Point light (maximum is 20)
Z - Skeleton
Description:
This is a treasure hunting game. The goal is to navigate through a maze to find a red treasure chest. Once the player reaches the treasure chest, the player will be automatically placed in the scene of the next level. There are 8 levels. Starting with scenes without doors, to scenes with color coded doors requiring matching color keys to open, to scenes with moving skeleton adversaries. In the scenes with skeleton adversaries, the skeletons will move towards the player if the player is within line of sight. The player must avoid getting 'touched' by the skeletons. Once that happens, the scene will be reset and the player has to replay the same level. Currently there is no limit for how many times the player can retry the level.
This project was not easy to start for me. The most difficult part is to understand how to work with OpenGL. I feel I am barely scratching the surface of it. Without Dr. Guy’s sample code, it would have taken me a lot longer to get started. Once I abstracted basic OpenGL functions to instance models, add textures, it worked smoothly notwithstanding the usual time consuming debugging process.
I implemented all required features and all but 3 extra features. Most features work well. I handled corner cases for most of them. However, due to limited time, some features are flawed. Adjusting orientation for moving objects such as doors, adversary characters is not perfect. My doors swing differently depending on the orientation. The skeletons don't always face their forward direction (however, they do turn). The skeletons can be stuck at the corner of the wall if it 'sees' the player but its perimeter is intersecting the wall, The reason for this is that I am using center position of the characters to test intersection, instead of perimeter. The skeletons can also walk through each other. And my cube texture are not always oriented horizontally.
This is just the start of a 3D game. There is much more to do to make this game more enjoyable and aesthetically appealing.
Video Demos:
Full Game Demo
00:15~00:20 - Demo that player cannot go through wall
00:32 - Reach goal at level 1, moving into level 2 scene
00:33 - Start level 2
01:14 - Start level 3 (door with key)
01:20 - Demo that player cannot go through door without key
01:31 - Player cannot go through corner of wall
01:39 ~01:42 - Player acquire key
01:50 ~01:52 - Door open
01:59 - Start level 4 (Different color coded doors)
02:01 ~ 02:07 - Demo player cannot go through red door with yellow key
02:22 ~ 02:25 - Demo player cannot go through blue door with green and yellow keys
03:12 - Start level 5 (A large maze, took a bit longer to demo through, there is no new features compared to previous levels)
05:36 - Start level 6 (start of having skeleton adversary)
06:05 - Sight of skeleton
06:07 - Clash with the skeleton, leading to restart of the same level
06:21 - Start level 7 (multiple skeletons)
06:54 - Start level 8
07:52 - Clash with one skeleton, restart of level 8
08:36 - Completed level 8. Program ends.
09:02 - Demo console output.
Controls Demo
Door Opening Demo
Door Opening Demo Top View
Other Mobile Characters Demo
At the end of the demo the player was 'touched' by an adversary and the game reset to the beginning of the scene
Top View Of Available Scenes:
Level 1 - A simple maze, no doors, (spheres are where point lights are)
(based on one of the two provided scene files)
Level 2 - No Doors, a little more complicated maze
Level 3 - A simple maze, with one door and a key to open it.
(based on one of the two provided scene files)
Level 4 - A slightly more complicated maze with 5 doors of different color code and 5 matching keys
Level 5
Level 6 - 1 skeleton
Level 7 - 4 skeletons
Level 8 - 2 skeletons potentially blocks the player's way to the goal
Models Loaded From Existing Obj 3D Format
3D Model I Created Using Wings3D:
Art Contest
Treasure Chest In Spot Light
Skeleton Attack
Skeleton Party