Skip to content

Cub3D is a game engine written in C. It is inspired by one of the first FPS Wolfenstein3D.

Notifications You must be signed in to change notification settings

LoisDuplain/cub3D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧱 cub3D 🎥

platform: osx 10.14.x language: c framework: opengl framework: appkit library: minilibx library: best-libft 42 login: lduplain

Cub3D is a game engine written in C. It is inspired by one of the first FPS Wolfenstein3D.
Created by Loïs Duplain. (42login: lduplain, 42mail: [email protected])

🖼️ Gallery

Gource (click on image):

Screenshot - Map: ./maps/debug.cub

Screenshot - Map: ./maps/minecraft.cub

Screenshot - Map: ./maps/white-chamber.cub

🏗️ Compile

To basically compile program:

make

To recompile entire program:

make re

To clean all *.o in project:

make oclean

To clean all *.o in project and libraries:

make clean

To clean all *.o and compiled things in project and libraries:

make fclean

▶️ Run

To basically run:

./cub3D <map_path_1> <map_path_2> <map_path_...>                (default maps in ./maps folder)

Automatically save first frame:

./cub3D <map_path_1> <map_path_2> <map_path_...> --save         (default maps in ./maps folder)

🎮 Controls (QWERTY)

Player movement:

W A S D

Camera rotation:

▲ ▼ ► ◄

Screenshot:

F2

Previous/next level:

< / >

Decrease/increase render distance:

K / L

Decrease/increase pixel divider:

Page Down / Page Up

Decrease/increase FOV:

NumPad Sub / NumPad Add

📝 Parsing

Resolution:

R <width> <height>

Example:
R 1920 1080

Walls:

NO --> North Wall
SO --> South Wall
WE --> West Wall
EA --> East Wall

You can put texture or color on wall:

XX  <r,g,b>
XX  <path>.xpm

Example:
XX  31,219,81                    --> Green
XX  ./textures/debug/north.xpm   --> Path to texture (default textures in ./textures folder)

Floor/ceiling:

F --> Floor
C --> Ceiling

You can put texture or color on floor/ceiling:

F  <r,g,b>
C  <path>.xpm

Example:
F 255,0,0                        --> Red
C ./textures/debug/ceiling.xpm   --> Path to texture (default textures in ./textures folder)

Map description:

2     --> Sprite
1     --> Wall
0     --> Walkable
Space --> Void
N/S/W/E (North / South / West / East) --> Player spawn point and direction

Example:
1111111111111
1000000000001
1200000000021
1001010101001
120000S000021
1001010101001
1200000000021
1000000000001
1111111111111

✨ Bonuses

  • Look up and down
  • Texture on ground and ceiling
  • Collide with walls
  • Collide with sprites
  • Fog
  • Multi level
  • Changing FOV in-game
  • Crosshair
  • Minimap
  • Move camera with mouse
  • Multi threading
  • Replace texture by color in parsing
  • Changing render distance in-game
  • Changing pixel divider in-game
  • Max frames per second and ticks per second
  • Take a screenshot

🖥️ 42

Subject

Mark: 42-project-mark

⚖️ Copyright

Loïs Duplain (lduplain) © 2020