Compiling DOOM 3 BFG Edition in VS2022
I was recently given the suggestion by a co-worker to look at the id Tech code as reference if I was going to be writing my own engine. Up until now most of my source code reading of existing engines was either other hobby engines or Unreal Engine 5's source.
For the former, I am grateful for those who open-source their code, and they are a useful reference for sure. But reading the code of an actual "battle-tested" production engine that has shipped adds some extra credibility and value imo.
For the latter, UE5 code is unfortunately (but for good reason) an unwieldy behemoth to work with. I'd like to not make my Intellisense self-destruct.
id Tech 4 specifically is written in C++ (previous iterations in C), and id Tech in general spawned lineage in the form of other engines like Source and IW engine. If other companies thought it was good enough to reference, that's probably a good sign!
By default the source code is made for VS2010. Fortunately, blambo10 on GitHub has done some good work making the changes needed to get it to build in VS2019. If you prefer to use VS2019, you can stop here. If using VS2022, you need to install the following individual components for one of the headers:
After that there are some additional warnings that need to be ignored. I've forked the VS2019 repo with these changes here.
It's also required that you install the DirectX SDK as well. I ran into some issues (Error Code S1023) with getting the installer to work, and the answer by gregoltsov here helped me out a ton.
The BFG repo seems to be missing a header that the non-BFG repo has: https://github.com/id-Software/DOOM-3/blob/master/neo/d3xp/gamesys/TypeInfo.h. Or at least it makes references to it. Removing the #include
references to this header in Class.cpp
, SaveGame.cpp
, and SysCmds.cpp
should do the trick.
Finally, you can using the following Command Arguments when launching the project, modifying the path as needed:
+set fs_basepath "C:\Program Files (x86)\Steam\steamapps\common\DOOM 3 BFG Edition" +set com_allowConsole 1 +set si_pure 0
Obtained from this stack exchange post.