Skip to content

42sin/cub3d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

cub3D

My first RayCaster with miniLibX
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Features
  5. License

About The Project

Subject PDF

This is the second group project of the 42 core curriculum.
It is inspired by the world-famous Wolfenstein 3D game and is an opportunity to explore the large world of ray-casting. This project’s objectives are similar to all this first year’s objectives: Rigor, use of C, use of basic algorithms, information research etc.
As a graphic design project, we had to use the 42 graphics library miniLibX.
To conclude cub3D is a remarkable playground to explore the playful practical applications of mathematics.
With the help of the numerous documents available on the internet, you will use mathematics as a tool to create elegant and efficient algorithms. This project was done in collaboration with Florian Bindereif.

(back to top)

Getting Started

Prerequisites

To run the project, OpenGL and AppKit are required for the miniLibX library to work properly.
If you want to run this program on Linux here is a tutorial that might help to install the library on Linux. This was not tested by us, so you may face problems.

Installation

  1. Clone the repo
    git clone https://github.com/42sin/cub3D.git && cd cub3D
  2. Compile the project
    make
  3. Run the program
    ./cub3D map.cub

(back to top)

Usage

  • Move your camera with your arrow keys or by dragging with your mouse
  • Move the character with WASD
  • Interact with the environment by pressing Enter

Here is an example

(back to top)

Features

You can change the windows size, movement speed, difficulty, minimap size, etc. inside of srcs/includes/cub3d_defines.h

Gameplay

  • minimap
  • move the camera by leftclicking and dragging or by pressing the arrow buttons
  • pressing ESC or clicking the cross of the window closes the program
  • enemies
  • wall collision
  • game gets closed when an enemy touches you
  • doors that can be opened/closed
  • 5 different sprites (barrel, light, pillar, door, animated enemy)

Map

Inside of the repository you are provided with an example map but feel free to change the map to your likings, as long as it is a valid map. You can also change the textures as well inside of textures/

  • 0 define walkable spaces
  • 1 define walls
  • D define doors
  • F defines where the enemy spawns
  • B defines barrels
  • L defines lights
  • P defines pillars
  • the players position is displayed by:
    • N player is facing north (top of the 2D map)
    • E player is facing east (right side of the 2D map)
    • S player is facing south (bottom of the 2D map)
    • W player us facing west (left side of the 2D map)
  • the map has to be enclosed by walls on all sides
  • set all the textures that should be used as wall texture i.e.
    • WE images/1.xpm
    • EA images/2.xpm
    • SO images/3.xpm
    • NO images/4.xpm
  • set the ceiling color, i.e.:
    • C 0, 183, 183
  • set the floor color, i.e.:
    • F 141, 1, 126

For more information about the specific requirements and tasks, check out the Subject PDF.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages