TechTech Demo (DirectX programming)

What is it?

Named after the stunning TechTech demo by Sodan and the Magician 42 on the Amiga in 1987 and based on the Grodan and the Kvack Kvack demo by The Carebears on the Atari ST in 1991 this should be of interest to C++ programmers.

The source and the binary is available on the download page.


P2-333 or higher with music (P200 without music is OK),
Decent graphics card capable of 320*200 in 256 colours,
DirectX 3 or higher,
Windows 95/98/ME/NT4.0/2000/XP.

What does it do?

1. Sets up double buffered, palettized, full screen DirectX surfaces in 320*200 in 256 colours,
2. Full screen transparency of 2 layers moving independently,
3. Displays 2 320*8 pixel transparent horizontal scrollers moving at 1 pixel per frame and 2 pixels per frame respectively,
4. Displays 1 320*64 pixel transparent horizontal scroller moving at 2 pixels per frame,
5. Displays 12 16*16 pixel transparent sprites,
6. Displays horrible red lines whizzing about (unoptimized GDI calls),
7. Displays 6 16*200 transparent vertical scrollers,
8. Plays a sound module using Module Plugin Library v1.91.05 by Olivier Lapicque.

Screen shot


I wanted to see how efficient DirectX is for handling raw bitmaps. I think this is highly dependent on the hardware available. I would have preferred to have converted it to a PlayStation! Should work properly on NT 4.0 now.


Build 9. Cosmetic changes.

1. Uses new template project rather than old example,
2. Bound all graphics as resources to the executable rather than loading from bitmap files,
3. Updated graphics.

Build 8. Partial rewrite.

The aim of this was to get the demo running at a smooth frame rate on my old P200. It works, but is only smooth when the music is not playing. It's as good as it'll get.

1. Lowered resolution to 320*200,
2. Background graphics recreated. They were blocked up at 640*480 before, only the lines looked better at the high resolution,
3. Sprites changed to look less blocky,
4. To super optimize the program I render the frame into a system memory surface first and then blit the lot to double buffered video memory in one go.
This is upto 4 times faster on my old P200!
5. Error messages are displayed when the DirectX surfaces are closed.

Now runs fine on my 3 test systems (P200\98, P3-800\98, P3-800\XP). On the old P200 the demo was jerky with the music running. To prevent this rename Ronken.mod to something else. The module player will not start but the demo will run.

Build 7. Major bug fix.

1. All offscreen surfaces are created in system memory and not video memory.

On Windows NT 4.0, the gigantic offscreen surfaces could not be created. I thought that DirectX 4 was too old so I said DirectX 6 was required. It failed with the same error on a friend's PC with Direct6.1a with a Voodoo3-3000 video card. I was worried because my P3-800 has a virtually identical Voodoo3-3500. The error was DDERR_INVALIDPARAMS when creating a 640*480 offscreen surface.

To solve this problem I checked MSDN Library and found a solution in Ask Dr. GUI #46. I now use DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY when creating my offscreen surfaces. I also check the DDCAPS_BLT of ddcaps.dwSVBCaps to ensure that the video card supports system-to-video memory blitting. I still don't know why it failed on my friend's card with 16Mb of RAM but it is conceivable that other processes were using lots of video memory when the program was tested. It should work fine now. On NT4.0 and my old P200 they only have 4Mb of RAM and that would be exceeded by the program and operating system memory usage.

Next aim: get it running at full frame rate on my old P200!
I don't create hardware dependent profiles, such as the ability to run TechTech at different resolutions. This goes against the DirectX documentation, but these programs are just for fun. Looks as if I will have to lower the resolution to run my demo at full speed on my old machine.

Build 6. Minor changes.

1. Error code displayed with general error description if a surface cannot be created,
2. Bug fix. Did not clear DirectX surface structure before calling CreateSurface as in the documentation. Could cause unexpected problems.
3. Icon added,
4. Version information added.

Build 5. Released.

Build instructions

The program was built with Microsoft Visual C++ (Service Pack 5) on Windows 98 running DirectX 8 MiniSDK

1. Load Techtech.dsw into Visual C++,
2. Goto Build\Rebuild All,
3. It should run.

DDRAW.LIB must be in the project, so go to the FileView and remove my reference and add a reference to DDRAW.LIB on your build machine if there are build errors.

Back to index.