Table of contents
I alway had the dream of combining math and programming in hopes of creating cool stuff with them, so after spending a bit of time searching I got advised to enter the world of graphics programming. this was my first choice as a project for this topic.
This project is a simple implementation of a raycasting engine which will render a pseudo 3D world using 2D linear algebra calculations in order to cast rays and render the world based on them. Basically the further the ray is stopped and has hit a wall, smaller the height of the wall will be which is a stripe with length of one pixel.
Headers and source files are separated into to different directories, include
and src
.
Source files are all in src
and defined headers are in include
.
- Globals.hpp - Where all Global settings are stored.
- MyFuncs.hpp - Where commonly used functions are declared.
- Game.hpp - Where all configuration of the application window and events are done.
- Map.hpp - Where map and its logics are set up.
- MyTriangle.hpp - This is a Draw able sprite for the map.
- Player.hpp - Configuration for camera which is the player's eye.
At first clone the repository:
$ git clone https://github.com/Sephixum/SFML_Raycast.git
As an exmaple you can first generate a build directory for cmake:
$ cmake -S . -B build
Build and compile:
$ cmake --build build
You can run the project:
$ ./build/raycasting
You can move around the map using W
A
S
D
.
Camera can be rotated with keys H
(anticlockwise) and L
(clockwise).
Arrow key Down
and Up
can be used to increase of decrease vision density.
You can reset your vision density with R
.
I have been studying concepts from Lode's Ray Casting Tutorial so here is the link for it.
Special thanks to my dear friend MiliAxe for aiding me in designing and releasing this project.