2013-06-07

It was the end of 1993. The peak time of the 320x200-pixel, 256-color VGA. Around that time the world saw some legendary game releases such as Doom and Prince of Persia 2. The year before that, we had seen Wolfenstein 3D and Indiana Jones and the Fate of Atlantis. Wing Commander and Wing Commander II had already been released as early as 1990 and 1991 respectively. Most of those games were raster-graphics-based. Wolfenstein 3D was a weird thing that we did not quite know whether to call it raster-based or vector-based; Doom looked rather vector-based, so it was beginning to seem that vector graphics might be the way of the future; but when Lucas Arts released Star Wars: X-Wing, even the slightest doubt went away.

My available time for experimentation with vector graphics was limited, since I was attending classes at the University and holding a full time job, but I managed to put a few demos together. In order to run these demos today one would need a DOS emulator, but I will spare the reader from that hassle, by providing short videos of the demos instead. (Each video is only a few seconds long.)

It is worth noting that all these demos are DOS applications and they are not making use of any ready-made graphics libraries. A direct BIOS call puts the graphics adapter in 320x200x256 mode, (regular scan lines instead of the exotic Mode X,) and from that moment on it is just routines entirely written by me in 80386 assembly and C++ directly accessing the video RAM. Rendering is done top to bottom, left to right, which is inadvisable because it increases contention with video readout by the VGA hardware, but I did not care about that yet, I wanted to first get everything to work correctly before tweaking things to squeeze the maximum performance out of it.

Distortions, jaggedness, and / or fuzziness that you might observe in the following videos are mostly due to the imprecise nature of interpolation via integer arithmetic. The skips that you will notice in the movement are to an extent due to the emulation of a DOS-era system under modern Windows, and mostly, due to the video capturing process. Natively, the demos used to run as smoothly as silk.

I found a way to do interpolation by addition and extraction of the high-order word, (division by 65536,) which is essentially fixed point real number arithmetic. This has the advantage of not requiring a comparison and a conditional jump within the interpolation loop: the only jump is the loop jump. This would be even more advantageous on modern hardware, (if we were still doing vector graphics on the CPU, which we don't,) since it would not cause branch prediction to fail once every few pixels. Still, even back then, the fewer instructions made a considerable difference.

Text Scrolling and bitmap scaling

This is the very first demo that I ever made. It might seem childish nowadays, but believe me, back then, to get something like this to run so fast, it was something.

Bitmap Rotation and Scaling

The following demo shows rotation and scaling of a bitmap. The underlying algorithm performs line interpolations across the source bitmap to visit the pixels that it copies to the video RAM.

2013-06-05

The development of a game like Darkfall Online in a country like Greece was a rather unlikely thing to happen, so I consider myself very lucky that it happened and that I was part of it. Here is the wikipedia page for the game: https://en.wikipedia.org/wiki/Darkfall

The funding came from a Greek-Libyan family which has made enough money out of oil-related construction to be able to afford the luxury of investing on something fun, rather than on something with a high ROI, or even a guaranteed ROI. Thus Razorwax, a promising team of Norwegians some of whom were already published in the gaming industry, was brought to Greece to build Darkfall. I was the first Greek programmer hired, and I worked primarily on the GUI of the game. I stayed with the company for about a year after the game was released.

Me at Aventurine, in 2004. Click to enlarge.

What follows is a rough diagram of the design of the GUI that I built for Darkfall: The graphics engine (written by a colleague in C++) provided me with just two asynchronous primitives, one for drawing textures, and one for drawing text. The layer we called middleware (written by another colleague, also in C++) provided me with the functionality of the "GetTextExtents" Win32 GDI function, and with an interface to the browser window (encapsulated instances of Microsoft Internet Explorer.)