The Maze
The purpose of this project was to create a small level with raytracing, similar to old games like DOOM.
I love video games and I've always been curious about making one. I think this project was a good starting point if I ever want to pursue this further, though I may try to learn to make a 2D platformer next like one of my peers did. But from this base, I hope to make larger levels and give the player more to do. It was also nice to get back into creating sprite art, as I previously went to a school for design and illustration. It felt good making use of my old skills.
The code uses the C language, specifically OpenGL, and uses sprites in a 32x23 px format, saved as .ppm files and converted into arrays. Initially, the window would've been created with SDL2, but I soon opted to just use OpenGL directly for that. In the game, the player can move with 'WASD', slide against walls, open a vine wall with 'E' after picking up a knife, and die to an enemy.
The main technical challenges was in the application of raytracing. First, what I think were indentation errors prevented the keyboard input from being registered, when the previous setup of a single dedicated button function had worked. They stopped working when I made Up and Down button functions, and put the button into the Display function and tied them to the FPS variable. Applying uniform indentation across the code made them work again. Additionally, the map size was finicky, and increasing it directly made everything red at the time. The rays seemed to stop sometimes on invisible walls, or perhaps the lines of the box. I had to recheck the entire code once when the player was suddenly out of the map. I believe this was related to the map scaling issue, and also when I implemented collision. I think that the player may have spawned in a wall and was pushed to the other side of it, and said collision also prevented the player from reentering the map. Reducing the map to a smaller size and rewriting some functions correctly solved the issue. Lastly, there was a minor problem in implementing the textures, which looked like a jumbled mess. The reason for the problem was that the textures images were too big. The issue was fixed simply when I saved the images at the correct 32x32 pixel resolution and redid the arrays.
This project let me deepen my understanding of the C language, and introduced me to more graphics libraries to broaden my skills. It also taught me a method to implement textures into a game code. I still wish to further develop what I've made, creating a bigger level and adding functions to make this closer to DOOM.
领英推荐
I hope to grow as a competent programmer.
Directeur des services techniques at FRONERI France
1 年Excellent !