This is project where I made a C++ engine much like Wolfenstein 3D that uses raycasting to simulate a 3D environment. I added the SDL2 library in order to easily render a window and paint a buffer on screen which contains the color data. The basic idea of the engine is that there is a 2D array of 32-bit integers, which will be the map. When there is a "0" then it means that it's a free space and the player can move, anything else represents a block. From the player's starting position I send out a vertical ray until it "hits" a block (a number that is not 0), then the distance of the player to the block is calculated and the further away it is then the smaller the wall should be drawn on the screen (a vertical stripe). Here is the link to the project on Gitlab: Raycast engine |
|
---|---|
Figure 1: Un-textured engine. | Figure 2: Un-textured engine. |
Figure 3: Textured engine. | Figure 4: Textured engine. |
Figure 5: Textured engine with floor and ceiling. | Figure 6: Textured engine with floor and ceiling. |