Porting Quake II to MS-DOS pt5 – 3DFX, GameSpy, Quake 2, and The Universe

The following is a guest post / wrap-up of the Q2DOS adventure by [HCI]Mara’akate.q2dos_3dfx_4
In the last update sezero and I([HCI]Mara’akate) tied up most loose ends with regards to Q2DOS.  Specifically: adding in DXE support for mods and cleaning up some code from the early efforts.  During this time, a forum user by the name of ggorts (strogg spelled backwards!) mentioned the possibility of using an old Mesa version with 3DFX support in DOS. I worked on separating the ref_soft from being statically linked into a DXE form and sezero cleaned up any potential problems there.

I mentioned the possibility of attempting the Mesa port to sezero and he thought it was probably a wasted effort and thought making a ref_glide depending only on glide3x.dxe would be a better way to go with less overhead.  I started some initial work on it but quickly abandoned this side-project as I have no real glide (or even OpenGL) knowledge and didn’t have enough time on my hands to play around with it.

Around this time, we also separated the GameSpy browser code into a separate DXE for potential legal issues.  The GameSpy code was publicly released, but never officially GPL’d.  Using this method, other port authors could link against a gamespy.dll to add in the browser capabilities that connect to my GameSpy master server emulator (see QDOS branch for source code to that particular project).

Ggorts also came up with some code for us to be able to finally use the banked modes and Mode-X 320×240.  Though 320×240 Mode-X seems to have some issues with certain emulator configurations, for the most part it works OK.  This also helped us to get some ASM rendering code in from Q1 and help clean up the original mess that was the SVGA driver; a lot of unused code from Q1 was removed and sezero found a clever way to send the video modes list between the game binary and renderer DXE.

In any event, one night I figured I’d take a stab at trying to get Mesa working in Q2DOS.  Checking out the Mesa3d FTP and researching the various changelogs it appears as if Mesa 5 series was the last true effort with Mesa 6.4.x series being the last maintained version with 3DFX specific code.  I got everything to compile but ran into hard-lock issues no matter what I attempted.  During this time, ggorts found out some various small, but now obvious issues. Including increasing the stack size to 1MB, and he hard-coded the ref_gl to only work in 640×480.  It took a lot of pleading but eventually he released his source with a static compile for Voodoo 1 cards only as he was testing this on emulators like DOSBox with glide support and PCem dev branch.

I worked on cleaning up the source and he produced some glide3x libraries for me for Voodoo 2 and Voodoo 5 as these were the only cards I personally owned.  Imagine my surprise as I first loaded it up and it actually worked!  And it was smooth with no rendering issues!

q2dos_3dfx_3

At this point, sezero became involved and worked very hard to clean up the Mesa compile issues, including various scary warnings and helped to update us to the final glide3x commit pushed to the development branch and Mesa v6.4.3 which was an unreleased maintenance update for Mesa v6.4.2.

It was a long journey to get the code all working together just right, and a big thanks goes out to the early Mesa crew including Brian Paul, Daniel Borca, and “KoolSmoky” and the mysterious ggorts fellow who pushed hard for this feature.

To recap, Q2DOS from the last time we talked now has:

  • 3DFX Rendering with Mesa v6.4.3 for all Voodoo cards.
  • Separated renderer so it is no longer statically linked.
  • GameSpy is now a DXE.
  • WAV streaming, which is practically free as opposed to the OGG format.

q2dos_3dfx_1
q2dos_3dfx_8

We are about at the end of our Q2DOS journey.  A few odds and ends with Mesa and Voodoo 5 SLI issues remain (though nothing to show stopping) and there’s a small wish list of some unnecessary features but it’s come a long way from the initial null driver effort!

q2dos_3dfx_2*Neozeed

I have to say it is simply incredible to see how Q2DOS went from a very primitive ‘wow it works’ port to a full featured port.  Simply amazing!

