Skip to content

jos-felipe/cub3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

184 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cub3D - A Wolfenstein 3D-style Game Engine

A raycasting-based 3D game engine inspired by Wolfenstein 3D, developed as part of the School 42 curriculum. This project implements fundamental computer graphics concepts to create a dynamic first-person perspective in a maze environment.

Project Status Language License

🎮 Features

  • 3D Rendering Engine

    • Raycasting-based rendering
    • Textured walls with different textures for each direction (N,S,E,W)
    • Dynamic view with proper perspective
    • Configurable floor and ceiling colors
  • Player Controls

    • Smooth movement using W,A,S,D keys
    • Camera rotation with left/right arrow keys
    • Wall collision detection
    • Field of view management
  • Map System

    • Custom map format (.cub)
    • Dynamic map loading
    • Support for different map sizes
    • Validated map parsing with error handling

🛠️ Technical Requirements

  • GCC compiler
  • Make build system
  • MLX42 graphics library
  • Math library (-lm)
  • GLFW library (-lglfw)

📦 Installation

  1. Clone the repository:
git clone https://github.com/yourusername/cub3D.git
cd cub3D
  1. Install dependencies (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install build-essential libglfw3-dev
  1. Build the project:
make

🚀 Usage

Run the program with a map file:

./cub3D asset/map/ninja_temple.cub

Map Format (.cub)

The map file should contain:

NO ./path_to_north_texture.png    # North wall texture
SO ./path_to_south_texture.png    # South wall texture
WE ./path_to_west_texture.png     # West wall texture
EA ./path_to_east_texture.png     # East wall texture

F 220,100,0                       # Floor RGB color
C 225,30,0                       # Ceiling RGB color

# Map layout (1 = wall, 0 = floor, N/S/E/W = player start position)
111111
100101
101001
1100N1
111111

🎮 Controls

  • W - Move forward
  • S - Move backward
  • A - Strafe left
  • D - Strafe right
  • - Rotate camera left
  • - Rotate camera right
  • ESC - Exit game

🏗️ Project Structure

.
├── src/
│   ├── ch0/    # Scene/Map parsing
│   ├── ch1/    # Window management
│   ├── ch2/    # Raycasting engine
│   └── ch3/    # Texture management
├── include/    # Header files
├── lib/        # External libraries
└── assets/     # Textures and maps

✨ Completed Features

  • Scene parsing and map validation
  • Window and event management
  • Ray-casting engine implementation
  • Texture mapping system
  • Performance optimization
  • Wall collision detection
  • Player movement and rotation
  • Error handling and memory management

🤝 Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📜 License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

🙏 Acknowledgments

  • School 42 for the project subject
  • Id Software for the original Wolfenstein 3D
  • MLX42 library maintainers
  • The GLFW team

📧 Contact

J Felipe D Stieven - @jos-felipe

Project Link: https://github.com/jos-felipe/cub3D

About

This project is inspired by the world-famous Wolfenstein 3D game, which was the first FPS ever. It will enable you to explore ray-casting. Your goal will be to make a dynamic view inside a maze, in which you'll have to find your way.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Generated from jos-felipe/sdk