Skip to content

FrenkenFlores/Cub3D

Repository files navigation

Cub3D

This project is inspired by the world famous Wolfenstein 3D game, which was the first FPS ever. The project enables to explore ray-casting and practical applications of mathmatics. The goal is to code a first person game.

note: graphics been implemented using minilibX library, which is a graphics library similar to X11 that works on Mac systems. Also i used the following projects:

Configuration

The configuration file is located at maps/ and has *.map extension. It contains information about screen resolution, textures, colors and map. You can freely configure that file: change map, color, textures (only *.xpm extensions are supported). You can also create your own configuration file. The program takes as an argument the configuration file.

Example of configuration file

R 800 400
NO ./textures/book_shelf_nourth.xpm
SO ./textures/book_shelf_south.xpm
WE ./textures/book_shelf_west.xpm
EA ./textures/book_shelf_east.xpm
S ./textures/coin.xpm
F 0,38,77
C 190,190,211
    111111111111111111111
    100000000000000000001
    100002000000000200001
    100000000020000000001
    100000000000000000001
    10000000020W002000001
    100000000000000000001
    100020000000000200001
    100000000000000000001
    111111111111111111111

R - resolution
NO - north walls texture
SO - south walls texture
WE - west walls texture
EA - east walls textrue
S - sprite texture
F - floor color (R,G,B) C - ceil color (R,G,B)

The map 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.

note: for the map to be valid, it has be surrounded by walls.

Build instructions

git clone https://github.com/FrenkenFlores/Cub3D
cd Cub3D
make

launch game

./cub3D ./maps/map.cub

take screenshot

./cub3D ./maps/map.cub --save

Commands

A - turn left
D - turn right
W - move forward
S - move backward
ESC - close application

Gameplay