Giter Site home page Giter Site logo

cub3d's Introduction

Cub3D

Cub3D is a project that aims to create a realistic 3D graphical representation of the inside of a maze from a first-person perspective using the Ray-Casting principles. (basically a recreation of the classic Wolfenstein 3D game)


Requirements

Requirements for Linux:

  • make
  • gcc
  • package xorg
  • package libxext-dev
  • package libbsd-dev

➜ Requirements installation for Debian Distributions:

sudo apt-get install gcc make xorg libxext-dev libbsd-dev

Requirements for Mac:

  • Xquartz

➜ Requirements installation:

Brew install Xquartz
reboot
xeyes

Installation

git clone https://github.com/irhesri/cub3D.git
cd cub3D
make

Usage:

  • Start The executable:
./cub3D [map name]

Note:

  • If the map doesn't exist in the same directory you should provide the path along with name [path/map_name].
  • The map extension should always be .cub

The map:

The map file should be a plain text file with the following elements:

  • NO: the path to the texture used for the north-facing walls
  • SO: the path to the texture used for the south-facing walls.
  • WE: the path to the texture used for the west-facing walls.
  • EA: the path to the texture used for the east-facing walls.
  • F: the color of the floor
  • C: the color of the ceiling
  • The map: it must be composed of only 6 possible characters: 0 for an empty space, 1 for a wall, and N,S,E or W for the player’s start position and spawning orientation.

The map rules:

  • The map must be closed/surrounded by walls.
  • There should be only one player in the map.
  • Elements can be separated by one or more empty lines, and they can appear in any order in the file. Additionally, each type of information within an element can be separated by one or more spaces. The map content itself is not subject to these rules
  • Spaces are a valid part of the map.
  • The colors of F and C written in R,G,B form.
  • The texture image should have .xpm extension.

Example:

./cub3D ./maps/map2.cub

cub3D

Controls:

  • : Allows you to rotate the view left and right
  • w s : Allows you to move forward and backward
  • a d : Allows you to move to the left and to the right
  • [Only in Mac] The mouse mouvements : Allows you to rotate the view left and right
  • ESC : Close the window

Restrictions:

  • Only the next functions are allowed:

open, close, read, write, printf, malloc, free, perror, strerror, exit

All functions of the math

All functions of the MiniLibX

  • You must use the MiniLibX.
  • Global variables are forbidden.

Credits

The mlx library used in the project was provided by Minilibx.

Special Thanks

  • A big thank you to @Imane for her valuable contributions!

cub3d's People

Contributors

irhesri avatar sben-chi avatar

Watchers

 avatar

Forkers

irhesri

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.