Inspiration
We really enjoy old/retro video games and the tech behind them. (Especially Enzo) Reading, or watching about how certain older games (such as DOOM) are able to create their visual FX with the limited resources of the time is so interesting that we wanted to try and recreate some of what they were able to accomplish. The doom engine contains many fascinating gems, and it would be great to try and recreate these achievements.
What it does
The program runs a 3d doom-like engine with support for concave spaces. The program can input arbitrary text files of wall segments and build a playable map.
How we built it
We used rust and the library ggez for graphics. The project uses a total of 2 methods from ggez for drawing: Drawing a 2d rectangle, and drawing a 2d arbitrary polygon. The graphics projection is a method taken from here. Concave maps are supported because of the custom Binary Space Partitioning implementation. Note that the graphics projection and clipping was widely "guess and check"-ed, while the BSP was meticulously built with distinct purpose. Enzo helped out building maps using Desmos Graphic Calculator.
Challenges we ran into
We had to restart the project 2 times due to problems with libraries, programming languages and our methods not providing a good affect. Originally, we were going to do a mix of C and rust using the Raylib library for graphics. However, Raylib did not support drawing an arbitrary polygon to the screen, so we both decided to just restart over completely in rust. Once we switched and found a library that supported polygons we were off! Although we weren't happy with the projection method we used originally as it caused lots of inaccuracy and weird distortions in the picture. So Jason found a different method that was used in OpenGL. It was highly complex, but through many hours of tweaking it finally worked. There was another problem though, which was the polygon clipping. In the simpler renderer, it was somewhat easy to clip walls, so walls that go offscreen can be drawn. In the OpenGL-style renderer, that system needed to be overhauled and integrated with the renderer, and so it proved to be highly challenging. Eventually it was solved. We also had trouble in trying to setup and use Binary Space Partitioning in order to render walls in the proper order. Originally we used a library, however it didn't seem to apply to the use case, so Jason tried to write his own. After ~3-5 hours, the problem was found to be a floating point inaccuracy causing improper paths in the binary tree.
Accomplishments that we're proud of
1) Setting up a proper renderer that draws walls to the screen in a satisfying way 2) Mapping a 2-Dimensional level to a 3-Dimensional play space 3) Properly implementing binary space partitioning from the ground up to decide draw order
What we learned
We learnt a lot about how 3 dimensional graphics works. Enzo personally learned a lot about rust, since it was his first time using the language seriously.
What's next for Micro Doom
Maybe adding some sprites or variable floors and ceilings like in the real DOOM. Billboarded sprites would be a good addition. Also, traced lighting would be a great technical addition. Texture mapping on walls, floors, and ceilings would also be good.
Built With
- ggez
- rust
Log in or sign up for Devpost to join the conversation.