Skip to content

chamaselion/cut3d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cut3d

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.

Status

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.

What Changed vs 42_cub3d

Architecture

  • 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.

Graphics / Dependencies

  • 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.

Scope

  • 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).

Makefile Rewrite: What Was Added and Why

The top-level Makefile is intentionally very different from the original one in 42_cub3d/.

Added in cut3d Makefile

  • CXX/CXXFLAGS C++ build flow instead of C-only compilation.
  • SDL2 / SDL2_image linking (-lSDL2 -lSDL2_image) instead of MLX42 linking.
  • perf target with aggressive optimization flags (-O3, -march=native, -flto, optional -ffast-math).
  • Utility targets for practical development:
    • install-deps (Linux apt dependencies)
    • check-deps
    • run
    • help
  • Colored status output for faster feedback during iteration.

Why These Changes Make Sense

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".

Build

You can build either with Make (fast workflow) or CMake (project configuration workflow).

Make

make

Performance build:

make perf

Run with default map:

make run

CMake

cmake -S . -B build
cmake --build build
./build/cub3D maps/map.cub

Performance flags through CMake option:

cmake -S . -B build -DPERFORMANCE_BUILD=ON
cmake --build build

Requirements

  • C++ compiler (e.g. g++)
  • make
  • cmake
  • SDL2
  • SDL2_image

On Debian/Ubuntu:

sudo apt-get install -y libsdl2-dev libsdl2-image-dev

Run

./cub3D maps/map.cub

or any custom .cub map:

./cub3D path/to/your_map.cub

About

This project is born out of the cub3D project at 42, originally written in C. The key changes are switching to CPP and ditching MLX for Microsoft Windows compatibility (aaand some common sense). The project build is also changed to use cmake.

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors