<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Korvin Korax</title>
	<atom:link href="http://www.korvinkorax.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.korvinkorax.com</link>
	<description>The official Korvin Korax site</description>
	<lastBuildDate>Fri, 16 Mar 2012 12:15:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>DOOM 3 Widescreen Support</title>
		<link>http://www.korvinkorax.com/2012/03/doom-3-widescreen-support/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=doom-3-widescreen-support</link>
		<comments>http://www.korvinkorax.com/2012/03/doom-3-widescreen-support/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 14:14:42 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[crosshair]]></category>
		<category><![CDATA[doom]]></category>
		<category><![CDATA[expansion]]></category>
		<category><![CDATA[idTech2]]></category>
		<category><![CDATA[idTech3]]></category>
		<category><![CDATA[idTech4]]></category>
		<category><![CDATA[letterbox]]></category>
		<category><![CDATA[quake]]></category>
		<category><![CDATA[uqe]]></category>
		<category><![CDATA[vsync]]></category>
		<category><![CDATA[widescreen]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=634</guid>
		<description><![CDATA[The past few weeks since the release of UQE Hexen II and UQE Quake recently I&#8217;ve been hard at work doing some research into a few of the other GPL released idTech engines. The reason for taking a look at &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2012/03/doom-3-widescreen-support/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The past few weeks since the release of UQE Hexen II and UQE Quake recently I&#8217;ve been hard at work doing some research into a few of the other GPL released idTech engines. The reason for taking a look at the other idTech engines is to get an idea which one will be most suitable for a completely new game project.</p>
<p>Its not going to be an easy decision to choose one of the three idTech engines that were developed after Quake. This is mainly due to the fact that I need to strike a balance between how current the engine is and the almost arcade-like feel and play-ability of mid 1990&#8242;s FPS games that needs to be achieved like the classic Doom games and Quake.</p>
<p><span id="more-634"></span></p>
<p>I&#8217;ve spent a few days on the idTech2 (Quake2) engine and did quite a number of fixes and tweaks to it. Most of the tweaks still needs a full-on test to make sure they are stable. I still need to spend some time evaluating the idTech3 (Quake III Arena) engine to see what I can get done with it. I like the engine&#8217;s camera movement, which feels quite close to what will be required to create a fast-paced game.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/projects/doom3-00.jpg" title="" class="colorbox" rel="singlepic131" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/131__320x240_doom3-00.jpg" alt="doom3-00" title="doom3-00" />
</a>
<br />
The past two days I&#8217;ve spent some quality time with the idTech4 (Doom3) engine. The sheer amount of source code and major differences between the older idTech engines and idTech4 is quite overwhelming. After carefully looking at how the engine is structured I thought its about high-time to fix two issues that has been bugging me about Doom3 for a long time.</p>
<p>The number one issue is the lack of widescreen support within the engine&#8217;s list of available resolutions as well as on the main menu. The only way to get something widescreen going is to mess around with the custom width and height console variables. The field of view (FOV) needs some manual adjustments for the screen rendering to look correct. After some thought a decent mix of letterbox (4:3), widescreen (16:9) and widescreen (16:10) resolutions have been added to the engine as well as both the menu scripts of the base Doom3 game as well as the &#8220;Resurrection of Evil&#8221; expansion pack.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/projects/doom3-01.jpg" title="" class="colorbox" rel="singlepic133" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/133__320x240_doom3-01.jpg" alt="doom3-01" title="doom3-01" />
</a>
<br />
The ability to switch between showing and hiding the crosshair has been added to both the base Doom3 game as well as the expansion pack. Originally the only way to get rid of the crosshair were to hide the complete hud. For me personally seeing the crosshair all the time breaks the mood of the game as its too big and in your face. Its now as simple as switching the &#8220;ui_showCrosshair&#8221; console variable to show or hide the crosshair. The engine will render the crosshair by default to stay true to the original game functionality.</p>
<p>Also fixed is that micro stuttering that occurs when the game runs on a decent GPU and have vsync turned on. The engine internally handles the state of the &#8220;com_fixedTic&#8221; cvar to have it render smoother under vsync conditions and yet at the same time maintain the 60hz limit when running with vsync off. Nothing were changed when running or joining a multiplayer server.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/projects/doom3-02.jpg" title="" class="colorbox" rel="singlepic134" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/134__320x240_doom3-02.jpg" alt="doom3-02" title="doom3-02" />
</a>

<p>&nbsp;</p>
<p>Download <a href="http://files.korvinkorax.com/aquire.aspx?id=18">Doom 3 widescreen</a> support.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2012/03/doom-3-widescreen-support/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>UQE Quake v1.10 Released!</title>
		<link>http://www.korvinkorax.com/2012/03/uqe-quake-v1-10-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uqe-quake-v1-10-released</link>
		<comments>http://www.korvinkorax.com/2012/03/uqe-quake-v1-10-released/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 18:09:42 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[framebuffer]]></category>
		<category><![CDATA[hexen2]]></category>
		<category><![CDATA[lightmapping]]></category>
		<category><![CDATA[lit]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[pk3]]></category>
		<category><![CDATA[qrp]]></category>
		<category><![CDATA[quake]]></category>
		<category><![CDATA[texture]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=581</guid>
		<description><![CDATA[There has been numerous times where I started work on a fixed-up version of Quake, but never got around to finish it. Sometimes life has a way to get in the way of things. This time around I stuck it out and &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2012/03/uqe-quake-v1-10-released/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>There has been numerous times where I started work on a fixed-up version of Quake, but never got around to finish it. Sometimes life has a way to get in the way of things. This time around I stuck it out and got it finished! I&#8217;ve worked on Quake development the day its sources got released back in 2000, but eventually ended up working on Hexen II instead. With UQE Hexen II now done, I decided to start work on UQE Quake and get all the great fixes I did on UQE Hexen II back-ported to the new UQE Quake project.</p>
<p>The UQE project is a very personal one where the goal is to fix the engine just enough to enable me to once again enjoy one of my most favourite games of all time without having to use DOS emulation software or an older version of Windows because of compatibility issues with modern day hardware, drivers and operating systems. Its been a long time coming indeed!</p>
<p><span id="more-581"></span></p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-quake/quake11.jpg" title="" class="colorbox" rel="singlepic126" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/126__320x240_quake11.jpg" alt="quake11" title="quake11" />
</a>
<br />
The work on UQE Quake started back in early December 2011 while I was on vacation. During the development of the engine mod I found a few minor bugs and things I could do differently in the original code that were back-ported to UQE Quake from UQE Hexen II. I ended up porting those back to UQE Hexen II. Basically I worked on two engine upgrades during the last three months. The work done on the UQE Quake project resulted in a new version of UQE Hexen II being released just a week or so ago.</p>
<p>The ability to properly render fullbright pixels were almost missed, but it got implemented at the eleventh hour and delayed the release of UQE Quake by around two days. It was well worth it though. Interestingly enough I decided to treat fullbrights as &#8220;luma&#8221; textures. When the engine detects that a texture has fullbright pixels it internally generates a new luma texture and let it pass through the same rendering processes that gets used by standard external luma textures. Just like luma textures, fullbrights are unaffected by lightmapping giving the illusion of emitting light.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-quake/quake14.jpg" title="" class="colorbox" rel="singlepic129" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/129__320x240_quake14.jpg" alt="quake14" title="quake14" />
</a>
<br />
With the addition of PK3 file support it becomes as simple as copying the QRP (Quake Retexturing Project) PK3 files to the &#8220;id1&#8243; game directory to enable UQE Quake to load and render high resolution texture replacements for all the original Quake maps. The high definition experience can be further enhanced by copying LIT colored lighting files to the &#8220;maps&#8221; directory under any game directory. LIT files from the MHQuake project yields the best results when used with UQE Quake.</p>
<p>The high resolution texture packs and colored lighting packs are not included with the UQE Quake download.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-quake/quake00.jpg" title="" class="colorbox" rel="singlepic115" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/115__320x240_quake00.jpg" alt="quake00" title="quake00" />
</a>
<br />
It is also possible to get your old-school game on by running UQE Quake in classic rendering mode. All that needs to be done is to set the texture filtering mode on the options menu to &#8220;Point Sampled&#8221; as well as turning off the frame buffer. Once that is done the engine needs to be restarted using a lower resolution mode like 640×480 for example.</p>
<p>There are numerous more additions and tweaks to UQE Quake, but they are too minor to write about.</p>
<p>Download <a href="http://wiki.korvinkorax.com/index.php?title=UQE_Quake">UQE Quake</a> and enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2012/03/uqe-quake-v1-10-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UQE Hexen II v1.15 Released!</title>
		<link>http://www.korvinkorax.com/2012/02/uqe-hexen-ii-v1-15-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uqe-hexen-ii-v1-15-released</link>
		<comments>http://www.korvinkorax.com/2012/02/uqe-hexen-ii-v1-15-released/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 14:42:24 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[bloom]]></category>
		<category><![CDATA[emulate]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[fov]]></category>
		<category><![CDATA[framebuffer]]></category>
		<category><![CDATA[hexen2]]></category>
		<category><![CDATA[msaa]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[pak]]></category>
		<category><![CDATA[pk3]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=518</guid>
		<description><![CDATA[Its unbelieveable that its been almost a full year since the previous version of UQE Hexen II were released! When I released the previous version of UQE Hexen II with additional higher and widescreen resolutions people pointed out that the &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2012/02/uqe-hexen-ii-v1-15-released/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Its unbelieveable that its been almost a full year since the previous version of UQE Hexen II were released!</p>
<p>When I released the previous version of UQE Hexen II with additional higher and widescreen resolutions people pointed out that the field of view (FOV) is still set at a fixed 90 degrees which is typical for 4:3 letterbox resolutions. When I investigated the FOV implementation in the engine I decided to port the original Quake engine&#8217;s FOV setup code over to Hexen II as it seemed as if its implementation pretty much fixed it to 90 degrees. Changing the FOV on the console did not change the field of view at all. After some work on the subject I succeeded in changing the code to actually calculate the FOV value dynamically based upon the currently used resolution.</p>
<p><span id="more-518"></span></p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen26.jpg" title="" class="colorbox" rel="singlepic111" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/111__320x240_hexen26.jpg" alt="hexen26" title="hexen26" />
</a>

<p>&nbsp;</p>
<p>While I was at it updating the engine&#8217;s FOV code I thought to look at a few other minor issues and upgrade parts of the engine that was getting out of date. The bloom code had quite a bit of an update since I heard that the bloom effect were too excessive. I took the liberty to get it cleaned-up a bit and lessen the strain on the eyes which I hopefully now got sorted out. UQE Hexen II generates the bloom effect using the &#8220;GL_EXT_framebuffer_object&#8221; OpenGL extension. I ended up splitting the frame buffer management code from the bloom code to allow more frame buffer effects to be implemented in the future.</p>
<p>One thing that bugged me a lot with the frame buffer is that I couldn&#8217;t get Multi-Sampled Anti-Aliasing (MSAA) to render at the same time as bloom. Once bloom was turned on the jaggies appeared that really broke the softening effect that bloom adds to the scene. I had to do some research on the subject and learnt that you should create an additional frame buffer using the &#8220;GL_EXT_framebuffer_multisample&#8221; extension. You are pretty much guaranteed that the &#8220;GL_EXT_framebuffer_object&#8221; extension is supported if the GPU supports &#8220;GL_EXT_framebuffer_multisample&#8221;. The process of getting MSAA-enabled output for further post processing is pretty simple&#8230; the engine firstly needs to render the actual scene to the MSAA frame buffer then the content of that buffer gets copied to the standard frame buffer where the frame buffer data gets processed to the final scene as normal.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen25.jpg" title="" class="colorbox" rel="singlepic110" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/110__320x240_hexen25.jpg" alt="hexen25" title="hexen25" />
</a>

<p>&nbsp;</p>
<p>Some third party libraries also got an update with this release.<br />
The JPG library has been updated with the one used by Quake III Arena which for one allowed the loading of JPG data via a stream of bytes which helped a lot with the recent implementation of PK3 (zip) loading support. Did I mention that UQE Hexen II can now load game assets from either PAK or PK3? The engine can also load game assets even from a mix of PAK and PK3 files. The code responsible for loading data from PK3 files have been directly ported from Quake III Arena as well.</p>
<p>The FMOD middleware library implementation in UQE Hexen II also got a huge upgrade.<br />
It got completely re-written from scratch using the at the time of writing the code version of FMOD. Theres been quite some logical changes apart from only the technology upgrade. The engine now also checks for WAV files as an alternative music playback format if it can&#8217;t find a suitable OGG or MP3 file. The dated WinMM-based CD Audio playback code have also been replaced with brand new FMOD code that now manages the playback of CD Audio and the same has been done to the native MIDI implementation. Moving all music playback functionality to third party middleware saves some legacy code from being part of the engine and probably might even help reduce the possibility of legacy issues rearing its ugly head at some point in the future as all source code tend to decay over long periods of time.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen29.jpg" title="" class="colorbox" rel="singlepic114" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/114__320x240_hexen29.jpg" alt="hexen29" title="hexen29" />
</a>

<p>&nbsp;</p>
<p>With the release of UQE Hexen II v.1.15 it will be the first time the software renderer will be completely omitted from the project as it serves no real purpose anymore and becomes pretty difficult to maintain and keep it error-free. I did however made some changes to the remaining OpenGL version of the engine to enable it to simulate the classic effect the software renderer has given by simply changing some console variable values. To help with simulating the unfiltered effect of textures in the software renderer I&#8217;ve added a &#8220;Point Sampled&#8221; texture mode that can be set from the menu. To get the best classic look and feel for the game will be to set the texture mode to &#8220;Point Sampled&#8221;, turn off the frame buffer and then starting the game at a lower resolution mode like 640&#215;480 for example.</p>
<p>There are numerous more additions and tweaks to UQE Hexen II, but they are too minor to write about.</p>
<p>Download <a href="http://wiki.korvinkorax.com/index.php?title=UQE_Hexen_II">UQE Hexen II</a> and enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2012/02/uqe-hexen-ii-v1-15-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UQE Quake &#8211; Project Launched!</title>
		<link>http://www.korvinkorax.com/2011/12/uqe-quake-project-launched/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uqe-quake-project-launched</link>
		<comments>http://www.korvinkorax.com/2011/12/uqe-quake-project-launched/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 14:06:07 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[hexen2]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[quake]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=489</guid>
		<description><![CDATA[I&#8217;m currently in the planning stages of actually starting out development work on UQE Quake! If all goes according to plan I should be able to start with the development process between December 2011 and January 2012. All the features &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2011/12/uqe-quake-project-launched/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently in the planning stages of actually starting out development work on UQE Quake!</p>
<p>If all goes according to plan I should be able to start with the development process between December 2011 and January 2012. All the features that are currently available in UQE Hexen II v1.14 will be ported over to UQE Quake. Obviously only the features that are compatible between the two game engines will be ported.</p>
<p>Once all the features intended for the initial release is ported I will look at a few other odd issues, like for example the field of view (FOV) changes that have to be made to accommodate wide screen monitors. The additional fixes and changes will also be back-ported to UQE Hexen II.</p>
<p><span id="more-489"></span></p>
<p>Unlike Hexen II there are a huge number of ports and modifications to the original Quake. So whats the purpose of UQE Quake?</p>
<p>Well, its pretty simple. When I started the UQE project back in 2006 I wanted to be able to play these older games as close as possible to its original, except for a few fixes and additions. Originality is the key, with its strengths and weaknesses. The UQE Quake project will be no different. If you were too young to remember what Quake was all about and for that matter Hexen II as well, the UQE versions of these games will set you on the right path.</p>
<p>Whether UQE Quake will have a software renderer just like the UQE Hexen II project is debatable since I&#8217;m not sure how many people are still actually bothered having a software renderer. It should be possible to emulate the feeling and atmosphere the software renderer had by adding point sampled texture rendering to the OpenGL renderer. If that works out well, the same could be applied to UQE Hexen II.</p>
<p>The UQE forums is the place to be to follow the developmental process as well as contribute to the project.<br />
<a href="http://forums.korvinkorax.com/viewtopic.php?f=11&amp;t=2">http://forums.korvinkorax.com/viewtopic.php?f=11&amp;t=2<br />
</a><a href="http://forums.korvinkorax.com/viewtopic.php?f=11&amp;t=4">http://forums.korvinkorax.com/viewtopic.php?f=11&amp;t=4</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2011/12/uqe-quake-project-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doom Engine WAD Reader and Extractor</title>
		<link>http://www.korvinkorax.com/2011/09/doom-engine-wad-reader-and-extractor/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=doom-engine-wad-reader-and-extractor</link>
		<comments>http://www.korvinkorax.com/2011/09/doom-engine-wad-reader-and-extractor/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 12:13:22 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[doom]]></category>
		<category><![CDATA[extractor]]></category>
		<category><![CDATA[idTech1]]></category>
		<category><![CDATA[raw]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[texture]]></category>
		<category><![CDATA[wad]]></category>
		<category><![CDATA[wave]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=422</guid>
		<description><![CDATA[The Doom Engine WAD Reader and Extractor is an application designed for viewing and extracting information found inside data files known as &#8220;WAD&#8221; files. For the longest time since I created levels for DOOM and DOOM-based games I wanted to &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2011/09/doom-engine-wad-reader-and-extractor/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The Doom Engine WAD Reader and Extractor is an application designed for viewing and extracting information found inside data files known as &#8220;WAD&#8221; files.</p>
<p>For the longest time since I created levels for DOOM and DOOM-based games I wanted to get into the technical side of the idTech1 engine, but sadly I never got around that. I don&#8217;t know why it turned out this way. Maybe because there&#8217;s never enough time, or maybe because I was so much involved in the Quake engine development scene.</p>
<p>I always wanted to build a DOOM-like game. I have a great appreciation for the technical design style and fast game-play. To save valuable time I decided to use DOOM&#8217;s original art assets while I develop the game engine to spare myself the extra effort and management of new original art asset development. Using original DOOM assets will further help doing a more direct comparison against the original DOOM.</p>
<p><span id="more-422"></span></p>
<p>Then my first anticipated problem steps into the limelight&#8230; I&#8217;m going to use Microsoft .NET and Microsoft XNA for the project. That means for XNA best practices I should use its content pipeline and not write my own WAD reading code and content management. It is totally possible technically to write my own code to load DOOM assets in the game engine, but that would make my code probably less compatible when thinking along the lines of making versions for other Microsoft platforms that are not PCs. It becomes obvious that the assets stored inside the WAD file needs to be extracted and written to disk as standard multimedia assets that can be loaded and compiled by XNA&#8217;s content pipeline to its binary XNB file format.</p>
<p>I searched the internet for a tool that could extract the assets and I found one developed by Terry Butler.<br />
His tool did the job well to extract the data from the WAD, but unfortunately there were no source code available for download on his website. I realized I had to actually have an understanding how the WAD file structure functioned, because at some point in time I may need to write another tool that can package standard art assets back into a WAD for level design purposes as I&#8217;m planning to most likely use DoomBuilder as the level editor. I started doing some research on the internet regarding the WAD file format and came across a great specification document written by Matthew Fell detailing not only the WAD file structure, but also the individual lumps of data that make up the assets of the game.</p>
<p>The formats of the individual art assets are pretty interesting&#8230;</p>
<p>The digital sound format were pretty easy to get loaded. It is stored as raw sound data in mono channel at a sample rate of 11025 hz, 8-bits per sample. All we had to do is to take this raw sound data and write it to disk as a standard wave file with a custom wave writer built into the project.</p>
<p>The graphics format is stored in two different formats.<br />
The floor and ceiling textures are all 64&#215;64 pixels stored as raw 8-bit pixel data, which is also known as &#8220;flats&#8221;. All other graphics are stored in another custom format which seems to be stored as columns of pixels. My take on why this is the case is that all textures that are stored in this custom column-based format are all displayed on the screen either as 2D images or are rendered in the 3D environment vertically as opposed to &#8220;flats&#8221; that are rendered horizontally. It is probably a speed optimization feature of the original DOOM engine to allow easy access to columns of pixels in a texture to render, because the engine itself does ray-tracing which draws columns of pixels to the screen with probably little to no overdraw.</p>
<p>Even drawing the columns themselves are quite optimal. No CPU power is wasted on transparent pixels. Each column of pixels may be made up of one or more &#8220;posts&#8221; of pixels. A post is basically a starting offset where to start drawing pixels within the column followed by how many pixels to draw downwards. If the following byte after the last pixel of the post has a value of 255 it marks the end of the column, but if it doesn&#8217;t have a value of 255 it marks the position of the start of the next post within the column.</p>
<p>The level data gets loaded into a custom data structure and saved to disk as LEV files. These files consist of a header which is followed by the level data lumps and closer to the end of the file a directory structure that contains information regarding the name of each lump, its offset within the file and the length of byte data following the offset position. The lump data is saved exactly as its read from the WAD file. The level data doesn&#8217;t get visualized within the tool at the time of this writing.</p>
<p>Most of the lumps that are not recognized as graphics, levels or sounds are not visualized or extracted to disk at the moment, but this will be fixed with the next update to the Doom WAD Reader &amp; Extractor.</p>
<p>Special thanks goes out to Matthew Fell for his excellent Doom specifications document which made this tool and source release a possibility.</p>
<p>Download the latest version of the Doom WAD Reader &amp; Extractor project.<br />
<a href="http://files.korvinkorax.com/aquire.aspx?id=14">Doom Engine WAD Reader and Extractor v1.0</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2011/09/doom-engine-wad-reader-and-extractor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A New Beginning</title>
		<link>http://www.korvinkorax.com/2011/05/a-new-beginning/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-new-beginning</link>
		<comments>http://www.korvinkorax.com/2011/05/a-new-beginning/#comments</comments>
		<pubDate>Sun, 22 May 2011 14:53:24 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=1</guid>
		<description><![CDATA[Welcome to the brand new Korvin Korax website. The official site for anything Korvin Korax &#38; Jacques Krige. This marks the beginning of a new way of thinking and a new direction when it comes to the creation of art &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2011/05/a-new-beginning/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Welcome to the brand new Korvin Korax website. The official site for anything Korvin Korax &amp; Jacques Krige.</p>
<p>This marks the beginning of a new way of thinking and a new direction when it comes to the creation of art be it of a programmatic technical nature, a musical nature or even visuals. For far too long have I been trapped in a world of code only. Its time for the world of the inner self to come out and become creative&#8230; the way it always were before the code. Its time to rise above the world of the temporary, weathering world of code and also enter the more permanent, timeless world of the arts.</p>
<p>Most of the content currently on the site is technical of nature, but this will change soon as time progress until there is the good mix between the technical and the artistic.</p>
<p>Trent Reznor, Rob Zombie, Marilyn Manson as well as John Carmack have been great sources of inspiration over the years and the creation of this website and what I&#8217;m going to do with it as well as myself will be a testament towards the well of inspiration I&#8217;ve drawn from them since the start of it all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2011/05/a-new-beginning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quake2 BSP Rendering using Microsoft XNA 4</title>
		<link>http://www.korvinkorax.com/2011/04/quake2-bsp-rendering-using-microsoft-xna-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quake2-bsp-rendering-using-microsoft-xna-4</link>
		<comments>http://www.korvinkorax.com/2011/04/quake2-bsp-rendering-using-microsoft-xna-4/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 11:46:17 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[bloom]]></category>
		<category><![CDATA[bsp]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[entity]]></category>
		<category><![CDATA[heretic2]]></category>
		<category><![CDATA[idTech2]]></category>
		<category><![CDATA[md2]]></category>
		<category><![CDATA[quake2]]></category>
		<category><![CDATA[submodel]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=162</guid>
		<description><![CDATA[It&#8217;s been quite some time since I last spent time on my idTech2 XNA Renderer, but I finally managed to upgrade the project to Microsoft XNA 4.0 as well as adding new features and bug fixes. For the longest time &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2011/04/quake2-bsp-rendering-using-microsoft-xna-4/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite some time since I last spent time on my idTech2 XNA Renderer, but I finally managed to upgrade the project to Microsoft XNA 4.0 as well as adding new features and bug fixes. For the longest time I wanted to add MD2 model rendering support, but never got around actually doing the code for it.</p>
<p>While on vacation I thought it will be cool to quickly convert the technology from Microsoft .NET 3.5 and Microsoft XNA 3.1 to .NET 4.0 and XNA 4.0, but great was my disappointment when I realized that it won&#8217;t be a quicky and that there were significant breaking changes introduced in XNA. At least these were all good breaking changes, but none the less it still meant I need to go through the technology with a fine tooth comb and fix the now broken bits of code.</p>
<p><span id="more-162"></span></p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/base1b_02.jpg" title="" class="colorbox" rel="singlepic79" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/79__320x240_base1b_02.jpg" alt="base1b_02" title="base1b_02" />
</a>

<p>&nbsp;</p>
<p>After spending days reading loads of Shawn Hargreaves blog posts regarding these breaking changes and fixing code I finally managed to restore the idTech2 XNA Renderer to a working state. Some of the most challenging issues were changing the actual rendering of some of the existing geometry as it seems they dropped support for using triangle fans which forced me to rewrite all the logic where triangle fans were used in favour of triangle lists.</p>
<p>The other tricky change was the way rendering effects got changed which also caused the bloom post processing to break. So after around a week or two&#8217;s work the renderer was back to its original rendering state. I also found a few minor bugs that also got fixed and quite a number of performance improvements were done.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/base2b_01.jpg" title="" class="colorbox" rel="singlepic81" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/81__320x240_base2b_01.jpg" alt="base2b_01" title="base2b_01" />
</a>

<p>&nbsp;</p>
<p>Another problem that&#8217;s currently not fixed involves Shader Model 3.0 and the bloom post-processing effect. Since the bloom post-processing effect only uses a pixel shader and no vertex shader, running it via SM3 generates the error message &#8220;<em>Cannot mix shader model 3.0 with earlier shader models. If either the vertex shader or pixel shader is compiled as 3.0, they must both be</em>&#8220;. I&#8217;ve checked the internet, but at the time of finishing this version of the idTech2 XNA Renderer I couldn&#8217;t find a solution to this other than using the Shader Model 2 path.</p>
<p>There were quite a number of new features added to the technology, but let&#8217;s start with what got dropped-out. That stupid XML configuration file was removed and made way for a proper application configuration file. Thinking back I really don&#8217;t know why I didn&#8217;t do this from the beginning. One of the real big internal changes in the renderer is the way it loads the BSP files. This was needed because an entity system was necessary to manage the loading and rendering of MD2 models.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/base1b_03.jpg" title="" class="colorbox" rel="singlepic80" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/80__320x240_base1b_03.jpg" alt="base1b_03" title="base1b_03" />
</a>

<p>&nbsp;</p>
<p>After doing the groundwork and researching idTech2&#8242;s entity system the renderer sports a 99% complete idTech2-based entity system which manages the loading and rendering of two out of three types of models namely brush models and alias models. Sprite models isn&#8217;t implemented yet. Brush models are any world geometry be it static worldmodel geometry or geometry the user can interact with and that isn&#8217;t static. Alias models are any MD2 models representing objects, items, monsters etc.</p>
<p>The MD2 model (Alias model) loading and rendering code was done in a record 24 hours, but getting it rock-solid took a further few days with the lighting being properly applied to each model only a few weeks later. The brush model loading and rendering code was significantly changed because in the previous version of the renderer it only loaded the static worldmodel and rendered that via BSP, but within the worldmodel data there are sections of geometry in the data stream that is meant to form part of an entity similarly to a MD2 model.</p>
<p>This geometry data is called submodels. These submodels makes up all the interactive parts of the static BSP world like breakable parts, rotating parts, moveable parts, doors, lifts etc. With some game code (logic) implemented eventually these seemingly static submodels will add some mechanical life to the BSP world.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/dmcloud01.jpg" title="" class="colorbox" rel="singlepic83" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/83__320x240_dmcloud01.jpg" alt="dmcloud01" title="dmcloud01" />
</a>

<p>&nbsp;</p>
<p>Not only is the idTech2 XNA Renderer capable of rendering Quake2 data, it&#8217;s also capable of rendering Heretic II data. Since the Heretic II game is just a heavily modified Quake 2 engine it didn&#8217;t take much extra work to get it to render. Infact, Raven Software didn&#8217;t do any changes to the BSP file structure and it was possible to directly use the Quake 2 BSP tools to build Heretic II BSPs. Most of the work involved implementing Heretic II&#8217;s M8 texture format which is only a modified Quake 2 WAL texture format.</p>
<p>Adding support for Heretic II&#8217;s M8 format enabled the renderer to be able to load and render Heretic II BSP files. Heretic II&#8217;s custom model format isn&#8217;t currently implemented, but maybe the next version of the idTech2 XNA Renderer will see that done.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/base1b_01.jpg" title="" class="colorbox" rel="singlepic78" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/78__320x240_base1b_01.jpg" alt="base1b_01" title="base1b_01" />
</a>

<p>&nbsp;</p>
<p>There are quite a number of entity effects which isn&#8217;t currently implemented in the renderer, because most entity effects relies on game code (logic) which is typically found in Quake2&#8242;s gamex86.dll file. Some examples of these effects are model animation, rotation as well as the application of gravity. All model positioning and rotations in the renderer are expressed as design-time information which means what you see on-screen is actually where they are placed in the world before the game logic takes over. At times these positions and rotations might look strange.</p>
<p>Another example is the static nature of submodels like doors, lifts, fans and other non-static world geometry. Since these submodels are attached to entities they are also rendering without any game code driving them.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/infantry.jpg" title="" class="colorbox" rel="singlepic109" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/109__276x194_infantry.jpg" alt="infantry" title="infantry" />
</a>

<p>&nbsp;</p>
<p>Download the latest version of the <a href="http://wiki.korvinkorax.com/index.php?title=Quake2_BSP_Rendering_using_Microsoft_XNA">Quake 2 XNA project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2011/04/quake2-bsp-rendering-using-microsoft-xna-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>UQE Hexen II v1.14 Released!</title>
		<link>http://www.korvinkorax.com/2011/02/uqe-hexen-ii-v1-14-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uqe-hexen-ii-v1-14-released</link>
		<comments>http://www.korvinkorax.com/2011/02/uqe-hexen-ii-v1-14-released/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 20:47:40 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[bloom]]></category>
		<category><![CDATA[directx]]></category>
		<category><![CDATA[hexen2]]></category>
		<category><![CDATA[interpolation]]></category>
		<category><![CDATA[mdl]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[opengl]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=114</guid>
		<description><![CDATA[Its been a long time coming, but finally its here! UQE Hexen II v1.14! This new and second release of UQE Hexen II came almost five years since the very first release back in 2006 and it boasts a number &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2011/02/uqe-hexen-ii-v1-14-released/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Its been a long time coming, but finally its here!<br />
UQE Hexen II v1.14!</p>
<p>This new and second release of UQE Hexen II came almost five years since the very first release back in 2006 and it boasts a number of really great additions and fixes to the engine. Here we will highlight the most important ones, but for a complete list of new features and changes see the change log.</p>
<p>When it comes to the technologies used; I have updated the DirectX libraries to the latest and compiled and linked to them as well as updated the OpenGL extensions header files to make sure the code is aware of any new extensions that are available. The engine have also been compiled with Visual Studio 2010 which in itself fixes a lot of issues with the binary engine. All 16-bit video modes have been removed from the engine to create room for higher resolutions up to HD resolutions.</p>
<p><span id="more-114"></span></p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen08.jpg" title="" class="colorbox" rel="singlepic9" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/9__300x168_hexen08.jpg" alt="hexen08" title="hexen08" />
</a>

<p>&nbsp;</p>
<p>The 2D rendering logic managing things like statusbars, text, menus and the likes had to be updated to allow for the proper scaling there-of since the addition of HD resolutions makes the 2D stuff to become ridiculously tiny. The 2D scaling logic in the engine has been significantly improved. Also featuring is the ability to load non-power-of-two textures which fixes that &#8220;corrupted&#8221; or &#8220;malformed&#8221; look the engine shows which is aparent with most of the 2D graphics when compared to the software version of the engine. The OpenGL renderer now match perfectly with the quality of the software renderer in that regard.</p>
<p>External texture loading support have been sigificantly improved. Not only can bump mapping textures be internally generated, but the ability has been added to allow authors to load their own bump mapping textures. Normal mapping would be a more correct term. External texture loading was also simplified a lot by not forcing the loading of Hexen II WAL files. External luma textures are also supported now to allow &#8220;glowing&#8221; texture overlays. It&#8217;s also possible now to load external sky textures for classic Hexen II style skies. Another nice addition is the support for colored lighting via external .LIT files to give the world a more natural feel.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen12.jpg" title="" class="colorbox" rel="singlepic13" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/13__300x168_hexen12.jpg" alt="hexen12" title="hexen12" />
</a>

<p>&nbsp;</p>
<p>A feature people have been asking for ages to be added to UQE is interpolation. Well, the good news is that its finally and fully implemented. There are three major interpolation technologies implemented in UQE Hexen II v1.14 now. Translation interpolation smooths the positional movement of entities. Rotation inperpolation smooths the rotations of entities. Animation interpolation smooths the rendering of MDL model animations attached to entities. Translation and Animation interpolation are enabled by default with only Rotation interpolation which is disabled by default since I&#8217;m not 100% satisfied with its results. The documentation that comes with the engine contains all the information on how to enable/disable any of these interpolation methods.</p>
<p>The nicest feature of all that has been added to the engine is frame buffer objects using the OpenGL extension &#8220;GL_EXT_framebuffer_object&#8221;. With this the engine now features an all new bloom post-processing effect, written from the ground up to replace the dated bloom method used in previous UQE releases as well as other engine mods. The full power of the GPU is harnessed to process bloom using GLSL. Not only does it look better, but it also performs better. The addition of frame buffer objects also opens the floodgates to even more impressive post processing features that could be added in the future like for example motion blur!</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-uqe-hexen-ii/hexen19.jpg" title="" class="colorbox" rel="singlepic20" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/20__300x168_hexen19.jpg" alt="hexen19" title="hexen19" />
</a>

<p>&nbsp;</p>
<p>This new bloom technology is my contribution to the Quake community. Read on the change log for more information regarding what has been done with this version of UQE Hexen II.</p>
<p>Download <a href="http://wiki.korvinkorax.com/index.php?title=UQE_Hexen_II">UQE Hexen II</a> and enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2011/02/uqe-hexen-ii-v1-14-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quake2 BSP Rendering using Microsoft XNA</title>
		<link>http://www.korvinkorax.com/2009/05/quake2-bsp-rendering-using-microsoft-xna/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quake2-bsp-rendering-using-microsoft-xna</link>
		<comments>http://www.korvinkorax.com/2009/05/quake2-bsp-rendering-using-microsoft-xna/#comments</comments>
		<pubDate>Fri, 22 May 2009 20:00:47 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[bloom]]></category>
		<category><![CDATA[bsp]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[idTech2]]></category>
		<category><![CDATA[leaf]]></category>
		<category><![CDATA[lightmapping]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[pvs]]></category>
		<category><![CDATA[quake2]]></category>
		<category><![CDATA[vis]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=95</guid>
		<description><![CDATA[The past few months I&#8217;ve been working on/off on a project that loads and renders Quake2 (idTech2) BSP files using the .NET language called C# for the program logic and XNA for input and rendering purposes. Initially the idea was &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2009/05/quake2-bsp-rendering-using-microsoft-xna/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The past few months I&#8217;ve been working on/off on a project that loads and renders Quake2 (idTech2) BSP files using the .NET language called C# for the program logic and XNA for input and rendering purposes. Initially the idea was to use XNA and build from the ground up game technology to run our titles on using technologies I&#8217;m familiar with in the form of the Quake and idTech2 engines. Initially the idea was to try and swat two flies at once by developing tech that could carry our game titles on as well as have a clean replacement for our &#8220;Ultimate Quake Engine&#8221; (UQE) project.</p>
<p>This is the utopia, but it is not possible to accomplish this in a decent timeframe.<br />
On the one hand you want to build technology that is competitive regarding capabilities to other engines or renderers out there, but on the other hand you want to remain faithful to what the technology should be able to do regarding the UQE project. Ultimately its impossible to build a single technology that looks into both directions without having a dated or bloated design. We decided the best was to go, as Corvus Games, is to utilize XNA for simpler arcade-like titles and for larger titles license a commercial engine like Torque3D and the likes.</p>
<p><span id="more-95"></span></p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/base1_01.jpg" title="" class="colorbox" rel="singlepic77" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/77__320x240_base1_01.jpg" alt="base1_01" title="base1_01" />
</a>

<p>&nbsp;</p>
<p>So, why are we still working on the Quake2 BSP Renderer?<br />
Since we spent so much time getting it as far as it is, we decided to finish-up the project and release the source code using the GPL license to help other like-minded people to gain access to the source code and hopefully learn from it. Its a much better proposition then stuffing it into our archives to gather dust! There is also another twist to the story; The project turned out to be an experimental renderer for our efforts over at our &#8220;idTech&#8221; community project, UQE. We are still looking at writing a .NET/XNA version of the idTech2 engine making as much as possible use of XNA to faithfully render the Quake2 game. We will also be looking at building loading and translation paths for Quake1 and Hexen2 at a later stage should the Quake2 project be successful.</p>
<p>The UQE project is a very personal project of mine and with it I&#8217;m sharing my passion for the idTech engines with both gamers and game developers interested in the same subject matter. UQE is not one of our primary game development objectives and its development is being managed as time permits us to work on it. The UQE project is great for expanding our knowledge on XNA and helping us build and use game subsystems we can re-use for our XNA targetted projects. It also stands as proof for anyone out there that game development and its related technologies is completely possible in Africa and in showing she is not as dark and illiterate as the media makes her out to be. As far as my research stretches at the time of this writing, Corvus Games have developed THE most complete XNA-based idTech2 BSP renderer out there. Yet, sadly, our renderer is not complete, it still lacks entity (MD2 and submodels) rendering as well as rendering static lightmap styles.</p>
<p>Lets get right into the technologies the renderer consists of and what you could learn from it&#8230;<br />
When the renderer starts-up it loads the BSP level specified in its config.xml file. If this file doesn&#8217;t exist, it creates one with some default values. The configuration system implemented is a very quick and dirty one just to allow you to change a few variables that would otherwise be hardcoded.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/ware1_01.jpg" title="" class="colorbox" rel="singlepic89" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/89__320x240_ware1_01.jpg" alt="ware1_01" title="ware1_01" />
</a>

<p>&nbsp;</p>
<p>The very first thing Q2BSP does is either load the assets directly from the disk as single files or it loads the assets from the PAK virtual file system. The code managing the PAK file is very basic and just manages the loading from a specific PAK file and is not a fully fledged virtual file system&#8230; yet. Even though optionally loading from a .PAK file is great, I think its not the most optimal solution. For a custom virtual file system to work you must be able to stream any data from it for use, but I found it difficult to near impossible to stream a wave file into a form that can be played back by XNA.</p>
<p>I did some reading up on the .XNB format, and it seems it can store multiple files and the XNA API can easily access that file to read data from it. Since we don&#8217;t want to re-invent a feature that seems to be present, the best thing most likely to do is to build a little conversion tool that can read PAK data and compile XNB data from it, then use the XNB as storage mechanism rather than PAK files.</p>
<p>For this project you&#8217;ll be able to load any BSP level contained inside a PAK. We have tested it with the pak0.pak file of Quake2 full version, but it should work fine with the demo and other custom PAK files. The only requirement for the loading from a PAK is that ALL assets that has to be loaded needs to be in that very same file, or everything must be external files if the PAK loading option is disabled. Thats how basic the PAK implementation for Q2BSP is.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/jail4_01.jpg" title="" class="colorbox" rel="singlepic86" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/86__320x240_jail4_01.jpg" alt="jail4_01" title="jail4_01" />
</a>

<p>&nbsp;</p>
<p>With the BSP file loaded the renderer is ready to render the world. The whole world is broken up into surfaces. A surface is a set of vertices that defines a piece of flat geometry. A surface also has a fixed maximum dimensional size limit to easily be broken up for rendering by the PVS and if also an effect of BSP. This means a single flat large wall will be made up by several pieces of surfaces. A surface can have several primitives.</p>
<p>Because of BSP partitioning a leaf can have several surfaces attached to it that forms a piece of geometry. A leaf could for example be that complete large wall, or just a chunck of it. Next we get something we call clusters, or to put it in easier terms, leaf clusters. A cluster is simply a set of possibly visible leafs. So what happens is when you have a specific position in the world, BSP traversing is used to determine which cluster you are in. Once we know the cluster number (index) we look up the PVS and get a list of leaves visible for that cluster. This set of leaves gets drawn to the screen.</p>
<p>If you want to visualize this in your mind&#8217;s eye, you can imagine a cluster being a volume of space could be big or small, depending on the geometry, you could move you camera in without the geometry PVS changing. Once you move from one cluster to a neigbouring cluster the PVS needs to be re-checked and a new set of leaves needs to be drawn. What is notable is that clusters that are closer together share relatively the same set of leaves. Its very possible that 5 neigbouring clusters would share 70% of the same leaves, depending on how the world is constructed.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/boss1_01.jpg" title="" class="colorbox" rel="singlepic82" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/82__320x240_boss1_01.jpg" alt="boss1_01" title="boss1_01" />
</a>

<p>&nbsp;</p>
<p>One of the performance drawbacks that still remains to be solved is to optimally sort the number of surfaces in the current cluster in such a way that we could make use of Index Buffers and execute draw calls using the DrawIndexedPrimitives() function rather than using the DrawPrimitives() function that we currently use. DrawPrimitives() gets called one for each surface that is visible in the current cluster, but if we could use DrawIndexedPrimitives() we could greatly reduce the number of drawing calls that we need to issue. We are still looking at a few scenarios to see where the use of DrawIndexedPrimitives() works well and where it breaks functionality.</p>
<p>The first priority is to sort surface rendering by texture (texinfo) then from there build a triangle list based index buffer every time the camera changes PVS cluster. This will change the scene rendering from per-surface DrawPrimitives() to per-texture DrawIndexedPrimitives(). I&#8217;m not sure if it will be jittery if the camera move from one cluster to the next. The only way to know is to code it and find out. Maybe changing the code from DrawPrimitives() to DrawIndexedPrimitives() frees the CPU enough that you don&#8217;t notice. For this release the renderer will be rendering the scene primarily using DrawPrimitives() until at a later stage we update the code for DrawIndexPrimitives() rendering.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/jail5_01.jpg" title="" class="colorbox" rel="singlepic87" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/87__320x240_jail5_01.jpg" alt="jail5_01" title="jail5_01" />
</a>

<p>&nbsp;</p>
<p>The BSP the renderer traverse the BSP nodes and mark surfaces for rendering in two distinct groups namely &#8220;solid&#8221; surfaces and &#8220;translucent/warped&#8221; surfaces. The reasoning behind this is to render the world in two phases, phase 1 renders all the solid opague surfaces in the world, then phase 2 renders all the translucent and warped surfaces. With the solid surface rendering phase it does not really matter if we re-sort the list of surfaces according to texture (texinfo) and not according to its original depth sort order. Most of the surfaces are solid surfaces, and sorting according to texture greatly improves rendering performance. We are not so lucky with translucent surfaces, because we need to render them in the order we get them from the BSP/VIS to make sure we don&#8217;t introduce rendering anomalies because of the depth and rendering order.</p>
<p>Surfaces with the &#8220;warp&#8221; flag set gets broken into 64-unit sized sets of sub-surfaces which we call &#8220;polygons&#8221; within the source code. The reason why warped surfaces gets subdivided is to generate more vertices for the original warped surface to make the ST texture coordinate warping effect possible. This possible large number of primitives using the same texinfo index are being rendered by a call to DrawIndexedPrimitives().</p>
<p>Classic Quake2 lightmapping have also been implemented using multitexturing. In the pixel shader the texture pixels gets multiplied with the lightmap pixels to produce the final pixel for output. We have not yet implemented static lightmap styles, like strobing lights, flickering lights and the likes. There are two types of lightmaps implemented in Quake, idTech2 and idTech3. They are called &#8220;static&#8221; lightmaps and &#8220;dynamic&#8221; lightmaps.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/jail3_01.jpg" title="" class="colorbox" rel="singlepic85" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/85__320x240_jail3_01.jpg" alt="jail3_01" title="jail3_01" />
</a>

<p>&nbsp;</p>
<p>The difference is static lightmaps are pre-processed lightmaps that are fixed and also could have a &#8220;style&#8221; pre-processed with it, like flickers and strobes and so forth. Then you get &#8220;dynamic&#8221; lightmaps which gets calculated on-the-fly and gets temporarily blended with the original &#8220;static&#8221; lightmaps. To give a quick example is when you fire a rocket, it generates a pointlight that lights up the area as it passes through the air and explodes against an object, that light it generates on-the-fly (no pun intended) is a dynamic lightmap.</p>
<p>This dynamic lightmapping looks pretty ugly, especially with Quake and idTech2&#8242;s low resolution lightmaps. We can remedy this by not implementing all the software routines needed to generate and blend this dynamic lightmap by generating dynamic per-pixel lights straight on the GPU&#8230; afterall, we already have access to both the texture pixels as well as the lightmap pixels. In the renderer you can switch on/off a per-pixel pointlight that is attached to your camera position. What this pointlight in reality does is it &#8220;eats&#8221; the color value of only the static lightmap pixel at the pixel shader level and returns a modified static lightmap pixel, which we then multiply with the texture pixel to get our final pixel output result. The calculations isn&#8217;t 100% perfect yet.</p>
<p>Just for the fun of it we implemented two types of lighting; Classic lightmapped multitexturing and actual per-pixel hardware lighting. The BSP levels are not completely compatible and designed for per-pixel hardware lighting, but its cool to see it sort-of working. Theres a section of code that I left commented that anyone can uncomment which will add per-pixel pointlights for every pointlight entity present in any given BSP level loaded.</p>

<a href="http://www.korvinkorax.com/wp-content/gallery/programming-quake-2-xna/jail1_01.jpg" title="" class="colorbox" rel="singlepic84" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/84__320x240_jail1_01.jpg" alt="jail1_01" title="jail1_01" />
</a>

<p>&nbsp;</p>
<p>The focus of the project was to get good Quake2 BSP rendering up and running with decent performance, not focussing on things like error-checking, good object-orientated design and great performance. When decompressing the archive you&#8217;ll find a pre-built binary in &#8220;release&#8221; mode as well as the GPL source code as it stands now at its current state. Included with the binary is a &#8220;config.xml&#8221; configuration file with a few changeable settings. The build is configured to search and load from PAK0.PAK the &#8220;base1.bsp&#8221; level. All that needs to be done is to copy the PAK0.PAK of the Quake2 demo or commercial version into the &#8220;baseq2&#8243; folder located within the &#8220;contents&#8221; folder.</p>
<p>When Q2BSP starts up it generates a file called &#8220;config.txt&#8221; which contains a list of the names of all the BSP files thats part of the commercial version of Quake2. This is done to help anyone that doesn&#8217;t have a PAK reader tool at hand to have a list of BSP files that could be tried out. It is also possible to load some of the deathmatch levels if the commercial version is sufficiently patched, although a PAK editing tool will be needed because the data need to be either merged into a single PAK, or everything needs to be unpacked. This needs to be done since the Q2BSP renderer doesn&#8217;t have a fully fledged Virtual File System.</p>
<p>Some other features available in the Q2BSP renderer is the ability to switch between solid and wireframe fill modes. The PVS can also be locked to help developers see where the PVS ends from a selected area. Also featuring is the ability is switch the bloom post-process effect on/off. The bloom post-process effect itself is slightly over-emphasized in this experimental renderer, but it demonstrates what the effect can do to make this classic game media slightly (ever so slightly) more current or at least in the right direction.</p>
<p>Download the latest version of the <a href="http://wiki.korvinkorax.com/index.php?title=Quake2_BSP_Rendering_using_Microsoft_XNA">Quake 2 XNA project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2009/05/quake2-bsp-rendering-using-microsoft-xna/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MDL Model Conversion</title>
		<link>http://www.korvinkorax.com/2008/11/mdl-model-conversion/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mdl-model-conversion</link>
		<comments>http://www.korvinkorax.com/2008/11/mdl-model-conversion/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 19:36:45 +0000</pubDate>
		<dc:creator>Jacques Krige</dc:creator>
				<category><![CDATA[Ultimate Quake Engine]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[md2]]></category>
		<category><![CDATA[mdl]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[planar]]></category>
		<category><![CDATA[quake]]></category>
		<category><![CDATA[quake2]]></category>
		<category><![CDATA[skin]]></category>
		<category><![CDATA[texture]]></category>

		<guid isPermaLink="false">http://www.korvinkorax.com/?p=79</guid>
		<description><![CDATA[The past two weeks I&#8217;ve been doing a lot of reading with regards to the specifications of the Quake1 (and Hexen2) MDL model format and the Quake2 MD2 model format. Mostly looking at where they are similar, where they differ &#8230;<p class="read-more"><a href="http://www.korvinkorax.com/2008/11/mdl-model-conversion/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>The past two weeks I&#8217;ve been doing a lot of reading with regards to the specifications of the Quake1 (and Hexen2) MDL model format and the Quake2 MD2 model format. Mostly looking at where they are similar, where they differ and if there is any functionality missing in the one and extra in the other and vice versa as well as anything thats engine specific. I mostly relied on 3rd party spec papers as well as Quake1 and Quake2 engine/tools code to understand the structure of both formats.</p>
<p>Most of my time was spent decoding the MDL format and making sure that all data I load DOES make sense because theres no ways you can during the process know if you are doing it right or not, unless you are willing to spend the time to echo your results in a custom renderer to visualize the data. I&#8217;m too lazy for that type of effort.</p>
<p><span id="more-79"></span></p>
<p>The past few days I&#8217;ve been spending translating the data from uqeModel&#8217;s MDL structures to its MD2 structures and calculating missing/unknown data. Funny enough, theres quite a few bits of those going around between the two formats.</p>
<p>Something Missing:<br />
Quake1 was designed and released before the time of 3D hardware which means they had their own way of rendering the model triangles. I&#8217;m assuming they did standard GL_TRIANGLES style rendering. With the introduction of GLQuake they had to generate extra data for each model to have it render more optimally using triangle strips and triangle fans. To do this they had to generate something called a &#8220;gl_commands&#8221; list and saved it for rendering. They had to do that optimization back then, since 3D hardware wasn&#8217;t all that powerful and rendering GL_TRIANGLES style would have killed game playability. If you ever wondered what that &#8220;meshing&#8230;&#8221; and .MS2 files was all about&#8230; now you know!</p>
<p>With the Quake2 .MD2 format the &#8220;gl_commands&#8221; data was stored right in the model format, ready to be used in the engine. Worst of all is that the &#8220;gl_commands&#8221; list used in Quake1 (which the engine generated) is not the same as that stored in the Quake2 .MD2 model format. So I ended up having 5 different Visual Studio projects open at the same time to cross reference. I was looking at Quake engine code, Quake2 engine code, the Quake2 &#8220;qdata&#8221; tool coding as well as the Quake1 &#8220;modelgen&#8221; tool coding.</p>
<p>The command list is basically a list (array) of integers telling the engine when to render a triangle strip and when to render a triangle fan and how long they are. The list also includes &#8220;decompressed&#8221; ST texture coordinates for each vertex.</p>
<p>These &#8220;compressed&#8221; vertex and texture coordinates are quite interesting. The XYZ/ST coordinates was saved as &#8220;byte&#8221; values obviously ranging from 0 to 255. These &#8220;compressed&#8221; data was used to save space on model size. To get the actual floating point coordinates they multiplied these &#8220;compressed&#8221; values with a floating point &#8220;scale&#8221; value, then added a floating point &#8220;translation&#8221; value.</p>
<p>Generating Quake2 style &#8220;gl_commands&#8221; was particularly tricky because I needed to generate these &#8220;gl_commands&#8221; after I translated the MDL structures into the MD2 structures, because I needed to calculate them based upon the data contained in the MD2 structures.</p>
<p>The biggest headache was to find the vertex seams and ST coordinates since Quake1 models uses planar texture mapping. Imagine cutting tennis ball in half.</p>
<p>Once a &#8220;seam&#8221; vertex was found I had to duplicate the ST coordinates and &#8220;move&#8221; the S coordinate by 0.5 to place it on the backside of the model. This I had to do correctly for all affected &#8220;seamed&#8221; vertices before attepting to generate the &#8220;gl_commands&#8221; list otherwize the back-plane skin mapping gets all messed up like one of the below screenshots will show you.</p>
<p>Something Extra:<br />
One of the biggest differences between the Quake1 model format and that of the Quake2 model format is that the Quake1 MDL format has two types of animation frames where-as Quake2 has only one type. The MDL model format has a frametype SINGLE and a frametype GROUPED where-as the MD2 model format only supports the SINGLE frametype.</p>
<p>The difference between the two types is simple: SINGLE frames are the typical framed animations that are controlled by your game logic.. no surprizes there, but GROUPED frames are a whole different ballgame. GROUPED frames in essence are looped framed animations complete with interval timing information for each frame contained in a group header which is controlled by the engine, rendering independantly from game logic.. well as far as I could have gathered at the moment.</p>
<p>Currently our uqeModels tool doesn&#8217;t support converting them yet, although it does load them correctly from any MDL. Once I fully understand how I will manage this in the Quake2 engine I will start writing supporting tech for them. I&#8217;m not too keen on breaking away from the original MD2 format, so I will likely try to find examples in the Quake2 game thats acts similarly on models. Hopefully I do find something.</p>
<p>Over the weekend I should be able to successfully render these newly generated/converted models within the engine. Without wasting more time, below are some sweet screenshots of the work in action! All the code doing the conversion was done using C#.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-emulating-quake/q1_demon_mdl.jpg" title="" class="colorbox" rel="singlepic104" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/104__320x240_q1_demon_mdl.jpg" alt="q1_demon_mdl" title="q1_demon_mdl" />
</a>
The original &#8220;demon&#8221; Quake1 MDL model. Rendered here in &#8220;qME&#8221; (Quake Model Editor). This is as original as it gets.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-emulating-quake/q1_demon_md2_a.jpg" title="" class="colorbox" rel="singlepic105" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/105__320x240_q1_demon_md2_a.jpg" alt="q1_demon_md2_a" title="q1_demon_md2_a" />
</a>
The converted &#8220;demon&#8221; Quake2 MD2 model. Rendered here in &#8220;qME&#8221; (Quake Model Editor). No skin texture available at the time.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-emulating-quake/q1_demon_md2_b.jpg" title="" class="colorbox" rel="singlepic106" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/106__320x240_q1_demon_md2_b.jpg" alt="q1_demon_md2_b" title="q1_demon_md2_b" />
</a>
The converted &#8220;demon&#8221; Quake2 MD2 model. Rendered here in &#8220;qME&#8221; (Quake Model Editor). Skinned this time, but the model &#8220;seam&#8221; vertices are corruping the ST coordinates.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-emulating-quake/q1_demon_md2_c.jpg" title="" class="colorbox" rel="singlepic107" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/107__320x240_q1_demon_md2_c.jpg" alt="q1_demon_md2_c" title="q1_demon_md2_c" />
</a>
The converted &#8220;demon&#8221; Quake2 MD2 model. Rendered here in &#8220;qME&#8221; (Quake Model Editor). Skinned with the seams and ST coordinates corrected.</p>
<p>
<a href="http://www.korvinkorax.com/wp-content/gallery/programming-emulating-quake/q1_demon_skin0.jpg" title="" class="colorbox" rel="singlepic108" >
	<img class="ngg-singlepic" src="http://www.korvinkorax.com/wp-content/gallery/cache/108__308x177_q1_demon_skin0.jpg" alt="q1_demon_skin0" title="q1_demon_skin0" />
</a>
The converted &#8220;demon&#8221; Quake2 MD2 model. Showing here the internal 8-bit skin exported as a true color TGA.</p>
<p><a href="http://files.korvinkorax.com/aquire.aspx?id=15">Quake &#8211; Pack Extractor</a><br />
Extracts all assets from any given standard PAK file from any game using the Quake or idTech2 (Quake 2) game engine. The archive includes source code as well as pre-built binaries.</p>
<p><a href="http://files.korvinkorax.com/aquire.aspx?id=13">Quake &#8211; Tools (model &amp; map converter)</a><br />
Converts standard Quake MDL models to Quake 2 MD2 models. Also contains a tool that can convert standard Quake MAP source files to Quake 2 MAP files. The archive includes source code as well as pre-built binaries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.korvinkorax.com/2008/11/mdl-model-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

