THE MAZE PROJECT

Alazar Yeh
3 min readJan 12, 2023

--

Hello,

I am Alazar.

My name is Alazar, and I developed a project called The Maze to apply my programming skills in the C language, which I acquired during the program developed by ALX. The challenge was to generate a virtual tour using only the C language and the SDL2 library, with no game engine or support tool to generate graphic elements. It was a personal challenge for me to test my skills in solving algorithmic problems, which were enhanced through the foundations stage at Alx Africa.

The Maze project was inspired by the world of the famous video game, Wolfenstein 3D, which is built from a grid of walls of uniform height. To draw the world, a single ray is traced for each column of pixels on the screen, and a vertical slice of the wall texture is selected and scaled according to the lighting striking the wall and the distance traveled by the ray before it does. The goal of The Maze is not to build an exact replica of the video game or match it in complexity, but to generate the basic infrastructure to obtain an approximate model of the game environment and the player’s movement.

The technologies used in the project are the C programming language, GCC compiler version 11.3.0 (Ubuntu 11.3.0–1ubuntu1~22.04), GNU Make, and the SDL2 library. C, C#, and C++ languages are preferred by professional developers of high-end video games due to their efficiency and versatility, and are also used for developing all kinds of software, frameworks, especially systems, such as the Linux kernel, and compilers, libraries, and interpreters of other programming languages. GCC is commonly used on most UNIX-like systems such as Linux and Mac OS X, and it is available for a wide variety of processor and platform architectures.

The Maze uses Raycasting, which involves tracing groups of rays, to generate a virtual tour of the 3-D worlds described by 2-D maps. Raycasting is much faster than Ray Tracing, which traces each point, usually a pixel, separately. Although Ray Tracing produces a high degree of visual realism, it uses many more calculation cycles, and the video game industry is working to perfect its implementation.

The Maze’s first version includes three fundamental features: the projection of walls, floors, and ceilings from the player’s perspective; forward and backward movements and player rotation, allowing for constant camera rotation; and the use of different textures on stage. One of the significant challenges in the project was initializing the SDL window, which required installing the X11 user interface system and the respective video drivers. Another challenge was to simulate a player and define its attributes using a structure to achieve backward, forward, and turning movements.

The player’s field of vision involves generating a projection plane and projecting rays with varying speed, direction, and distance to convert a 2D plan into a 3D illusion. Putting textures on the stage involved generating dynamic memory and converting a png image into pixel by pixel information that SDL can interpret and display on the screen. Although C is not an object-oriented programming language, it was possible to create an exciting challenge with The Maze.

--

--