Skip to content

ugoi/cub3d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cub3D

Summary

This project involves creating a small 3D game, using a graphics library called miniLibX. The game is a maze where the player moves around and can look in different directions, with walls and textures displayed in a 3D perspective.

Instructions

This project has been developed under certain constraints and requirements, which include:

  1. Using miniLibX Graphics Library.
  2. Setting the floor and ceiling colors to two different ones.
  3. Displaying different wall textures that vary depending on which side the wall is facing (North, South, East, West).
  4. Allowing smooth management of the window: changing to another window, minimizing, etc.
  5. Allowing the user to use the keyboard to look left and right in the maze and to move the point of view through the maze.
  6. Allowing the user to close the window and quit the program cleanly using either the ESC key or by clicking on the red cross on the window's frame.
  7. Parsing a scene description file with the .cub extension, which includes a map composed of only six 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.

Usage

To run the program, use the following command:

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

Replace <path/to/map.cub> with the path to your scene description file with the .cub extension.

Scene description file

The scene description file must follow specific rules and formats, including:

  • A map composed of only six 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 must be closed/surrounded by walls, or the program must return an error.
  • Each element in the file (except the map) must have a type identifier, followed by specific information for each object in a strict order.
  • Each element (except the map) can be separated by one or more empty line(s).
  • Each type of element can be set in any order in the file, except for the map which always has to be the last.
  • Each type of information from an element can be separated by one or more space(s).

Example of a valid scene:

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
10010000000000000000000011111111
111111111011000001110000000000001
100000000011000001110111111111111
11110111111111011100000010001
11110111111111011101010010001
11000000110101011100000010001
10000000000000001100000010001
10000000000000001101010010001
11000001110101011111011110N0111
11110111 1110101 101111010001
11111111111111111111111111111

Authors

CUB3D was created by UGOI and jide_O as part of the 42 school curriculum.

About

My first RayCaster with miniLibX

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published