This project is a first person 3D
maze game. Similar to Wolfenstein or Doom, minus enemies and weapons, although they may be added later. It was made using SDL2
and C
. It runs on Mac OS X and Linux/Ubuntu. The game uses the technique raycasting to create the apparent 3D
nature of the maze. The Maze is a 3D Maze game that uses ray casting to render a 2D map into a 3D navigable world!
The Maze was written in C using SDL2
library. Deveploment was performed using Ubuntu 14.04 LTS - gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.
- Mac OS X or Linux/Ubuntu
- SDL2
If you don't have SDL2 installed download the installation script here. Then find the script and run it in your terminal:
$ ls
install_SDL2.sh
$ chmod 755 install_SDL2.sh
$ sudo ./install_SDL2.sh
First step is to clone the repo:
git clone https://github.com/elyse502/The-Maze-Project.git
Compile all .c files in the maze directory:
elysee_niyibizi@pc:~/maze$ gcc -g -Wall -Werror -Wextra -pedantic -I/usr/local/include/SDL2 ./src/*.c -o maze -L/usr/lib/x86_64-linux-gnu -lSDL2 -lm
Alternatively, just use the make command:
make
Run the maze with the map you'd like to play:
./maze maps/level_1
Or you can run with multiple maps at once:
./maze maps/level_1 maps/level_2
Some basic maps are provided in this repo in the maps/ directory, but you can make your own maps to play as well.
After running ./maze maps/level_1
you should see a screen like this:
If you're using the provided maps it'll just be a red screen, but that's not all. If you rotate with the arrow keys to the right you'll see the rest of the maze:
The goal of the game is to find the end of the maze. To move through the maze use the arrow keys. The left and right arrow keys will rotate the player. The up and down arrow keys will move the player forward or backward.
Currently the player's starting position and the end goal position of the maze can be decided when creating the map file. If no positions are stated in the file then the player starts in the top left corner and the goal will be in the last floor space in the file.
When you have found the end of the maze you will either move, rather abruptly, to the next maze or the game will exit and you will be greeted with a win message in your console.
The files in the maps/
directory provide examples of the file format for a maze to work with this game. The different characters in the file represent different colored walls, the floor, the player position, or the position of the end goal.
Example of a maze file:
![level_1](https://private-user-images.githubusercontent.com/125453474/284515537-ab557086-bf51-4fd2-8da6-4f2dc7ac0cbe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU4OTU2NDAsIm5iZiI6MTcyNTg5NTM0MCwicGF0aCI6Ii8xMjU0NTM0NzQvMjg0NTE1NTM3LWFiNTU3MDg2LWJmNTEtNGZkMi04ZGE2LTRmMmRjN2FjMGNiZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwOVQxNTIyMjBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iMDE2ZDQ4OTRlYWJjNzIyMmQ3ZThiZmI3ZTg1ODI3OWE0MzI1MzE3MDc2MzRlN2E3NTg4ZmEwNDBlN2MyM2M5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.joyUQ22LnV_AzgmihWGy3ULeaA_dGtx51LIVdWa9jg8)
In the image above the player starts 2 spaces in from the top left corner, and the end goal is placed in the bottom left most space that isn't a wall. There are five columns that are mostly blue, but have green, yellow, and white wall chunks in them.
Map File Characters' in Game Meanings
- 0: Floor/walkable space
- 1: Red Wall
- 2: Green Wall
- 3: Blue Wall
- 4: Yellow Wall
- w: End goal
- p: Player start position
- All other characters will be defaulted to white walls
Click on The PICTURE☝️
📍This project is still a work in progress more detail on the project will be available in the future🍿📺🍿
- NIYIBIZI Elysée | Github | Linkedin | Twitter.
This project is licensed under the MIT License - see the LICENSE file for details.
All work contained in this project was completed as part of the curriculum for Alx-Africa. Alx-Africa is a remote-based full-stack software engineering program that prepares students for careers in the tech industry using project-based peer learning. For more information, visit this link.
- ALX staff: For the help, advice, and resources throughout the project and curriculum.
- Cohort 13 and all ALX students: For friendship, support, and insights over the last year.
- YOU: For reading this documentation and testing out The Game. I hope you enjoyed the ride!
If you like how I present and document my work do me a favor of giving a Star ✨ to my Repos |&&| a Follow 👥