Website powered by

Rex Engine

"Rex Engine" is a small game engine that I was working on at the end of 2022 which targeted the MS-DOS operating system and Pentium class CPUs.

Working under such limited specifications gave rise to some interesting challenges. On one hand, you essentially have total control over the system as your program is running (MS-DOS has no multi-tasking). On the other hand, this means that you need to take care of everything yourself, from setting up graphics modes, to low-level hardware interrupts, to entire complex systems of user interfaces and interaction.

Below is a series of images showing the development of four different 3D rasterizers that I wrote into the engine.

The first 3D rasterizer I wrote into Rex Engine was a sector-and-portal approach, which is very similar to the one used by Duke Nukem 3D. This image shows an early example, with variable height neighboring sectors connected by a "portal".

The first 3D rasterizer I wrote into Rex Engine was a sector-and-portal approach, which is very similar to the one used by Duke Nukem 3D. This image shows an early example, with variable height neighboring sectors connected by a "portal".

A "VoxelSpace" type rendering approach instead. This algorithm uses a heightmap and a colormap to draw pillars of pixels at different positions on the screen, creating a very good illusion of terrain.

A "VoxelSpace" type rendering approach instead. This algorithm uses a heightmap and a colormap to draw pillars of pixels at different positions on the screen, creating a very good illusion of terrain.

This rendering approach was very CPU expensive and did not last very long. Essentially it is a ray-casting approach, where a ray is sent for each individual pixel on screen, which stops (and plots a color) when it lands on a voxel in the world grid.

This rendering approach was very CPU expensive and did not last very long. Essentially it is a ray-casting approach, where a ray is sent for each individual pixel on screen, which stops (and plots a color) when it lands on a voxel in the world grid.

This was the beginning of the final voxel rendering approach. It is an upgrade of the previous ray-casting approach, but instead of firing a ray for each pixel of the screen, it only has to fire a ray for each vertical column of pixels.

This was the beginning of the final voxel rendering approach. It is an upgrade of the previous ray-casting approach, but instead of firing a ray for each pixel of the screen, it only has to fire a ray for each vertical column of pixels.

This screenshot shows the same heightmap from before, but used in the new ray-casting approach.

This screenshot shows the same heightmap from before, but used in the new ray-casting approach.

Another test scene with some programmatically generated spheres, showcasing voxel-over-voxel.

Another test scene with some programmatically generated spheres, showcasing voxel-over-voxel.