For those who missed the adventure it starts in Part 1, continued in Part 2, Part 3 and Part 4.

28 thoughts on “Porting Quake II to MS-DOS pt5 – 3DFX, GameSpy, Quake 2, and The Universe

      • Yes I downloaded from here and from other place and the same error , just in regular way I type q2.exe from DOSbox and even from real DOS 7.1 (windows 95 version) the same problem , strange that in files there no such directory “pics”

  1. sorry about my many comments but WOW
    in your windows port (why actually you maded win32 and win64 ports :D)
    the same error ! this time in little window dialog box
    (a am with windows XP)
    I tryed this archive q2dos_20151102_win32.7z

  2. I am stupid as fuck! now I realize that I must put those files (your archive) in original windows Quake 2 folder in order to run the game! haha so stupid of me sorry about all my comments! I will try the game 🙂 I vary happy with it

    • Ok, that makes a LOT more sense why it wouldn’t run then!

      Maybe it’s time to re-write the inability to open PAK files as a major error… And maybe for WIN32 to chain them from a steam directory.

      • I copied you DOS files ins original Quake folder it is working 🙂 than I do the same with your win32 files and it working (i noticed that you add new futures 😀 )
        but the strange thing is that from wind32 ver single player crashes ! but in DOS ver single player is ok even sound is working but only in multilayer mod in single it out of memory and no sound (my sound is Realtek ALC888 @ Intel 82801GB ICH7) my be because of the model I do not know you mentioned in readme that new sound cards are not tested enough . I wil test the game in my pentium 1 or 3 with standart sound blaster and voodoo2 card 🙂 to see how it works this is just amazing ! I wonder can DOS and WIN version play together in multilayer 🙂 ??

  3. In q2dos (tested in win32) the load game menu cursor is offset by minus two. This patch to menu.c seems to fix it:
    @@ -2696,7 +2696,7 @@ const char *LoadGame_MenuKey( int key )
    {
    if ( key == K_ESCAPE || key == K_ENTER )
    {
    – s_savegame_menu.cursor = s_loadgame_menu.cursor – 1;
    + s_savegame_menu.cursor = s_loadgame_menu.cursor;
    if ( s_savegame_menu.cursor < 0 )
    s_savegame_menu.cursor = 0;
    }
    @@ -2731,7 +2731,7 @@ void SaveGameCallback( void *self )
    void SaveGame_MenuDraw( void )
    {
    M_Banner( "m_banner_save_game" );
    – Menu_AdjustCursor( &s_savegame_menu, 1 );
    +// Menu_AdjustCursor( &s_savegame_menu, 1 );
    Menu_Draw( &s_savegame_menu );
    }

    @@ -2766,7 +2766,7 @@ const char *SaveGame_MenuKey( int key )
    {
    if ( key == K_ENTER || key == K_ESCAPE )
    {
    – s_loadgame_menu.cursor = s_savegame_menu.cursor – 1;
    + s_loadgame_menu.cursor = s_savegame_menu.cursor + 1;
    if ( s_loadgame_menu.cursor < 0 )
    s_loadgame_menu.cursor = 0;
    }

  4. I noticed that when you saved a game from DOS you can play it only from DOS and when you save from win32 it only works in windows 🙂 if you try to load in in win32 from saved game made from DOS it crashes , and when you try to load from win32 save in DOS versions it do not crash, but tells you in the console “ERROR: Game error: Savegame from an other OS.”
    you DOS version is definitely butch better than win32 one :DDDDD
    I will try again online in DOS, but with voodoo2, and if I find compatible sound blaster on PCI , because on my integrated sound works but when enter in action it stops. I will share the results 🙂

    • Most of the time was cleaning up weird things, and then refinements to the 3DFX, along with enhancements to the engine. But the basic port wasn’t so bad, iD wrote some really good/portable code that was easy enough to port off to new and exciting platforms, like MS-DOS.

      [HCI]Mara’akate really deserves most of the credit for taking it from ‘wow it actually runs’ to being a fully featured port.

      I’ll take a look at the Heretic II thing, it may be clickbait worthy enough..

      • Okay. By the way, I’ve been having trouble with getting the mission packs to run properly in Q2DOS. Some objects will either not function like they’re supposed to, or not spawn at all. The Tank Bosses and Green Keycards in The Reckoning are the prime example. I had to noclip through a lot of Units 2 and 3 because of them not spawning.

        I’m running this in DOSBox in Mac OS X, so I was wondering if there was something I forgot to put in the .conf file.

        Speaking of configuring, I set up a DOSBox wrapper to run all the DOS installments of Wolfenstein, TES, Fallout, Quake, and the other ZeniMax franchises from a series of batch files. I also included Q2DOS and Hexen II’s Hammer of Thyrion source port in there. Here’s a screenshot.

        https://twitter.com/EldritchNexus/status/1169592808694566913/photo/1

        • which exe are you using though? which maps? can you give me save games? I’m a terrible Q2 player so I haven’t completed it at all or really know what to look for ….

          • I’m using the parameters
            “q2.exe +set game xatrix” for The Reckoning, and “q2.exe +set game rogue” for Ground Zero.

            The maps affected in The Reckoning are “The Warehouse” and “The Intelligence Center” for Unit 2, and “The Industrial Facility” for Unit 3.

            I’m also having problems with Ground Zero. In the very first area, there’s supposed to be a lift in the room where there’s a small lift in the corner. You can see where the lift is supposed to be, but the lift itself doesn’t spawn, meaning I have no way to get up to the next floor without noclipping. I haven’t gone far enough in GZ to see what else is affected.

            But the base game runs just fine in DOSBox.

          • Oh, and as for what to look for: In “The Warehouse”, there are so supposed to be two platforms in the water that are supposed to move around, but they instead stay in place, preventing me from going up to the next level. And the green keycard doesn’t spawn in that level like it’s supposed to.

            In the “Intelligence Center”, there’s a big open area that locks its doors when you enter it. This is where the Super Tank is supposed to spawn and you’re supposed to fight it to proceed. But it doesn’t spawn, I end up stuck in that area with no way out.

            There’s also another two Super Tanks in “The Industrial Facility”, one of which guards the green keycard. Neither the green keycard nor the Super Tanks spawn.

            I’m guessing since the Super Tanks are Beta-class versions of the Super Tanks from the base game, they are considered exclusive to the expansion and thus aren’t being loaded properly.

            Sorry, I don’t have any save files of those levels.

          • Oh, and did you look at that screenshot above? I thought the DOSBox wrapper might interest you.

          • I’ve been trying to get my build system in place for this and some other stuff. After we got it running on MS-DOS all the further stuff we actually did under Windows, as debugging on DJGPP with applications that hook I/O and are graphical are such a super pain in the butt.

            Visual Studio 2019 is so massive, and I’m on a cellphone connection @ home, so it’ll take a while. It’s the price of living in the country so I don’t have to be up in the 40th floor in some tiny highrise, as I’m in a stand alone building out in the scenic countryside in Hong Kong.

          • Oops, it looks like you already updated it. I downloaded the binary of the Q2DOS source port you uploaded in 2019. It has all the missing stuff in it.

  5. So i just registered an account to ask this…

    Is their a DOS command to launch Q2DOS with 3dfx acceleration? I know i can enable 3dfx in the options menu but i’m looking for a command which can be used with a batch file. QDOS has qdosfx.exe so i can just run that from a batch file, but Q2DOS doesn’t have a 3dfx file like this.

    And is it possible to enable V-sync for software rendering mode? Pretty sure the original Q2 didn’t have this, but maybe you added it.

    This really is an excellent and well polished port btw. Played through it more than once 🙂 Hoping you do more DOS backports.

Leave a Reply to neozeed Cancel reply