Cub3D is a 3D game engine built from scratch using low-level C programming. It implements raycasting to create a pseudo-3D perspective, similar to early 90s games like Wolfenstein 3D. This project is a collaborative effort by two developers, aiming to demonstrate our proficiency in C and our understanding of computer graphics principles.
- Raycasting Engine: Utilizes raycasting to render a 3D-like environment from a 2D map.
- Customizable Maps: Supports custom map creation with a simple text file format.
- Basic Game Mechanics: Includes player movement and basic collision detection.
- Texture Mapping: Implements texture mapping for walls to enhance visual realism.
- Keyboard Controls: Allows navigation through the 3D world using keyboard inputs.
- Pause and Map Toggle: Adds functionality to pause the game and toggle the map display.
- GCC compiler
- Make
- CODAM MLX library
After building the project, you can run the game using:
./cub3d path/to/your/mapfile.cub
- W: Move forward
- S: Move backward
- A: Strafe left
- D: Strafe right
- Left Arrow: Turn left (or mouse)
- Right Arrow: Turn right (or mouse)
- P: Pause the game
- M: Show/Hide the map
- C: Enable/Disable mouse control
- ESC: Exit the game
The map files are simple text files with the .cub extension. The format is as follows:
- 0: Empty space
- 1: Wall
- N, S, E, W: Player's starting position and orientation (North, South, East, West)
1111111111
1000000001
1000010001
100N010001
1000000001
1111111111
- src/: Source code files.
- include/: Header files.
- maps/: Example map files.
- textures/: Texture images used in the game.
- Makefile: Build script.
Fork the repository. Create your feature branch (git checkout -b feature/your-feature). Commit your changes (git commit -am 'Add your feature'). Push to the branch (git push origin feature/your-feature). Create a new Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.