As the softrender wrote yes the game wrote
Background. It so happened that my youth came at the time of the appearance of 3D games. The first time I saw Spectrum's Total Eclipse, I immediately began to consider 3D the top of technology. Soon, IBM-compatible computers appeared with the famous Wolfenstein and Doom. I was impressed. With a penchant for programming, I started trying to repeat them. It was the mid-nineties, I had a slow QuickBASIC, 5x86 comp and zero experience. Nothing came of it. Well, almost nothing.

Our days. And in 2016, I thought: what, now I have experience, why not put myself such a challenge? Namely, write a software rasterizer from scratch. Software here means that the image is built by the CPU, not using the video accelerator. Just like the same shooters of the nineties were made.
The task was set. I started with simple performance tests: fill the memory with a fixed color and display it. I displayed the StretchDIBits function on the screen, it has many analogues and its job here is simply to send my buffer to the screen. And the very first tests showed that performance is bad. In 1920x1080, even a simple color fill and a mandrel on the screen already drained the FPS to 200. But I had to form 3D and fill not color, but textured polygons.
And I decided that the only option is to render without overdraw. Here it must be clarified that the bulk of the advice on writing your own render comes down to texturing the polygon, and the polygons themselves are invited to display from the far to the nearest, one by one. I myself did this in the nineties, trying to repeat Doom.
And this option was dropped for two reasons. Firstly, if we have several polygons in the scene one after another, drawing from the farthest to the nearest will give an overdraw, in other words, we will repaint the pixel several times. Secondly, polygon rendering will cause frequent cache misses on the screen buffer. After all, triangles are located arbitrarily.
In total, I decided to write a rasterizer as a linear loop on the screen buffer. In one run, sequentially. Having organized the polygons and textures in my memory in the most ingenious way, I was able to achieve this. It is worth saying that the single-pass rasterizer, among other things, is well parallelized, much better than polygon painting.
In the process of writing the engine, I organized a festival where I suggested repeating the proposed scene on ordinary GPU engines. To my joy, sometimes the software render was even ahead. Right here .

It was inspiring and I decided to move on. But why not make the dream to the end and write a shooter? Here's a straight shooter from the nineties!
Having decided so, I began to choose the main points of implementation. The first thing I thought about the type of monsters. In the early shooters, these were the Wolves, the Duma, the Heretic with Hexen - the enemies were made in the form of 2-D billboards. In later shooters starting with Quake, the enemies are already polygonal, in full 3D. And the thing is, I 2D enemies of Heretic and Hexen liked much more than the enemies of Quake. There was a charm in 2D drawing. Although 2D required significantly longer work, because it was required to draw the enemy from all sides, I chose it. 2d billboard, drawn.
Screenshot: 2d billboard vs full 3d.

It was also necessary to decide how to create game levels. Games of those years usually had their own vertex editor, but I decided to go differently. I thought that than writing my own 3D editor, it is easier to make loading models from .obj. After all, the editor is better, for example, Blender, I would hardly be able to write. And I will say that the solution brought the benefit of a solid car: I was not constrained in the objects of the game level at all. I want to model what I want despite the fact that Blender mastered for the first time.
With regards to art, I did not become wise. Hexen has a set of cards with autumn and fog, I loved them then and now, without hesitation, I started with a similar style. Brown foliage, autumn, fog, evening. And then it turned: after acquiring the first experience with Blender, he began to recall vivid images from his dreams and reflect them in the game. So there was a cozy basement with pipes, then night with dry trees looking at the sky.
As a result, work on the project brought a lot of joy. This is not an ideal game, in any case, you should know this. But the time while I did it was a ton of fun and positive, plus the fulfillment of my childhood dream of making my nineties shooter.
I put the game itself in Steam, it so happened that I need money. Actually, as always. If there is a desire, I will be glad to any support: reviews about the game and criticism and just any kind words.
Play shooters!


Our days. And in 2016, I thought: what, now I have experience, why not put myself such a challenge? Namely, write a software rasterizer from scratch. Software here means that the image is built by the CPU, not using the video accelerator. Just like the same shooters of the nineties were made.
The task was set. I started with simple performance tests: fill the memory with a fixed color and display it. I displayed the StretchDIBits function on the screen, it has many analogues and its job here is simply to send my buffer to the screen. And the very first tests showed that performance is bad. In 1920x1080, even a simple color fill and a mandrel on the screen already drained the FPS to 200. But I had to form 3D and fill not color, but textured polygons.
And I decided that the only option is to render without overdraw. Here it must be clarified that the bulk of the advice on writing your own render comes down to texturing the polygon, and the polygons themselves are invited to display from the far to the nearest, one by one. I myself did this in the nineties, trying to repeat Doom.
And this option was dropped for two reasons. Firstly, if we have several polygons in the scene one after another, drawing from the farthest to the nearest will give an overdraw, in other words, we will repaint the pixel several times. Secondly, polygon rendering will cause frequent cache misses on the screen buffer. After all, triangles are located arbitrarily.
In total, I decided to write a rasterizer as a linear loop on the screen buffer. In one run, sequentially. Having organized the polygons and textures in my memory in the most ingenious way, I was able to achieve this. It is worth saying that the single-pass rasterizer, among other things, is well parallelized, much better than polygon painting.
In the process of writing the engine, I organized a festival where I suggested repeating the proposed scene on ordinary GPU engines. To my joy, sometimes the software render was even ahead. Right here .

It was inspiring and I decided to move on. But why not make the dream to the end and write a shooter? Here's a straight shooter from the nineties!
Having decided so, I began to choose the main points of implementation. The first thing I thought about the type of monsters. In the early shooters, these were the Wolves, the Duma, the Heretic with Hexen - the enemies were made in the form of 2-D billboards. In later shooters starting with Quake, the enemies are already polygonal, in full 3D. And the thing is, I 2D enemies of Heretic and Hexen liked much more than the enemies of Quake. There was a charm in 2D drawing. Although 2D required significantly longer work, because it was required to draw the enemy from all sides, I chose it. 2d billboard, drawn.
Screenshot: 2d billboard vs full 3d.

It was also necessary to decide how to create game levels. Games of those years usually had their own vertex editor, but I decided to go differently. I thought that than writing my own 3D editor, it is easier to make loading models from .obj. After all, the editor is better, for example, Blender, I would hardly be able to write. And I will say that the solution brought the benefit of a solid car: I was not constrained in the objects of the game level at all. I want to model what I want despite the fact that Blender mastered for the first time.
With regards to art, I did not become wise. Hexen has a set of cards with autumn and fog, I loved them then and now, without hesitation, I started with a similar style. Brown foliage, autumn, fog, evening. And then it turned: after acquiring the first experience with Blender, he began to recall vivid images from his dreams and reflect them in the game. So there was a cozy basement with pipes, then night with dry trees looking at the sky.
As a result, work on the project brought a lot of joy. This is not an ideal game, in any case, you should know this. But the time while I did it was a ton of fun and positive, plus the fulfillment of my childhood dream of making my nineties shooter.
I put the game itself in Steam, it so happened that I need money. Actually, as always. If there is a desire, I will be glad to any support: reviews about the game and criticism and just any kind words.
Play shooters!
