<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type='text/xsl' href='http://bphelpsdev.spaces.live.com/mmm2008-07-24_12.50/rsspretty.aspx?rssquery=en-US;http%3a%2f%2fbphelpsdev.spaces.live.com%2fcategory%2fGeneral%2bGame%2bProgramming%2ffeed.rss' version='1.0'?><rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:msn="http://schemas.microsoft.com/msn/spaces/2005/rss" xmlns:live="http://schemas.microsoft.com/live/spaces/2006/rss" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bryan's space: General Game Programming</title><description /><link>http://bphelpsdev.spaces.live.com/?_c11_BlogPart_BlogPart=blogview&amp;_c=BlogPart&amp;partqs=catGeneral%2bGame%2bProgramming</link><language>en-US</language><pubDate>Thu, 24 Jul 2008 02:54:41 GMT</pubDate><lastBuildDate>Thu, 24 Jul 2008 02:54:41 GMT</lastBuildDate><generator>Microsoft Spaces v1.1</generator><docs>http://www.rssboard.org/rss-specification</docs><ttl>60</ttl><cf:parentRSS>http://bphelpsdev.spaces.live.com/blog/feed.rss</cf:parentRSS><live:type>blogcategory</live:type><live:identity><live:id>6928811135990455328</live:id><live:alias>bphelpsdev</live:alias></live:identity><cf:listinfo><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="typelabel" label="Type" /><cf:group ns="http://schemas.microsoft.com/live/spaces/2006/rss" element="tag" label="Tag" /><cf:group element="category" label="Category" /><cf:sort element="pubDate" label="Date" data-type="date" default="true" /><cf:sort element="title" label="Title" data-type="string" /><cf:sort ns="http://purl.org/rss/1.0/modules/slash/" element="comments" label="Comments" data-type="number" /></cf:listinfo><item><title>Level Formats</title><link>http://bphelpsdev.spaces.live.com/Blog/cns!602815048C7B5C20!161.entry</link><description>&lt;div&gt;One major weakness about Fields of Chaos (besides the network code &lt;img title="Tongue out" style="vertical-align:middle" alt="Tongue out" src="http://shared.live.com/HjKMzTS-xzcms40!CabizA/emoticons/smile_tongue.gif"&gt;) was the level format. I actually created the level format less than a week before the game was due, which was crazy, and wrote the level editor in one night, which was also crazy. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Anyways the level format was a heightmap + objects scattered around the level. This might be OK for games that are mainly outdoors, but for a first person shooter, i don't feel its good enough, as you need some indoor areas to be interesting. However, for that project, it was the easiest thing, as I had already coded up a terrain rendering engine (that was my pet project after finishing PsyOps).  And it worked OK for our game, the circle level at least was pretty cool I thought - you kind of got the sense of being in a giant valley with mountains around you.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;After Fields of Chaos, I was inspired by a better way to represent levels. I was somewhat familiar with the BSP format (having made a few maps for Half-Life and Half-Life 2), and i used some other level editors (i made levels for Dark Forces 1 &amp;amp; 2 back in the day...) The main thing that attracted me to it was that GTK Radiant was open source, and could make BSPs, and is a solid tool. &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Thus, I began my journey to write a BSP renderer for Quake 3 levels. Reading in the data wasn't very hard (although ironically more of a pain than in C++ because I couldn't do a direct read from structs, as far as I know... so I used a BinaryReader and had to read each item individually). Displaying most of the mesh wasn't tooo hard, although the double offsets with the meshverts and everything took a little while to wrap my head around. The bezier patches were more  of a pain in the @ss but eventually those got figured out too..&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;The biggest difficulty I had was in rendering the BSP EFFICIENTLY. The problem is, the BSP &amp;quot;idea&amp;quot; is great for having minimal overdraw... However, graphics hardware today is (somewhat) less sensitive to overdraw, but WAY more sensitive to the number of draw calls you make. I was making a DrawIndexedPrimitive call for every single face - which is extremely slow &amp;amp; bad!&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;My solution was to combine faces - i would group them together in &amp;quot;facegroups&amp;quot;, where faces having the same texture &amp;amp; lightmap would be combined using a depth first traversal of the tree. I set a max limit on the number of faces, but I have never hit it yet, thus it doesn't really matter that I used depth-first as opposed to breadth-first... This yeilded excellent performanec gains. Of course, i kind of lost the benefit of having a BSP in the first place - although the PVS data generated was still extremely valuable in culling entities and non-visible facegroups.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;However, my rendering was still a bit slow.. I had experimented with Parallax mapping and Parallax Occlusion mapping previously, but I had turned it off (or so I thought). I had thought that maybe fill rate was the bottle neck (even with PM/POM turned off), but it turns out, on both my GeForce 6800 and ATI X1400, that the vertex shader was the bottleneck. The (more than a few) matrix multiplications needed to calculate the tangent, binormal, normal in object space were tearing up my GPU apparently... oh well... once i fixed that, it again greatly improved performance.&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Anyway thats its for now for my level saga. Hopefully that wasn't too boring - consider this &amp;quot;to be continued&amp;quot;&lt;/div&gt;&lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=6928811135990455328&amp;page=RSS%3a+Level+Formats&amp;referrer=" width="1px" height="1px" border="0" alt=""&gt;&lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;NA=1149&amp;amp;PI=73329&amp;amp;RF=&amp;amp;DI=3919&amp;amp;PS=85545&amp;amp;TP=bphelpsdev.spaces.live.com&amp;amp;GT1=bphelpsdev"&gt;</description><comments>http://bphelpsdev.spaces.live.com/Blog/cns!602815048C7B5C20!161.entry#comment</comments><guid isPermaLink="true">http://bphelpsdev.spaces.live.com/Blog/cns!602815048C7B5C20!161.entry</guid><pubDate>Fri, 11 Apr 2008 05:03:11 GMT</pubDate><slash:comments>0</slash:comments><msn:type>blogentry</msn:type><live:type>blogentry</live:type><live:typelabel>Blog entry</live:typelabel><wfw:commentRss>http://bphelpsdev.spaces.live.com/blog/cns!602815048C7B5C20!161/comments/feed.rss</wfw:commentRss><wfw:comment>http://bphelpsdev.spaces.live.com/Blog/cns!602815048C7B5C20!161.entry#comment</wfw:comment><dcterms:modified>2008-04-11T05:04:56Z</dcterms:modified></item></channel></rss>