Skip to content
/ cub3D Public
forked from ringii21/cub3d

This project allowed us to explore the technique of ray-casting, where the objective was to create a dynamic view within a maze.

Notifications You must be signed in to change notification settings

semx2a/cub3D

 
 

Repository files navigation

Cub3D

Summary

Cub3D is a group project that was inspired by the world-renowned 90's game and the first-ever First Person Shooter, Wolfenstein 3D. This project allowed us to explore the technique of ray-casting, where the objective was to create a dynamic view within a maze.

Visuals

Project Structure

The repository is organized with the following structure:

  • Makefile: Automation script for compilation and project management.
  • inc/: folder containing header files function prototypes and necessary definitions.
  • src/subdir/*.c: Source files implementing various functions.

Rules

  • The project must be written in C.
  • Adherence to the 42 School Norm is mandatory.
  • The program should not terminate unexpectedly, and memory must be handled properly to avoid leaks.
  • Allowed External Functions: open, close, read, write, malloc, free, perror, strerror, exit

Usage

make
./cub3D [map].cub

Maps are provided in the maps/ folder.

Features

  • w s a d : Move forward / backward / left / right
  • : Rotate the view
  • ESC : Exit

Rendering

  • Render using an isometric projection based on Bresenham algorithm.
  • Input coordinates provided in a file, with each number representing a point's position and altitude.
  • Utilize Minilibx library for rendering. The MinilibX is a simple X-Window (X11R6) programming API in C, designed for students, suitable for X-beginners.
  • Display the rendering in a window.
  • Ensure smooth window management (resizing, minimizing, etc.).

Acquired Skills

  • Understanding and implementing graphic rendering techniques.
  • Working with external libraries like MiniLibX.
  • Effectively managing memory and avoiding memory leaks.
  • Developing a robust and well-structured C program.
  • Handling user interactions in a graphical environment.

Troubleshooting

If the git submodules didn't clone properly, you can run the following commands to clone the submodules:

git submodule update --init --force --remote

For macOS users, the project needs a X11 server to run. You can install it with Homebrew using the following command:

brew install xquartz libx11 libext
reboot

If you have an issue with the window size, you can change the corresponding macros in the include file cub3d_macros.h located in the inc/ folder:

# define WIDTH 1200
# define HEIGHT 1500

About

This project allowed us to explore the technique of ray-casting, where the objective was to create a dynamic view within a maze.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 86.7%
  • Makefile 13.3%