<?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>Jacob Repp &#187; game programming</title>
	<atom:link href="http://jrepp.com/category/game-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://jrepp.com</link>
	<description>Game programming, music and life</description>
	<lastBuildDate>Fri, 16 Dec 2011 06:03:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Overview of the Z-machine</title>
		<link>http://jrepp.com/2009/06/26/overview-of-the-z-machine/</link>
		<comments>http://jrepp.com/2009/06/26/overview-of-the-z-machine/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 23:01:25 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[history]]></category>

		<guid isPermaLink="false">http://jrepp.com/2009/06/26/overview-of-the-z-machine/</guid>
		<description><![CDATA[Here is a good article outlining the Z-machine. This is the machine that runs all of the Infocom text adventures including Zork for which the virtual machine is named. This is some really interesting engineering and you can still see &#8230; <a href="http://jrepp.com/2009/06/26/overview-of-the-z-machine/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a <a href="http://www.csd.uwo.ca/Infocom/Articles/small.html">good article</a> outlining the Z-machine. This is the machine that runs all of the Infocom text adventures including Zork for which the virtual machine is named. This is some really interesting engineering and you can still see the modern fruits of this online in the <a href="http://parchment.toolness.com/">Parchment project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2009/06/26/overview-of-the-z-machine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some D on Linux Progress</title>
		<link>http://jrepp.com/2008/03/05/some-d-on-linux-progress/</link>
		<comments>http://jrepp.com/2008/03/05/some-d-on-linux-progress/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 05:46:11 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[d]]></category>
		<category><![CDATA[game programming]]></category>

		<guid isPermaLink="false">http://jrepp.com/2008/03/05/some-d-on-linux-progress/</guid>
		<description><![CDATA[I&#8217;ve spent some time looking at D again and really trying to evaluate it&#8217;s fitness for MMO game development. There&#8217;s a lot of holes left still in the whole development picture. The IRC channel has been a really great source &#8230; <a href="http://jrepp.com/2008/03/05/some-d-on-linux-progress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent some time looking at D again and really trying to evaluate it&#8217;s fitness for MMO game development. There&#8217;s a lot of holes left still in the whole development picture. The IRC channel has been a really great source of information, and is generally a fun place to hang out.</p>

<p>It might seem like a small thing but a huge milestone I&#8217;ve hit recently is getting a full tool chain running patched gcc-4.1 and gdb-6.5 with D support. Here&#8217;s a sample call stack from a crasher I&#8217;m investigating in phobos. Notice that it has the correct line numbers and all the D symbols are correctly demanged. This isn&#8217;t the case if I use stock dmd or gdb.</p>

<pre><code>Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211786352 (LWP 19585)]
0xb7dcccbc in memcpy () from /lib/tls/i686/cmov/libc.so.6
(gdb) bt
#0  0xb7dcccbc in memcpy () from /lib/tls/i686/cmov/libc.so.6
#1  0x0805ac8e in _adDupT (ti=@0x806381c, a={length = 134815743, ptr = 0xb7c72c1f})
    at ../.././libphobos/internal/gc/gc.d:1045
#2  0x08055a25 in std.stdio.readln(std.c.stdio._iobuf*, inout char[]) (fp=0xb7ea1440, buf=@0xb7c5932c) at ../.././libphobos/std/stdio.d:447
#3  0x08055aaa in std.stdio.readln(std.c.stdio._iobuf*) (fp=0xb7ea1440)
    at ../.././libphobos/std/stdio.d:281
#4  0x0804a218 in main.ConsoleThread.run() (this=@0xb7c5bb00) at main.d:37
#5  0x08053620 in std.thread.Thread.threadstart() (p=0xb7c5bb00)
    at ../.././libphobos/std/thread.d:988
#6  0xb7eaa46b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7  0xb7e2e6de in clone () from /lib/tls/i686/cmov/libc.so.6
(gdb) 
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2008/03/05/some-d-on-linux-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IGN RPG Vault Interview</title>
		<link>http://jrepp.com/2007/10/27/ign-rpg-vault-interview/</link>
		<comments>http://jrepp.com/2007/10/27/ign-rpg-vault-interview/#comments</comments>
		<pubDate>Sat, 27 Oct 2007 01:04:40 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[tabula rasa]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/10/27/ign-rpg-vault-interview/</guid>
		<description><![CDATA[I was interviewed with 3 other programmers for an IGN Vault piece this week. TheyÂ  asked us to describe some of the challenges we had to overcome to ship the game. It was nice toÂ be able to talk about some &#8230; <a href="http://jrepp.com/2007/10/27/ign-rpg-vault-interview/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><img src="http://jrepp.com/wp-content/uploads/2007/10/tabula-rasa-art-big.thumbnail.jpg" alt="Tabula rasa art" /></p>

<p>I was <a href="http://rpgvault.ign.com/articles/830/830189p1.html">interviewed with 3 other programmers</a> for an IGN Vault piece this week. TheyÂ  asked us to describe some of the challenges we had to overcome to ship the game. It was nice toÂ be able to talk about some of theÂ technology behind the game publicly.Â After ship I&#8217;d like to go into more detail onÂ what we&#8217;re doingÂ server-side,Â within limitsÂ unfortunately <img src='http://jrepp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Â Today I&#8217;ll be participating with the rest of the team in the <a href="http://www.rgtr.com/news/latest_news/ign_cuppajo_and_the_tabula_rasa_eob_event.html">Kill General British event</a>. You can find me in <a href="http://www.tabularasawiki.org/action/view/Valverde_Plateau">Valverde Plateau</a> as General Britsauce. Beware of my mad genadier PKing skillz!</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/10/27/ign-rpg-vault-interview/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Implementing a Finite State Machine with a Ruby Domain Specific Language</title>
		<link>http://jrepp.com/2007/08/14/implementing-a-finite-state-machine-with-a-ruby-domain-specific-language/</link>
		<comments>http://jrepp.com/2007/08/14/implementing-a-finite-state-machine-with-a-ruby-domain-specific-language/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 09:12:21 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[austin]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/08/14/implementing-a-finite-state-machine-with-a-ruby-domain-specific-language/</guid>
		<description><![CDATA[DSL-FSM.. that kinda sounds like some wierd internet sub-culture. It stands for domain specific language &#8211; finite state machine. I proposed both topics as presentation material for the austin-ruby group that I meet with once a month. Steven Harms the &#8230; <a href="http://jrepp.com/2007/08/14/implementing-a-finite-state-machine-with-a-ruby-domain-specific-language/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>DSL-FSM.. that kinda sounds like some wierd internet sub-culture.  It stands for domain specific language &#8211; finite state machine. I proposed both topics as presentation material for the austin-ruby group that I meet with once a month. <a href="http://stevengharms.com">Steven Harms</a> the organizer recommended both/either so I combined it into one piece of code as it actually works pretty well that way.</p>

<p>The DSL that I&#8217;m using is pretty small right now, which lends itself to easier understanding and explanation.</p>

<p><a href="http://jrepp.com/code/rbfsm.tgz"> Ruby code tarball can be downloaded here. </a></p>

<p>A FSM is defined in a ruby script file without any class definition using the following rules:
<ol>
    <li>All attributes are specified in a method named &#8216;setup&#8217;. Setup takes an argument hash which may contain arguments that can be used to setup a FSM entity.</li>
    <li>All states are specified by defining top level methods with the name &#8216;while<em>&lt;statename&gt;&#8217;. These methods are called in a tick update while that state is active.</li>
    <li>All transitions are initiated by saying start :statename</li>
</ol>
For example the creature FSM is has a method:
<blockquote><strong>def while</em>idle</strong>
<blockquote><strong>target_nearest</strong></p>

<p><strong>start :chasing if @target</strong></blockquote>
<strong>end</strong></blockquote>
All FSM entity templates  can be loaded in the world using world.load(&#8216;template-name&#8217;). The world is currently driven by a simple script named &#8216;simulate.rb&#8217; which allows you to single step the world simulation and watch all the state machines make their choices. There are some debugging tools available. You can list all active entities and dump the world grid.</p>

<p>World#load uses the Object#instance_eval method to evaluate the contents of the FSM definition in terms of a FSM base instance. The FSM class defines some methods that can be called within the FSM definition to control state transitions and to access common methods.</p>

<p>Practically speak this is a very simple way to enable easy extension of a system. It provides an easier path to refactor the individual state machines and lowers the barrier to entry for writing state machine code. Additionally, it would be nice to include certain types of behavior from modules so that state machine authors could have easy access to some of the methods currently defined in creature FSM. This would include methods like target_nearest.Â  You could also mix in native C modules to get access to things like a path finding grid.</p>

<p>Ideas for playing with the code:
<ol>
    <li>Make creatures pick up the &#8216;ammo&#8217; entities</li>
    <li>Make creatures compete for the &#8216;fark&#8217; entities</li>
    <li>Add a new term to the FSM for state transitions. The method names should be named &#8216;when<em>changing</em>from<em>&lt;statename&gt;, when</em>changing<em>to</em>&lt;statename&gt;, when<em>changing</em>from<em>&lt;statename&gt;</em>to_&lt;statename&gt;&#8217; and should be executed when those state change patterns are matched.</li>
    <li>Allow entities to die</li>
</ol>
Some Notes:</p>

<p>A great article about some of the different types of DSL creation and the mindset from one of the coders at 37signals:</p>

<p><a href="http://weblog.jamisbuck.org/2006/4/20/writing-domain-specific-languages"> http://weblog.jamisbuck.org/2006/4/20/writing-domain-specific-languages</a></p>

<p>Careful of using missing_method, it bit me in the arse a number of times:</p>

<p><a href="http://redhanded.hobix.com/inspect/theBestOfMethod_missing.html"> http://redhanded.hobix.com/inspect/theBestOfMethod_missing.html</a></p>

<p>It&#8217;s really hard to track down bugs related to method<em>missing, any code you write inside an object implementing this needs to be carefully checked. It can also lead to blowing your stack when an error in method</em>missing recalls method_missing.. and on and on.</p>

<p>This little gem is nice to keep in your back pocket when trying to raise a descriptive exception:</p>

<p><a href="http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy"> http://blog.nicksieger.com/articles/2006/09/06/rubys-exception-hierarchy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/08/14/implementing-a-finite-state-machine-with-a-ruby-domain-specific-language/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>XNA Random Terrain Generation Sample Code</title>
		<link>http://jrepp.com/2007/07/19/xna-random-terrain-generation-sample-code/</link>
		<comments>http://jrepp.com/2007/07/19/xna-random-terrain-generation-sample-code/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 00:58:27 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[csharp]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[sample code]]></category>
		<category><![CDATA[shmup]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/07/19/xna-random-terrain-generation-sample-code/</guid>
		<description><![CDATA[I recently received a comment asking for details on the terrain generation algorithm I used in my XNA shoot &#8216;em up proof of concept. Here&#8217;s my edited reply and sample code for anyone interested. It&#8217;s not very complex and it &#8230; <a href="http://jrepp.com/2007/07/19/xna-random-terrain-generation-sample-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently received a comment asking for details on the terrain generation algorithm I used in my XNA shoot &#8216;em up proof of concept. Here&#8217;s my edited reply and sample code for anyone interested.</p>

<p><img src="http://photos1.blogger.com/photoInclude/blogger2/3211/2667/1600/xna_shmup.jpg"/></p>

<p>It&#8217;s not very complex and it doesn&#8217;t do any culling currently because I didn&#8217;t find that to be a problem given the ammount of terrain samples that I&#8217;m rendering. I generally spend most of my time on the game play first before tweaking the graphics engine.</p>

<p>Here is the code used for generating and rendering the terrain in the screenshots:</p>

<p><a href="http://jrepp.com/code/Terrain.cs" onclick="return top.js.OpenExtLink(window,event,this)" target="_blank">http://jrepp.com/code/Terrain<wbr></wbr>.cs</a></p>

<p>The method used is as follows:</p>

<p>Given a grid of height samples
<ol>
    <li>For some number N</li>
    <li>Choose a random X,Y sample in the grid</li>
    <li>Write a random value into the sample</li>
    <li>Blend that sample with all adjacent samples recursively</li>
</ol>
The blending adds some jitter so you get some variation in the blends but as a rule you can only blend between two samples by so much. I built some tolerances into the blending so that it will never generate height differences that are greater than the [horizontal] distance between two samples.</p>

<p>The verts are colored to get the basic effect of having land and sea.</p>

<p>Overall it&#8217;s a pretty simple algorithm that produces fairly decent looking results.</p>

<p>Please let me know if you have any questions, I&#8217;ll be happy to answer them.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/07/19/xna-random-terrain-generation-sample-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tabula Rasa Chosen in Top 5 RPG E3 Category by Kotaku</title>
		<link>http://jrepp.com/2007/07/19/tabula-rasa-chosen-in-top-5-rpg-e3-category-by-kotaku/</link>
		<comments>http://jrepp.com/2007/07/19/tabula-rasa-chosen-in-top-5-rpg-e3-category-by-kotaku/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 00:24:20 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[tabula rasa]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/07/19/tabula-rasa-chosen-in-top-5-rpg-e3-category-by-kotaku/</guid>
		<description><![CDATA[http://kotaku.com/gaming/e307/best-of-e3-our-picks-279860.php Now granted this isn&#8217;t Gamespy, IGN or 1up but that&#8217;s a good thing. I have been reading kotaku for a few years now and I respect their opinion on games. They haven&#8217;t had back stage access or been flown &#8230; <a href="http://jrepp.com/2007/07/19/tabula-rasa-chosen-in-top-5-rpg-e3-category-by-kotaku/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://kotaku.com/gaming/e307/best-of-e3-our-picks-279860.php">http://kotaku.com/gaming/e307/best-of-e3-our-picks-279860.php</a></p>

<p>Now granted this isn&#8217;t Gamespy, IGN or 1up but that&#8217;s a good thing. I have been reading kotaku for a few years now and I respect their opinion on games. They haven&#8217;t had back stage access or been flown out to Austin to check out the game so this is based solely on their E3 impression.</p>

<p>Brent if you&#8217;re reading this congrats on Mass Effect, I can&#8217;t wait to play it. Hope Canada is treating you well <img src='http://jrepp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/07/19/tabula-rasa-chosen-in-top-5-rpg-e3-category-by-kotaku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube 0.2.1 released to RubyForge</title>
		<link>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/</link>
		<comments>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/#comments</comments>
		<pubDate>Thu, 03 May 2007 07:18:59 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/</guid>
		<description><![CDATA[A new windows binary and source distribution is ready on ruby forge with inital support for sprites.Â  I also took this opportunity to fix a few small bugs and update the documentation. This also marks the first public upload of &#8230; <a href="http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A new windows binary and source distribution is ready on ruby forge with inital support for sprites.Â  I also took this opportunity to fix a few small bugs and update the documentation. This also marks the first public upload of the master sources to ruby forge trunk. Although the sources are included in every release up to this point I have kept the main trunk version private but it&#8217;s now available for public download.</p>

<p>The sources in the distribution and on trunk can be built for Mac OS X for anyone who would like to experiment on that platform. Window start up time on my dual G5 is a bit slow for my tastes and I haven&#8217;t gotten in to optimize it yet.</p>

<p>I would like to thank basaah for his great suggestions and feedback on the 0.1.1 release.</p>

<p>I feel the code structure is straining a bit now that I&#8217;m starting to add in new objects.Â  It&#8217;s not terribly hard to add new functionality but the code base is definitely much larger than it was when I first threw this together as a proof of concept.</p>

<p>I&#8217;m going to do a dot release to document sprites and flush out the functionality. I&#8217;d love to get more feedback from anyone using RubyCube as to what you would like to see to make it more useful.</p>

<p>Since documentation is not yet ready for sprites the best way to see the API is in the new test/testsprite.rb driver.
<ul>
    <li><a href="http://rubyforge.org/frs/?group_id=3415" title="RubyCube downloads">Download available here</a></li>
    <li><a href="http://jrepp.com/rubycube_docs">Updated docs available here</a></li>
</ul></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/05/03/rubycube-021-released-to-rubyforge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyCube 0.1.1 Released</title>
		<link>http://jrepp.com/2007/04/07/rubycube-011-released/</link>
		<comments>http://jrepp.com/2007/04/07/rubycube-011-released/#comments</comments>
		<pubDate>Sat, 07 Apr 2007 04:34:16 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/04/07/rubycube-011-released/</guid>
		<description><![CDATA[I just released the initial distribution of RubyCube locally. RubyCube 0.1.1 I&#8217;m in the process of getting a new ruby forge project setup to host the project files, mirror the source depot and manage bugs. I&#8217;m very happy with the &#8230; <a href="http://jrepp.com/2007/04/07/rubycube-011-released/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just released the initial distribution of RubyCube locally.</p>

<p><a href="http://jrepp.com/rubycube"> RubyCube 0.1.1</a></p>

<p>I&#8217;m in the process of getting a new <a href="http://rubyforge.org">ruby forge</a> project setup to host the project files, mirror the source depot and manage bugs.</p>

<p>I&#8217;m very happy with the overall quality of this initial release.</p>

<p>Incidentally, I also uploaded a copy of my <a href="http://rubyforge.org/frs/download.php/19369/rbaio-0.1.zip">async IO extension</a> to ruby forge.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/04/07/rubycube-011-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Profile Based Optimization and Test Driven Development</title>
		<link>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/</link>
		<comments>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/#comments</comments>
		<pubDate>Mon, 02 Apr 2007 04:45:27 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubycube]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/</guid>
		<description><![CDATA[Modern video games can be about as hard to tame as a large fire breathing dragon. It&#8217;s usually not until around when the marketing budget is finalized, traditionally around 6 months before release that people start talking about bringing the &#8230; <a href="http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Modern video games can be about as hard to tame as a large fire breathing dragon. It&#8217;s usually not until around when the marketing budget is finalized, traditionally around 6 months before release that people start talking about bringing the dragon out of the cave to meet the general public. It&#8217;s not wise to allow the general public to be maimed, charred and eaten by a fire breathing dragon.So the dev team picks a few brave souls to go into the cave and coax the dragon out. Presumably at this point the band of merry men look around blithely at one another and one of them decides to prove his worth by charging straight on in and <a href="http://www.youtube.com/watch?v=leEsz9ci5XE">biting the dragons knees off</a>. This however royally pisses off the dragon and only makes the matter worse.</p>

<p>It takes some serious hardware to fight dragons, don&#8217;t go into a dragon fight without taking at least some of the following:</p>

<p><a href="http://www.glowcode.com">GlowCode</a>, <a href="http://www.cs.utah.edu/dept/old/texinfo/as/gprof.html#SEC1">gprof</a>, <a href="http://freshmeat.net/projects/efence/">ElectricFence</a>, <a href="http://blogs.msdn.com/angryrichard/articles/Profiling_Windows_Services.aspx">LOP/F1 Profiler</a>, <a href="http://www.compuware.com/products/devpartner/bounds.htm">BoundsChecker</a>, <a href="http://valgrind.org/">ValGrind</a>, <a href="http://www.debuginfo.com/examples/dbghelpexamples.html">dbghelp.lib</a>, <a href="http://www.debuginfo.com/examples/dbghelpexamples.html"></a><a href="http://www.codeproject.com/tools/visualleakdetector.asp">VLD</a></p>

<p>I put <a href="http://www.glowcode.com">GlowCode</a> at the front of the list intentionally. I just downloaded it but this thing is the excalibur of dragon slaying tools.</p>

<p>GlowCode is a great developer tool, it might look a little crufty but all the little interface issues are thought through and the thing is just fast and does everything you want right how you want it. I quickly found a number of hot spots in the game and immediately went to take a nap (no sense fighting a dragon while tired right?)</p>

<p>Out of curiosity I profiled the RubyCube stress test and time<em>free() was using about 50% of the total time, this is the internal ruby hook that returns a Time object to the heap. Of the other time 70% was spent in g</em>shape_render() which is the function that renders a single shape. So again, this especially outlines the need to use <a href="http://jrepp.com/2007/03/26/rubycube-progress/">an alternative timing mechanism</a> in RubyCube. Exclusive time gives a good indication of what routines are doing the most actual work but often times looking at average or total Exclusive+Inclusive time can give you a good idea of where you might find some low hanging fruit.</p>

<p>All of the other tests are running well. One more documentation pass and I&#8217;ll be ready to do a windows release. I want to follow that closely with the mac release. To get things running on the mac should be as simple as:
<ol>
    <li>Replace Win32 threads with pthreads (nothing fancy, just conditional compilation)</li>
    <li>Ditto for the critical sections migrating to pthread mutexes.</li>
    <li>Some cross platform glue sniffing in extconf.rb will be needed as well.</li>
</ol>
I&#8217;ve been using these lists in my blog to keep me on track for what I need to do. I&#8217;ve been working about 60hrs a week on getting tabula rasa ready for closed beta and so my play coding time is extremely limited. I have been pretty disciplined though, my gamerscore has been stable since Crackdown ^^) When I sit down I usually go back and read my last blog post list and open up a test case.</p>

<p>Having the test cases has been instrumental in making any progress. I keep the build stable between work sessions and focus all my work around achieving results in a test case. A lot of bugs and usability issues have been fixed already using this method. I added a couple big handfuls of useful functionality as a result.</p>

<p>As an example two new global methods &#8216;pause&#8217; and &#8216;resume&#8217; were added to allow me to control the animation test more explicitly. This is actually a really simple feature that is fun to play with.</p>

<p>Also as a result of this type of work I converted to using array tuples for vector arguments. This has made the ruby code more readable and allows an easier transition from 2D to 3D.</p>

<p>Timers are another big example, without the stress test I never would have seen the timer GC thrashing and decided to implement a timer event.</p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/04/02/profile-based-optimization-and-test-driven-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple XNA BMFont loading/render code</title>
		<link>http://jrepp.com/2007/03/28/simple-xna-bmfont-loadingrender-code/</link>
		<comments>http://jrepp.com/2007/03/28/simple-xna-bmfont-loadingrender-code/#comments</comments>
		<pubDate>Wed, 28 Mar 2007 22:43:15 +0000</pubDate>
		<dc:creator>proj</dc:creator>
				<category><![CDATA[game programming]]></category>
		<category><![CDATA[indie dev]]></category>
		<category><![CDATA[xna]]></category>

		<guid isPermaLink="false">http://jrepp.com/2007/03/28/simple-xna-bmfont-loadingrender-code/</guid>
		<description><![CDATA[XNA doesn&#8217;t yet have good support for text render (still?) so since I just got a request for my font rendering code I put some short comments in the header. I think there are other examples of this but this &#8230; <a href="http://jrepp.com/2007/03/28/simple-xna-bmfont-loadingrender-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>XNA doesn&#8217;t yet have good support for text render (still?) so since I just got a request for my font rendering code I put some short comments in the header. I think there are other examples of this but this one is completely free and small. Let me know if you have any issues.</p>

<p><a href="http://jrepp.com/code/Font.cs">XNA BM Font rendering code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jrepp.com/2007/03/28/simple-xna-bmfont-loadingrender-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

