Sunday, April 4, 2010

Even more fun with Software Quake

It's interesting to play around with Software Quake. The renderer is really really solid, and you do learn a few things about how Quake is meant to be (things that don't always work right in GLQuake). There's also ample room for improvement in the engine, and a lot of the fun for me comes from implementing some of those improvements.

Right now I've fully ripped out the SciTech MGL library and switched it over to pure GDI. This was a preliminary to doing DirectDraw, but GDI gives ample performance as it is. It seems as though the advantages of DirectDraw over GDI really only apply if you're doing a sprite-based 2D scroller; for Quake where you write pixels into a buffer and then blast that buffer on screen in a single operation there doesn't seem to be much in the way of difference (GDI is cleaner too; DirectDraw dates from a time when DirectX in general was a horrible mess).

The Quake II code came in very handy here (it doesn't use MGL) and I simplified things even further by not bothering with palettized modes. Overall it gets about 120 FPS at 800x600, which was roundabout where I was aiming for and is a great result for WinQuake.

The next step that's tickling my fancy is interpolation. I've been studying the relevant parts of the code and it looks very achievable. It means switching one function from ASM to C but the performance difference is quite miniscule so I think we're on.

No commitments however as to whether or not I'm going to release anything here, but if the end result is solid enough I just might.

All of this means that no DirectQ work got done, but there's no cause to worry there as the current state of DirectQ is nicely stable and I'm happy at the moment to let it mature until such a time as inspiration for the next steps there occur. I have fairly good ideas as to what those steps are, but implementing them will mean some drastic overhauls of parts of the code so it's not something to approach lightly or recklessly. As soon as a plan of action for them comes together I'll be back to it with a vengeance. Meanwhile I'm having enormous fun.

0 comments: