bendordie / cub3D

cub3D v1.0 with non-optimized raycasting alghorithm, low FPS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cub3D

My implementation of a first-person 3D engine based on the Raycating technology used in such legendary projects as Wolfenstein 3D, Doom, Doom 2.

screenshot

About

The project is based on the raycasting technology, the principle of which is to "trace" rays from one coordinate, which is a viewpoint, to other objects. The rays are built in 2D plane to calculate the distance between objects, in order to build them later in 3D space.

Config file

2D plane in this project is a two-dimensional array of 0 and 1, where 0 is empty space, and 1 - the wall. The starting point of view or just the player is denoted by one of the capital letters of the 4 main sides of the world ("N", "E", "S", "W"). The array may also contain so-called sprites - static plane objects through which the walls can be seen (digit 2). This array is stored in a separate configuration file with the extension .cub, examples of which can be found in the folder maps. In this file you will also find other settings for the application such as the ceiling and floor colors in RGB format, paths as texture files for the walls in four different orientations. And of course you need a separate texture for the sprite (indicated by the letter S).

You can make changes to it to your taste - other textures, change the formatting of the map, change the colors. But be careful, the format is strict, be guided by the example.

  • R 800 600 - screeen resolution
  • NO ./img/xp1.xpm - texture for north wall
  • S ./img/barrel.xpm - texture for sprite
  • C 225,0,0 - ceil color
  • F 0,255,0 - floor color

The map must be enclosed on all sides by walls:

111110
100001
100001
111111
 
This is invalid map cause of zero at the right top corner.

Getting started

Write make in the console in the root directory of the project. Then ./cub3d maps/map21.cub

It is also possible to take a screenshot in .bmp format. To do this, run the application with the appropriate parameter:

./cub3d maps/map21.cub --save
 
The screenshot will be saved in the root of the project.

About

cub3D v1.0 with non-optimized raycasting alghorithm, low FPS


Languages

Language:C 72.6%Language:Objective-C 11.3%Language:Swift 9.9%Language:Roff 4.5%Language:Makefile 1.7%