Skip to content

Ray-casting project using Wolfenstein as reference 👾

Notifications You must be signed in to change notification settings

DjoykeAbyah/42_CUB3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cub3D Project 🎮

simplescreenrecorder-2024-06-03_15 22 59-ezgif com-video-to-gif-converter (1)

In collaboration with Daoyi Liu.

Overview 📝

Welcome to the cub3D project! This project is a part of the 42 curriculum and involves creating a realistic 3D graphical representation of a maze from a first-person perspective using ray-casting principles. This README will guide you through the setup, building, and execution of the project.

Table of Contents

Introduction

Imagine yourself as a developer in the 90s, tasked with creating a 3D game engine from scratch. Your goal is to build a program that generates a realistic 3D maze, navigable from a first-person perspective. You will use the ray-casting technique, the same technology that powered early 3D games like Wolfenstein 3D. Welcome to cub3D, where you bring these classic concepts to life using modern tools provided by the MLX42 library.

Getting Started

Clone

Clone the repository:

git clone 
https://github.com/yourusername/42_CUB3D.git

Compile and Run

There are two versions of the program, the mandatory part and the bonus part. The bonus part adds a minimap, and the ability to rotate the view by moving the mouse.

To compile the mandatory part, cd into the cloned directory and:

make

To compile the bonus part, cd into the cloned directory and:

make bonus

To run the program:

./cub3d <path/to/map.cub>

The program takes a map file as an argument. Maps are available in the maps directory. There are maps that work according the rules of the program and maps that will give an error explaining why it won't work.

Arguments

The program accepts one argument:

  • A map file with the .cub extension, which describes the layout of the maze.

Controls

The following controls should be implemented for navigating the maze:

  • W: Move forward
  • S: Move backward
  • A: Move left
  • D: Move right
  • Left Arrow: Rotate left
  • Right Arrow: Rotate right
  • ESC: Close the window and quit the program
  • Red Cross on Window Frame: Close the window and quit the program
  • Mouse: Rotate by moving the mouse (bonus only)

Map Format

The map file describes the layout of the maze and should contain:

  • 0: Empty space
  • 1: Wall
  • N, S, E, W: Player’s start position and initial orientation

Example .cub File 📝

Here’s an example of what a .cub file might look like:

NO ./path_to_the_north_texture
SO ./path_to_the_south_texture
WE ./path_to_the_west_texture
EA ./path_to_the_east_texture
F 220,100,0
C 225,30,0

1111111111111111111111111
1000000000110000000000001
1011000001110000000000001
1001000000000000000000001
111111111011000001110000000000001
100000000011000001110111111111111
11110111111111011100000010001
11110111111111011101010010001
11000000110101011100000010001
10000000000000001100000010001
10000000000000001101010010001
11000001110101011111011110N0111
11110111 1110101 101111010001
11111111 1111111 111111111111

Bonus List ✨

  • Wall collisions 🧱: Prevent the player from walking through walls.

  • A minimap system 🗺️: Display a minimap of the maze..

  • Rotate the point of view with the mouse 🖱️: Allow mouse control for viewing direction.

    Wish List✨

  • Animated sprites.

  • A minimap system resizing minimap🗺️.

  • Closing and opening doors.

About

Ray-casting project using Wolfenstein as reference 👾

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published