cut3d is the C++ evolution of the original 42_cub3d project included in this repository.
The original version was built under strict 42 school constraints; this version intentionally removes many of those constraints to move toward a reusable raycasting engine.
This project is a work in progress.
The goal is to become a base engine for implementing raycast-based games, providing items, actions and high level of modularity.
- Original (
42_cub3d): C codebase with a project layout optimized for the assignment scope. - Current (
cut3d): C++ modular design (Game,Renderer,Map,Player,InputHandler,TextureManager,ItemManager,PlayerManager,Logger) aimed at extensibility.
- Original: MLX42 + custom C utility stack (
LIBFT). - Current: SDL2 + SDL2_image, with a cleaner path toward portability and richer tooling. SDL2 is cross-platform (Linux, macOS, Windows), so the current codebase is easier to build on those platforms; Windows users should install the SDL2 development libraries or use a package manager (vcpkg/MSYS2) or CMake-provided packaging to obtain the required SDL2/SDL2_image binaries.
- Original: satisfy assignment requirements (single-player raycasting renderer with strict rules).
- Current: keep the raycasting core but prepare the codebase for engine-style growth (systems, managers, logging, configurable builds).
The top-level Makefile is intentionally very different from the original one in 42_cub3d/.
CXX/CXXFLAGSC++ build flow instead of C-only compilation.- SDL2 / SDL2_image linking (
-lSDL2 -lSDL2_image) instead of MLX42 linking. perftarget with aggressive optimization flags (-O3,-march=native,-flto, optional-ffast-math).- Utility targets for practical development:
install-deps(Linux apt dependencies)check-depsrunhelp
- Colored status output for faster feedback during iteration.
Most of these changes were either forbidden or outside scope in the original school project, but they are useful in a real engine workflow:
- They make performance testing explicit and repeatable.
- They improve day-to-day developer ergonomics.
- They support moving from "assignment implementation" toward "maintainable engine base".
You can build either with Make (fast workflow) or CMake (project configuration workflow).
makePerformance build:
make perfRun with default map:
make runcmake -S . -B build
cmake --build build
./build/cub3D maps/map.cubPerformance flags through CMake option:
cmake -S . -B build -DPERFORMANCE_BUILD=ON
cmake --build build- C++ compiler (e.g.
g++) makecmakeSDL2SDL2_image
On Debian/Ubuntu:
sudo apt-get install -y libsdl2-dev libsdl2-image-dev./cub3D maps/map.cubor any custom .cub map:
./cub3D path/to/your_map.cub