<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Developer Diary</title>
	<atom:link href="http://developerdiary.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://developerdiary.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 31 Jan 2011 11:47:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='developerdiary.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Developer Diary</title>
		<link>http://developerdiary.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://developerdiary.wordpress.com/osd.xml" title="Developer Diary" />
	<atom:link rel='hub' href='http://developerdiary.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Setup Utility</title>
		<link>http://developerdiary.wordpress.com/2011/01/31/setup-utility/</link>
		<comments>http://developerdiary.wordpress.com/2011/01/31/setup-utility/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 01:34:25 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times]]></category>
		<category><![CDATA[Inno Setup]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=40</guid>
		<description><![CDATA[Before I forget, I wanted to mention Inno Setup. Back in 2009, I wrote this post describing how I was using Wink as a sort of cut rate installer alternative. As I mentioned then, it was ugly, and a clearly inferior alternative to an actual installation utility. Since then, I found Inno Setup. Inno Setup [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=40&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Before I forget, I wanted to mention <a href="http://www.jrsoftware.org/isinfo.php">Inno Setup</a>.  Back in 2009, I wrote <a href="http://developerdiary.wordpress.com/2009/05/31/manual-installer/">this post</a> describing how I was using <a href="http://www.debugmode.com/wink/">Wink</a> as a sort of cut rate installer alternative.  As I mentioned then, it was ugly, and a clearly inferior alternative to an actual installation utility.  Since then, I found <a href="http://www.jrsoftware.org/isinfo.php">Inno Setup</a>.  <a href="http://www.jrsoftware.org/isinfo.php">Inno Setup</a> is great.  It&#8217;s actually easier to use it to create a real installer than it was to use my Wink-based workaround.  All that&#8217;s necessary is to adapt the following script, which I used to create the installer for <a href="www.byhandgames.com/Forgotten_Times">Forgotten Times</a>:</p>
<p>[Setup]<br />
; NOTE: The value of AppId uniquely identifies this application.<br />
; Do not use the same AppId value in installers for other applications.<br />
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)<br />
AppId={{8B6CE104-25D3-40E8-8681-F2B7DA29E855}<br />
AppName=Forgotten Times<br />
AppVersion=1.1<br />
;AppVerName=Forgotten Times 1.1<br />
AppPublisher=Morriss, William S.<br />
AppPublisherURL=http://www.example.com/<br />
AppSupportURL=http://www.example.com/<br />
AppUpdatesURL=http://www.example.com/<br />
DefaultDirName={pf}\Forgotten Times<br />
DefaultGroupName=Forgotten Times<br />
AllowNoIcons=yes<br />
OutputBaseFilename=setup<br />
SetupIconFile=C:\FT2\Forgotten Times\res\GameEngine.ico<br />
Compression=lzma<br />
SolidCompression=yes</p>
<p>[Languages]<br />
Name: &#8220;english&#8221;; MessagesFile: &#8220;compiler:Default.isl&#8221;</p>
<p>[Tasks]<br />
Name: &#8220;desktopicon&#8221;; Description: &#8220;{cm:CreateDesktopIcon}&#8221;; GroupDescription: &#8220;{cm:AdditionalIcons}&#8221;; Flags: unchecked<br />
Name: &#8220;quicklaunchicon&#8221;; Description: &#8220;{cm:CreateQuickLaunchIcon}&#8221;; GroupDescription: &#8220;{cm:AdditionalIcons}&#8221;; Flags: unchecked; OnlyBelowVersion: 0,6.1</p>
<p>; Set the source to your root directory<br />
[Files]<br />
Source: &#8220;C:\FT\Forgotten Times\GameEngine.exe&#8221;; DestDir: &#8220;{app}&#8221;; Flags: ignoreversion<br />
Source: &#8220;C:\FT\Forgotten Times\*&#8221;; DestDir: &#8220;{app}&#8221;; Flags: ignoreversion recursesubdirs createallsubdirs<br />
; NOTE: Don&#8217;t use &#8220;Flags: ignoreversion&#8221; on any shared system files</p>
<p>; For these icons, to get them to work with your GameEngine.exe you must set &#8216;WorkingDir:&#8217; to &#8216;{app}&#8217; because it creates<br />
; local files<br />
[Icons]<br />
Name: &#8220;{group}\Forgotten Times&#8221;; Filename: &#8220;{app}\GameEngine.exe&#8221;; WorkingDir: {app}<br />
Name: &#8220;{group}\{cm:UninstallProgram,Forgotten Times}&#8221;; Filename: &#8220;{uninstallexe}&#8221;; WorkingDir: {app}<br />
Name: &#8220;{commondesktop}\Forgotten Times&#8221;; Filename: &#8220;{app}\GameEngine.exe&#8221;; Tasks: desktopicon; WorkingDir: {app}<br />
Name: &#8220;{userappdata}\Microsoft\Internet Explorer\Quick Launch\Forgotten Times&#8221;; Filename: &#8220;{app}\GameEngine.exe&#8221;; Tasks: quicklaunchicon; WorkingDir: {app}</p>
<p>[Run]<br />
Filename: &#8220;{app}\GameEngine.exe&#8221;; Description: &#8220;{cm:LaunchProgram,Forgotten Times}&#8221;; Flags: nowait postinstall skipifsilent</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=40&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2011/01/31/setup-utility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Eee Issues</title>
		<link>http://developerdiary.wordpress.com/2011/01/31/eee-issues/</link>
		<comments>http://developerdiary.wordpress.com/2011/01/31/eee-issues/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 01:23:15 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times II]]></category>
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=37</guid>
		<description><![CDATA[At one point, I really loved my Eee. I had come to the conclusion that I needed good battery life more than I needed lots of processing power, and so the tradeoff in a netbook made a lot of sense. Unfortunately, my Eee, like the other portable computers I&#8217;ve had, didn&#8217;t prove equal to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=37&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>At one point, I really loved my Eee.  I had come to the conclusion that I needed good battery life more than I needed lots of processing power, and so the tradeoff in a netbook made a lot of sense.   Unfortunately, my Eee, like the other portable computers I&#8217;ve had, didn&#8217;t prove equal to the rigors of actually being transported &#8211; after spending a year or two being transported in my backback, the screws holding its case together decided to come out.  Even worse, after I replaced them, something went wrong with the connection between the battery and the processor.  The Eee now works great when it&#8217;s plugged in, but turns off the moment you unplug it.  The plus side is that this means the data I used to store on it isn&#8217;t lost.  the minus side is that the specific reason I bought it, good battery life, is now gone.  Obviously, this wasn&#8217;t good for my programming, since the main time I used to write code was on my bus ride to and from work.</p>
<p>However, all things come to an end, and my current hiatus is no exception.  I got a shiny new laptop, and used to it pull together a good deal of the town of Ramu in <a href="www.byhandgames.com/FT_II">Forgotten Times 2</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=37&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2011/01/31/eee-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Fixing Forgotten Times</title>
		<link>http://developerdiary.wordpress.com/2010/09/28/fixing-forgotten-times/</link>
		<comments>http://developerdiary.wordpress.com/2010/09/28/fixing-forgotten-times/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 02:42:22 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times]]></category>
		<category><![CDATA[Indie Game Challenge]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=34</guid>
		<description><![CDATA[Maybe a month and a half ago, I decided to enter Forgotten Times in the Indie Game Challenge. I figured it would be a piece of cake. From what I had recalled, I finished the game seven or eight years ago back in law school. My thought was that I&#8217;d throw together an manual and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=34&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Maybe a month and a half ago, I decided to enter <a href="http://www.byhandgames.com/Forgotten_Times/index.html">Forgotten Times</a> in the <a href="http://www.indiegamechallenge.com/home/">Indie Game Challenge</a>.  I figured it would be a piece of cake.  From what I had recalled, I finished the game seven or eight years ago back in law school.  My thought was that I&#8217;d throw together an manual and an elevator speech (both required for the contest), put it all in an installer, and be done.</p>
<p>Obviously, that isn&#8217;t what happened.</p>
<p>Apparently, I didn&#8217;t actually finish it back in law school.  I got it mostly finished back in law school.  I&#8217;d say it was 98% finished.  However, trying to squeeze out that last 2% reminded me of just how much work goes into these things.  </p>
<p>Happily though, thanks in large part to my very patient wife who played through it 5-10 times as she found bugs and I fixed them, we worked out all the obvious kinks, made a couple of significant upgrades to the interface, and got it all done.  Now, I just have to pull the rest of the submission package together and everything will be ready to ship well before the October 1 deadline. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=34&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2010/09/28/fixing-forgotten-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Legal Stuff</title>
		<link>http://developerdiary.wordpress.com/2010/01/25/legal-stuff/</link>
		<comments>http://developerdiary.wordpress.com/2010/01/25/legal-stuff/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 00:06:01 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Licensing]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=32</guid>
		<description><![CDATA[Today I uploaded new versions of everything. For Forgotten Times II, this represents real progress on the game. I&#8217;ve finished the agricultural town, and gotten a good start on the mining town. For the other games though, the only change was the addition of an explicit authorization of individual non-commercial use and distribution of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=32&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I uploaded new versions of everything.  For Forgotten Times II, this represents real progress on the game.  I&#8217;ve finished the agricultural town, and gotten a good start on the mining town.  For the other games though, the only change was the addition of an explicit authorization of individual non-commercial use and distribution of the games, and it was something of a pain.  It wasn&#8217;t particularly difficult (writing licenses is part of my real job, after all), but at the same time it did take my energy away from writing more code, and so had an opportunity cost in terms of programming.  Essentially, this is the same cost (writ small) that one of my clients faces when they hire an attorney to draft a license or a EULA for one of their commercial programs.  The money that goes to paying me could alternatively be going to pay their programmers, and represents a cost of doing business which they would almost certainly rather do without.  </p>
<p>So, was the time I spent (and, in general, the resources spent on lawyers who write software licenses) worth it?  I think so.  While I don&#8217;t care if people give away copies of my games, I would be more than a little annoyed if someone made a changed version and distributed it, or started selling them without my permission.  By making explicit what rights I&#8217;m granting and withholding, I lay the groundwork for giving effect to my goals down the road.  The same principle applies to commercial products as well.  By making clear what actions are and aren&#8217;t authorized at the outset, a company can set itself up so that if it ever has to enforce its rights, it can do so at a relatively minimal cost.  Even better, if  rights and restrictions are clear, there&#8217;s less chance of a conflict that could lead to expensive litigation ever taking place.   </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=32&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2010/01/25/legal-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Don&#8217;t write functions to return local arrays</title>
		<link>http://developerdiary.wordpress.com/2009/12/23/dont-write-functions-to-return-local-arrays/</link>
		<comments>http://developerdiary.wordpress.com/2009/12/23/dont-write-functions-to-return-local-arrays/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 00:14:45 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times II]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Static Variables]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=28</guid>
		<description><![CDATA[Consider the following function (taken from Forgotten Times II): char* CClassicRPGDoc::levelLocationID(int which_level) { char center_location_ID[LABELLENGTH]; int center_location_index = current_location; char retval[LABELLENGTH]; strcpy(center_location_ID, location_IDs[current_location]); int counter; if(which_level &#62; 0) { for(counter = 1; counter &#60;= which_level; counter++) { strcpy(center_location_ID, locations[center_location_index].getTop().getLocationID()); center_location_index = getLocationIndex(center_location_ID); } } if(which_level = which_level; counter&#8211;) { strcpy(center_location_ID, locations[center_location_index].getBase().getLocationID()); center_location_index = getLocationIndex(center_location_ID); } [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=28&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider the following function (taken from Forgotten Times II):</p>
<p><em>char* CClassicRPGDoc::levelLocationID(int which_level)<br />
{</p>
<p>	char center_location_ID[LABELLENGTH];<br />
	int center_location_index = current_location;</p>
<p><strong>	char retval[LABELLENGTH];</strong></p>
<p>	strcpy(center_location_ID, location_IDs[current_location]);</p>
<p>	int counter;<br />
	if(which_level &gt; 0)<br />
	{<br />
		for(counter = 1; counter &lt;= which_level; counter++)<br />
		{<br />
			strcpy(center_location_ID, locations[center_location_index].getTop().getLocationID());<br />
			center_location_index = getLocationIndex(center_location_ID);<br />
		}<br />
	}<br />
	if(which_level = which_level; counter&#8211;)<br />
		{<br />
			strcpy(center_location_ID, locations[center_location_index].getBase().getLocationID());<br />
			center_location_index = getLocationIndex(center_location_ID);<br />
		}<br />
	}<br />
	if(which_level != 0)<br />
	{<br />
		ASSERT(true);<br />
	}<br />
	strcpy(retval, center_location_ID);<br />
	return retval;<br />
};</em></p>
<p>The above function is used in the display of multi-level buildings and was causing me no end of grief.  For some reason, instead of returning what I expected (i.e., the ID of the specified floor of a building) it was consistently returning the ID of the floor (i.e., the one the character was in).  Even worse, its behavior changed when I ran it through the debugger, and when I traced the values of the variables all the way to the end of the function, they looked the way they were supposed to.  </p>
<p>The problem, of course, was the statement in bold text.  While the retval[] string had the right value all the way to the end of the function, once the function exited, the memory that string had occupied was deallocated.  As a result, rather than passing back the string I intended, I was passing back a memory location which, by that time, was being used for something else (apparently for storing the ID of the current floor, though I have no idea why).  Very annoying.  </p>
<p>While there are a number of ways to solve the problem (including reworking the logic so that the problem didn&#8217;t come up in the first place), I chose the one that was easiest for me, and made retval[] a static variable.  Not the most artful way of doing it, but, since static variables are maintained between function calls, it did the job.  The final results are that the last upload of Forgotten Times II has a reasonably functional implementation of multi-story building display, and that I&#8217;ve learned to avoid writing functions to return local arrays.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=28&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/12/23/dont-write-functions-to-return-local-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>More progress</title>
		<link>http://developerdiary.wordpress.com/2009/10/28/more-progress/</link>
		<comments>http://developerdiary.wordpress.com/2009/10/28/more-progress/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 01:37:13 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times II]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=24</guid>
		<description><![CDATA[I finally got the basic layout (i.e., made and placed the buildings and stitched together borders) for the agricultural town in Forgotten Times 2. Wow. That represents an incredible amount of work, and is basically what I&#8217;ve been focusing on since my last post back in August. It&#8217;s strange, but people generally seem to overlook [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=24&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I finally got the basic layout (i.e., made and placed the buildings and stitched together borders) for the agricultural town in Forgotten Times 2.  Wow.  That represents an incredible amount of work, and is basically what I&#8217;ve been focusing on since my last post back in August.  </p>
<p>It&#8217;s strange, but people generally seem to overlook the kind of effort I&#8217;ve been putting in over the last few months when they think of programming.  When I was in law school telling a girl I knew about my efforts to put together a coherent plot for Forgotten Times 1, she remarked that she&#8217;d never thought about programming being about plot, rather than about essentially mathematical problem solving.  The same sort of thing happened when I told a friend of mine here in Cincinnati about my programs &#8211; to get some sense of them, he asked to measure the number of source lines of code I had written in the engines, and completely ignored the data files.  </p>
<p>I suppose it&#8217;s not that different from thinking of authors on the Internet as &#8220;content providers.&#8221;  However, I still think it&#8217;s a mistake.  Since I started writing games, judging the program by focusing on the basic mechanics has begun to seem something like judging a fine wine by looking at the bottle.  True, the bottle can tell you something (e.g., where the wine came from, year, etc) but it&#8217;s what someone put into it that really makes it special.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=24&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/10/28/more-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Man&#8230;it&#8217;s been a while</title>
		<link>http://developerdiary.wordpress.com/2009/08/01/man-its-been-a-while/</link>
		<comments>http://developerdiary.wordpress.com/2009/08/01/man-its-been-a-while/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 03:28:15 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times II]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=22</guid>
		<description><![CDATA[I can&#8217;t believe the last post was two months ago. Actually, I can believe it, because I know why it took me so long. It took me so long because I was working on getting the pathfinding back together in Forgotten Times 2. I say back together, because when I originally wrote the AI, the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=22&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t believe the last post was two months ago.  Actually, I can believe it, because I know why it took me so long.  It took me so long because I was working on getting the pathfinding back together in Forgotten Times 2.  I say back together, because when I originally wrote the AI, the characters had the power to move between any arbitrary points in an area.  However, since then (circa 2003-04) I basically ripped out everyone&#8217;s brains and left them standing stationary and waiting for the player to interact with them.  Now, since May, I&#8217;ve been putting the pathfinding back in to support some new plot segments, and it&#8217;s been more than a little difficult.  The problem is that I not only ripped out everyone&#8217;s brains, I also changed how the software gives commands to the different characters.  Circa 2003-04, I figured out how to get from point A to point B as part of the main document class.  Since then, I&#8217;ve moved the brain power into the characters themselves, leaving the document class to basically store data.  While that makes sense from a compartmentalization standpoint, it didn&#8217;t work at all from the standpoint of making the AI work, since the data I needed for pathfinding was stored in the form of private members of the document class.  </p>
<p>Unsurprisingly, that caused no end of heartache which in the end was resolved with a tremendously ugly (but functional) solution &#8211; I duplicated the data I needed as global data.  At some point, I&#8217;ll rationalize things so that I don&#8217;t have duplicate data stored as globals and as private members of the document class.  At this point though, I&#8217;m just happy that I got things working.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=22&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/08/01/man-its-been-a-while/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Manual Installer</title>
		<link>http://developerdiary.wordpress.com/2009/05/31/manual-installer/</link>
		<comments>http://developerdiary.wordpress.com/2009/05/31/manual-installer/#comments</comments>
		<pubDate>Sun, 31 May 2009 03:20:21 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Forgotten Times]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Wink]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=20</guid>
		<description><![CDATA[I discovered something recently. What I discovered is that my original method of distributing the Forgotten Times series doesn&#8217;t work. Originally, I had thrown the Forgotten Times executables, and the data files that actually power the games into a folder creatively called &#8220;Files&#8221;, made a shortcut to the executable in the main distribution folder, then [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=20&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I discovered something recently.  What I discovered is that my original method of distributing the Forgotten Times series doesn&#8217;t work.  Originally, I had thrown the Forgotten Times executables, and the data files that actually power the games into a folder creatively called &#8220;Files&#8221;, made a shortcut to the executable in the main distribution folder, then zipped everything up and put it on the web site.  </p>
<p>The problem with the above approach is that windows shortcuts use absolute locations, and every location is different depending on the name of the user account it&#8217;s running under.  As an example, if my user name is &#8220;Sid&#8221; (which, on this computer, it is), then the path name for any file located on my desktop will start with &#8220;C:\Documents and Settings\Sid\Desktop\&#8221;.  Because of this, whenever the zipped distribution folder was downloaded onto a new machine, the shortcut would try and look for the data files the executable needs to run in the location they were stored on the original machine (e.g., &#8220;C:\Documents and Settings\Sid\Desktop\FT\Files&#8221;) rather than their location after the download (e.g., C:\Documents and Settings\Your Name\Desktop\FT\Files&#8221;).  The result, predictably, was that the executable would enter an infinite loop, forlornly looking for the data files in a location that simply didn&#8217;t exist in its new host environment.  Very sad.</p>
<p>Anyway, I ended up deciding to solve this problem by making a wink program demonstrating for a user how to find the executables, and make a new shortcut on their own machines.  It isn&#8217;t the most elegant solution, but it should get over the fact that I have no real way of knowing what the relevant user names will be on the machines where my programs are downloaded.  Someday, I may end up writing a full install script.  However, for now, wink it shall be. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=20&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/05/31/manual-installer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>A Stitch in Time&#8230;</title>
		<link>http://developerdiary.wordpress.com/2009/05/17/a-stitch-in-time/</link>
		<comments>http://developerdiary.wordpress.com/2009/05/17/a-stitch-in-time/#comments</comments>
		<pubDate>Sun, 17 May 2009 21:48:19 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Stick Game]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=18</guid>
		<description><![CDATA[Well, I finally completed (re)work on the Stick Game, and got it into a form where it can be distributed. The delay: memory leaks. Yeah, that post where I said the game didn&#8217;t have any was tragically, horribly, wrong. It turned out, that it just didn&#8217;t have any in the main control loop. It had [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=18&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, I finally completed (re)work on the Stick Game, and got it into a form where it can be distributed.  The delay: memory leaks.  Yeah, <a href="http://developerdiary.wordpress.com/2009/03/28/trip-down-memory-lane/">that post where I said the game didn&#8217;t have any</a> was tragically, horribly, wrong.  It turned out, that it just didn&#8217;t have any in the main control loop.  It had all sorts of them hiding away elsewhere, and catching and killing them was a huge pain.  The bottom line: unless you&#8217;re certain that you&#8217;ll never use a piece of code ever again, write it well the first time (or, at least, make sure you properly deallocate your memory).  That way, you won&#8217;t be stuck with a weeks long project many years hence putting it into a shape where it can be distributed without blackening your name.</p>
<p>Anyway, at this point the first pass at content for the site is up.  Next, I want to do some work on the interface, then test everything out, and it&#8217;ll be ready to go live.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=18&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/05/17/a-stitch-in-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
		<item>
		<title>Too much power</title>
		<link>http://developerdiary.wordpress.com/2009/04/25/too-much-power/</link>
		<comments>http://developerdiary.wordpress.com/2009/04/25/too-much-power/#comments</comments>
		<pubDate>Sat, 25 Apr 2009 03:24:00 +0000</pubDate>
		<dc:creator>wmorriss</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Stick Game]]></category>

		<guid isPermaLink="false">http://developerdiary.wordpress.com/?p=16</guid>
		<description><![CDATA[So, I&#8217;m still prepping the stick game for uploading to the web site. When I wrote it originally, I thought it would be cool to allow arbitrarily large numbers of rows &#8211; probably something about showing off the robustness of the data structures. The problem is, when I wrote it, I gave short shrift to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=16&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;m still prepping the stick game for uploading to the web site.  When I wrote it originally, I thought it would be cool to allow arbitrarily large numbers of rows &#8211; probably something about showing off the robustness of the data structures.  The problem is, when I wrote it, I gave short shrift to performance optimization.  The AI enumerates all possible moves and possible games, then plays a move which leads to it winning (or taking the longest possible time to lose).  That&#8217;s fine for when you have a small number of sticks, but when you have a larger number of sticks, the process of enumeration consumes all available RAM, and causes the program to become non-responsive.  As a result, the fact that the AI will only play once it&#8217;s found the correct move means that it (effectively) never plays once it has to deal with a large number of sticks.</p>
<p>Now, if I&#8217;d been thinking about performance optimization when I originally wrote the game, I would have done something marginally clever, like have a calculation thread constantly running the background, enumerating away, rather than waiting till it&#8217;s the computer&#8217;s turn to start thinking.  I could also have done something like add a timer on the computer&#8217;s thinking, and forced it to make a move after it had been enumerating for some set period (e.g., 30 seconds).  That second one would actually go hand-in-hand with a third optimization that I didn&#8217;t implement: I could have written the code to save intermediate results, rather than only saving the results once the enumeration&#8217;s finished (the current approach).  </p>
<p>So there are all sorts of optimizations I could implement to help clean up the mess from when I originally wrote it.  Alternatively, I could just remove the user&#8217;s ability to start the game with an arbitrarily large number of sticks (thereby making sure the game is only played with the smaller numbers where the lack of optimization isn&#8217;t a problem).  As it happens, in my relatively old age, I have found that there&#8217;s another optimization that is more important than the ones I described above: minimizing my own time expenditure.  Given that, what will actually happen is that I&#8217;m going to remove the functionality that&#8217;s causing the problems, and leave the task of optimizing for another day.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/developerdiary.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/developerdiary.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/developerdiary.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=developerdiary.wordpress.com&amp;blog=7061004&amp;post=16&amp;subd=developerdiary&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://developerdiary.wordpress.com/2009/04/25/too-much-power/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/97545c1d2106b359a2ac71ece30724cb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wmorriss</media:title>
		</media:content>
	</item>
	</channel>
</rss>
