<?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>Kevin Grad &#187; Wezzle</title>
	<atom:link href="http://couchware.ca/www/kev/tag/wezzle/feed/" rel="self" type="application/rss+xml" />
	<link>http://couchware.ca/www/kev</link>
	<description>Designer, Programmer and Co-Founder</description>
	<lastBuildDate>Fri, 30 Apr 2010 20:33:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update: Wezzle, JavaEE 6 and beyond</title>
		<link>http://couchware.ca/www/kev/2010/03/01/update-wezzle-javaee6-and-beyond/</link>
		<comments>http://couchware.ca/www/kev/2010/03/01/update-wezzle-javaee6-and-beyond/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 21:13:59 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Stuff]]></category>
		<category><![CDATA[ejb]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[Wezzle]]></category>

		<guid isPermaLink="false">http://couchware.ca/www/kev/?p=171</guid>
		<description><![CDATA[Greetings Earthlings. 
It has come to my attention that I have not updated this blog in quite a while. This is an error that I wish to remedy immediately. Since my last post a lot of fun and exciting things have happened and I have learned a ton of new stuff that I will hopefully [...]]]></description>
			<content:encoded><![CDATA[<p>Greetings Earthlings. </p>
<p>It has come to my attention that I have not updated this blog in quite a while. This is an error that I wish to remedy immediately. Since my last post a lot of fun and exciting things have happened and I have learned a ton of new stuff that I will hopefully write about in the near future.<br />
<span id="more-171"></span><br />
I would like to announce that <a href="http://couchware.ca/www/wezzle/">Wezzle </a>has been completed and is for sale on our website! It only took two years since Couchware&#8217;s inception, but it&#8217;s finally here and it looks great. I couldn&#8217;t be happier with the way Wezzle turned out. I think it looks outstanding and has some enjoyable and addicting game play. </p>
<p>I would like to give a huge thanks to those who assisted in the creation of the Wezzle. This includes Renee and Sam and all of our testers. If you like the art and music in the game be sure to check out <a href="http://www.reneelung.ca">Renee&#8217;s </a>and <a href="http://www.soundclick.com/bands/default.cfm?bandID=146918">Sam&#8217;s</a> websites. </p>
<p>Despite having put the game up for sale, Wezzle is not yet 100% complete. We are still hard at work finishing up a Wezzle demo that will be playable within the browser. Once the demo has been completed, we will be marketing/launching the game to a larger audience (hopefully!). There will likely be a launch party at an as of yet undisclosed location in Toronto. For those interested in coming, fire me an email or check back at this blog occasionally. Cam has also been hard at work at a REALLY cool Wezzle port, the nature of which I can&#8217;t disclose at the moment. It will be hopefully laying the ground-work for some of our future projects.</p>
<p>In other news, I have been put in charge of a major project using Java EE 6 which I&#8217;m pretty excited about.  Some of the technologies I have been using lately include: <a href="http://maven.apache.org/">Maven2</a>, <a href="http://logback.qos.ch/">Logback</a>, <a href="http://java.sun.com/developer/technicalArticles/J2EE/jpa/">JPA</a>/<a href="http://www.hibernate.org">Hibernate</a>, <a href="https://javaserverfaces.dev.java.net/">JSF</a>, <a href="http://java.sun.com/products/ejb/index.jsp">EJB 3.1</a>, and more. Hopefully in the coming weeks I will have something interesting to say about some of these. </p>
<p>Finally, I have bought kevingrad.com, org and net (all currently have no content) and I will eventually be moving this blog to one of those (probably .org).</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2010/03/01/update-wezzle-javaee6-and-beyond/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comment from today&#8217;s code.</title>
		<link>http://couchware.ca/www/kev/2009/09/24/comment-from-todays-code/</link>
		<comments>http://couchware.ca/www/kev/2009/09/24/comment-from-todays-code/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 01:39:53 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wezzle]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[lwjgl]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=165</guid>
		<description><![CDATA[

// WARNING: the ctrl mask randomly subtracts 96 from the ascii
// of any character returned from getEventCharacter(). This is because
// LWJGL is fucked. We had a 30 min convo about this and decided
// to fuck the ctrl key. Alt is better.

]]></description>
			<content:encoded><![CDATA[<pre>

// WARNING: the ctrl mask randomly subtracts 96 from the ascii
// of any character returned from getEventCharacter(). This is because
// LWJGL is fucked. We had a 30 min convo about this and decided
// to fuck the ctrl key. Alt is better.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/09/24/comment-from-todays-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wezzle Test 7 is out!</title>
		<link>http://couchware.ca/www/kev/2009/06/17/wezzle-test-7-is-out/</link>
		<comments>http://couchware.ca/www/kev/2009/06/17/wezzle-test-7-is-out/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 16:32:17 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Wezzle]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=163</guid>
		<description><![CDATA[Well, It has been a little while since we have posted anything new about Wezzle. Both Cam and myself have been pretty busy with other endeavors and progress on Wezzle slowed quite a bit. But now we are back to working on it and even though I got hit with a bout of the swine [...]]]></description>
			<content:encoded><![CDATA[<p>Well, It has been a little while since we have posted anything new about Wezzle. Both Cam and myself have been pretty busy with other endeavors and progress on Wezzle slowed quite a bit. But now we are back to working on it and even though I got hit with a bout of the swine flu, we managed to release Wezzle test 7!</p>
<p><span id="more-163"></span></p>
<p>Test 7 add a ton on top of test 6. This is copied from our official post in our forums:</p>
<ul>
<li>  An updated Play Now menu that has a look consistent across all menues.</li>
<li> Added achievements.</li>
<li> An achievements browser, that allows you to scroll through all achievements in the game and to see which ones you have done, and when.</li>
<li> An in-game achievement notification. In fact, we’ve added a general notification system that will give you tips and other information as the game progresses (these can be turned off, of course).</i>
<li> Improved line sounds. As you get more and more line chains, the line sound increases by a semi-tone. It’s quite exciting.</li>
<li> An improved tile dropping algorithm. You now get fewer random drop-in lines, so that the game no longer feels like it plays itself.</li>
<li> An improved, peripheral timer. When you get up to level 10 like the big boys, you need to have a better idea of how much time you have. Our new timer does just that.</li>
<li> An Options Menu.</li>
<li> The ability to turn off tutorials (once you&#8217;ve played them once of course!)</li>
<li> An new, more intuitive music selector.</li>
<li> A piece previewer (up in the top corner) as well as an overlayed piece previewer (check the Options Menu from the Main Menu).</li>
<li> You may now pre-rotate pieces in the queue by right-clicking during a tile drop-in.</li>
<li> A Windows installer that&#8217;ll automatically install Java if needed. Works on 32-bit and 64-bit Windows (including Vista).</li>
<li> Added new rotation tutorial to Level 2.</li>
</ul>
<p>If you would like to play Wezzle test 7 (or any of the tests) and you are not currently on the email list, just send me an email and we can get that fixed right away.	</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/06/17/wezzle-test-7-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Willing to sell out</title>
		<link>http://couchware.ca/www/kev/2009/04/07/willing-to-sell-out/</link>
		<comments>http://couchware.ca/www/kev/2009/04/07/willing-to-sell-out/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 17:16:21 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Wezzle]]></category>
		<category><![CDATA[adium]]></category>
		<category><![CDATA[digsby]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[instant messaging]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=149</guid>
		<description><![CDATA[Cam and I were talking about our mutual love for the IM tool Digsby which we both use to track e-mails, social networks and Instant messaging. If you like the popular Mac tool Adium, you will love Digsby. Even if you have never heard of Adium, Digsby is worth checking out.

Anyway, we were talking about [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://couchware.ca/blogs/cam">Cam </a>and I were talking about our mutual love for the IM tool <a href="http://www.digsby.com/">Digsby</a> which we both use to track e-mails, social networks and Instant messaging. If you like the popular Mac tool <a href="http://www.adiumx.com/">Adium</a>, you will love Digsby. Even if you have never heard of Adium, Digsby is worth checking out.</p>
<p><span id="more-149"></span></p>
<p>Anyway, we were talking about Digsby, and I mentioned that one of the things I dislike is that if you use Digsby for <a href="http://www.twitter.com">Twitter</a>, they automatically make you follow the Digsby Twitter feed. This is something that is very irritating, I don&#8217;t want to have to follow them or figure out how to un-follow them. This should be an option or something. </p>
<p>Additionally, Cam mentioned (and i agree) that he doesn&#8217;t like how they try to get you to install around 10 different applications when you install Digsby. This is something that I find in a lot of programs. I often get asked if I want to install <a href="http://www.yahoo.com">Yahoo!</a> toolbar or some such program and this irritates me to no end. I wish they would stop doing that stuff.</p>
<p>However, Cam asked me the following: If Yahoo! approached us and said if you package Yahoo! toolbar with your application, we will pay you $100,000, what would you say? The answer, obviously, was a resounding yes. So there you have it. We are willing to sell out, and I don&#8217;t even know what the price point for our selling out would be. So Yahoo! or <a href="http://www.google.ca">Google </a>or anyone else out there. If you want to pay us money to package your application, we are willing to do so.</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/04/07/willing-to-sell-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wezzle Collision Generator</title>
		<link>http://couchware.ca/www/kev/2009/03/13/wezzle-collision-generator/</link>
		<comments>http://couchware.ca/www/kev/2009/03/13/wezzle-collision-generator/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 04:10:25 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wezzle]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=124</guid>
		<description><![CDATA[I have a fascination with programming languages. I have been reading up on many different ones trying to get a feel for them all. I enjoy learning about the different syntaxes and what the advantages are of the different paradigms. I find most of the languages offer really interesting concepts and benefits.

Last night I was [...]]]></description>
			<content:encoded><![CDATA[<p>I have a fascination with programming languages. I have been reading up on many different ones trying to get a feel for them all. I enjoy learning about the different syntaxes and what the advantages are of the different paradigms. I find most of the languages offer really interesting concepts and benefits.<br />
<span id="more-124"></span></p>
<p>Last night I was hacking around with <a href="http://www.ruby-lang.org/en/">Ruby</a> and decided that to teach myself how to program better I would do something interesting for Wezzle. I had the idea of taking the <a href="http://couchware.ca/blogs/kev/2009/01/27/wezzle-xml/">XML markup for our achievements</a> and making some sort of generator using our achievement pseudo-language.</p>
<p>Our achievement language basically amounts to what is known in computing as a <a href="http://en.wikipedia.org/wiki/Domain-specific_language">Domain Specific Language (DSL).</a> Luckily for me Ruby is a pretty good language for writing DSL&#8217;s. </p>
<p>I decided to start with the achievements that I find to be the hardest to write, COLLISION. A COLLISION occurs between 1 or many items. There are two seperate types of collisions which can be defined as either an AND or an INTO relationship. These can be seen in the following two examples:</p>
<p>Example 1:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;A Tale of Two Rockets&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;SILVER&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fire a rocket into another rocket.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;COLLISION&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;BETWEEN&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Example 2:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;A Tale of Two Rockets&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;SILVER&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fire a rocket into another rocket.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;COLLISION&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;BETWEEN&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/item<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>While these two examples may look the same, they mean two different things. The first one can be written as COLLISION BETWEEN ROCKET AND ROCKET simply means that two rockets will be activated in a single turn. The second one however would be written like COLLISION BETWEEN ROCKET INTO ROCKET and means a rocket will be fired and activate another rocket by hitting it.</p>
<p>I have written a generator in ruby that takes an achievement (currently only collisions) in the following form:</p>
<p>BEGIN COLLISION<br />
achievement:Rocketeer:BRONZE<br />
description:Fire a rocket into a rocket and fire a rocket and a rocket.<br />
rule:COLLISION BETWEEN ROCKET INTO ROCKET<br />
rule:COLLISION BETWEEN ROCKET AND ROCKET<br />
END</p>
<p>This is currently defined within the program and will output the properly formatted and tabbed XML which you can then paste into your achievements.xml file. The goal is to have it work for all achievements, and I will keep you updated as to the progress should I choose to continue. As it stands, you can find the current version <a href="http://couchware.ca/blogs/WezzleCollisionGen.rb">here </a>although it&#8217;s a little bit ugly. Please note, you must have ruby 1.9+ in order to run it.</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/03/13/wezzle-collision-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Performance still matters.</title>
		<link>http://couchware.ca/www/kev/2009/03/10/performance-still-matters/</link>
		<comments>http://couchware.ca/www/kev/2009/03/10/performance-still-matters/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 16:08:35 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Big O]]></category>
		<category><![CDATA[Java2D]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Wezzle]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=112</guid>
		<description><![CDATA[With the abundance of computing power in processors today it is easy to fall into the trap of implementation without thought of performance. It is something I think all programmers do, myself especially.

Computers today have tons of processing power.  Who really cares about algorithm design when the computer can perform millions of calculations per [...]]]></description>
			<content:encoded><![CDATA[<p>With the abundance of computing power in processors today it is easy to fall into the trap of implementation without thought of performance. It is something I think all programmers do, myself especially.</p>
<p><span id="more-112"></span></p>
<p>Computers today have tons of processing power.  Who really cares about algorithm design when the computer can perform millions of calculations per second? This was a common thought of mine until recently. </p>
<p>When I learned big O notation and performance estimation in university I often thought to myself that I would never need to remember it, and it was not really useful for programming today. I was way off. Big O is something I have recently started using again and encourage every programmer to use as a way of estimating algorithm performance.</p>
<p>When we started making Wezzle we initially began designing without real thought of efficiency. Our initial implementation was all about design. However, we were very inexperienced when it came to actually designing good quality code. We quickly ran into some severe performance issues, and the Wezzle design still has some major flaws that really aren&#8217;t worth fixing at this point. One thing I can say with certainty is that my understanding of good design has improved by a drastic amount from this experience.</p>
<p>Our initial game design included the use of <a href="http://www.w3.org/Graphics/SVG/">Scalable Vector Graphics (SVG)</a>. We chose to use SVG because we liked the way they looked and the fact that window resizing was a non-issue. However, we failed to take into account how performance critical games truly are, and how incredibly slow SVG graphics are. </p>
<p>Our initial game was extremely choppy and virtually unplayable on old machines. We spent a lot of time trying to figure out why that was and how to boost performance. Eventually we decided to bitmap our graphics and noticed a SUBSTANTIAL increase in playability and performance. </p>
<p>I was pretty shocked by this entire scenario. First, I had always assumed that performance today was a non-issue, and second, I never thought that the type of graphics we used would make such a huge difference in terms of performance. </p>
<p>SVG wasn&#8217;t even close to all of our performance issues with early versions of Wezzle. We had a bunch of calls that were needlessly being made every game tick (we still find this problem with some of our code) as well as various other design flaws that affected overall performance. We had an inefficient algorithm to refactor the board and just in general a lot of areas that could be streamlined. We also had a bunch of performance issues with label generation (which we fixed with a cacheing scheme) and some troubles with <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ref/PhantomReference.html">phantom references</a> (yuck!). We made extensive use of the built in <a href="http://en.wikipedia.org/wiki/Profiler_(computer_science)">profiler</a> in <a href="http://www.netbeans.org/">netbeans</a> during our first refactoring phase.</p>
<p>Since then Wezzle has gone through countless refactorings and countless optimizations. Another huge increase in performance came when we switched from <a href="http://java.sun.com/products/java-media/2D/index.jsp/">Java2D</a> to <a href="http://www.lwjgl.org/">OpenGL (lwjgl)</a>. Perhaps in a later post I will talk about some of the various optimizations we have employed in Wezzle, but that is beyond the scope of this article.</p>
<p>Even with all the performance issues in Wezzle, I thought to myself that games are kind of a unique situation that is very performance critical and lots of calculations are happening, maybe performance is only relevant to gaming.</p>
<p>Again I was wrong. As anyone who does any web development can attest to, large database operations can be TERRIBLY inefficient. I am currently under contract developing some code that loads a large number of records into a grid structure. I am limited by the fact that this grid is only usable to us by passing it XML on the client side, as well as various restrictions about look and feel that were dictated by my client. Perhaps in a future post I talk about the multitude problems with the grid I am using, and there are many, but that would take way too much space to type in this post. </p>
<p>Anyway, my first implementation which contained some optimizations took around 15 minutes to update 500 records from the grid. The records were huge and data validation was being done on every individual cell and since the grid had to be submit as a whole (as an XML string) I was parsing and updating the entire grid. </p>
<p>This was not acceptable and also mildly surprising. Going through my code I have optimized even more. I implemented a dirty cell scheme, marking cells which have been edited as dirty so that on the submit I can only validate cells which have been marked as dirty. This assumes that all data already in the database is valid (not always the case!). I validate pasted in values at paste-time and that&#8217;s it (once they pass validation, they are considered good from the client side). Finally, I mark records which have been modified as dirty and even though I still have to submit the entire grid, I now only parse the records that have been marked and skip the rest. This has vastly improved update performance on the average case. It has improved updates in the worst case as well, but not by quite so much, a full submit still takes some time.</p>
<p>I&#8217;m going to end this by saying that while yes, performance is an issue, it is also sometimes a non-issue. First and foremost you should code something for clarity. A clear design that is slightly less efficient is always better than a streamlined but cryptic design. It is a mistake to optimize something that doesn&#8217;t actually need optimization and a big time waster. A popular saying is &#8220;design for clarity first and foremost and use a profiler to determine which areas need to be optimized.&#8221; This idiom does make sense and makes a valid point, but I would instead say to design for clarity and performance in conjunction as performance can often be a surprising bottleneck. </p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/03/10/performance-still-matters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wezzle XML</title>
		<link>http://couchware.ca/www/kev/2009/01/27/wezzle-xml/</link>
		<comments>http://couchware.ca/www/kev/2009/01/27/wezzle-xml/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 18:00:57 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Wezzle]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=22</guid>
		<description><![CDATA[XML is neat.
I&#8217;d like to talk a bit about a cool little feature of Wezzle that nobody knows about. Wezzle reads all of its information from XML. Neat!

Ok, ok, so that&#8217;s not that groundbreaking. I never said it was, but it IS cool. Because of this, all of Wezzle&#8217;s attributes are fully customizable.
The first time [...]]]></description>
			<content:encoded><![CDATA[<p>XML is neat.</p>
<p>I&#8217;d like to talk a bit about a cool little feature of Wezzle that nobody knows about. Wezzle reads all of its information from XML. Neat!</p>
<p><span id="more-22"></span></p>
<p>Ok, ok, so that&#8217;s not that groundbreaking. I never said it was, but it IS cool. Because of this, all of Wezzle&#8217;s attributes are fully customizable.</p>
<p>The first time you run it, Wezzle generates four files located in your home directory in a folder called <code>.Couchware/Wezzle</code>. Three of these files are XML files, <code>achievements.xml</code>, <code>game-settings.xml</code> and <code>user-settings.xml</code>. The fourth file is the log file.  These files contain your personal settings and achievements, modify them to your hearts content! If you ever run into a problem, you can just delete the file and the game will load the default settings.</p>
<p>I know what you are thinking: &#8220;Awesome. Every game has customizable settings, why is this so special?&#8221;. Well my friends, it&#8217;s special because Wezzle understands XML! What this means is, you guys can create content and as long as it conforms to our specifications (which we will release with or shortly after we release Wezzle) Wezzle will understand it. These three XML files are loaded on top of our base settings, which means things like custom tilesets, custom tile colours and even custom achievements are easy!</p>
<p>I&#8217;m going to look a little bit at achievements. Wezzle&#8217;s achievement system is a rule based system. What this means is, any achievement can be expressed as a set of rules. For example, if you wanted to have an achievement for scoring more than 6000 points, the achievement would simply contain the rule: SCORE &gt; 6000. Cool.</p>
<p>Additionally, an achievement is only completed iff (if and only if) all the rules evaluate to true. This means that we can combine any number of rules to make an achievement.</p>
<p>A huge benefit of this is that writing achievements is trivial, as long as you know the set of available tags. The achievement system already reads in all it&#8217;s achievements from an XML file and is still being expanded. Here is an example of an achievement that is currently in our test game:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Get A Level&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;BRONZE&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Starting from level 1, get to level 2 without
  getting a game over.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;START_LEVEL&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;EQ&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;LEVEL&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;EQ&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The achievement is enclosed with <code>&lt;achievement&gt;</code> tags which include meta data for that achievement including the difficulty level and name. The <code>&lt;description&gt;</code> tag is the achievements description as shown in the achievement browser. Finally, all the rules are defined in <code>&lt;rule&gt;</code> tags. Pretty simple huh? As you can see, we defined two rules with this achievement. Rule 1: Start level = 1. Rule 2: Level = 2.</p>
<p>When designing our XML tags for Wezzle we wanted our rules to be as readable as possible. We tried to mimic human speech. Each rule is an AND relationship. The above XML for our achievement can be read like this: START_LEVEL EQ 1 AND LEVEL EQ 2. In other words: &#8220;start level equals 1 and level equals 2&#8243;.</p>
<p>An achievement is considered completed iff ALL of its rules evaluate to true. Therefore, in order to achieve the achievement listed above, you must start the game at level 1 and your current level must be level 2. This means that if you start on level 2 (or any other level than 1), you cannot complete this achievement.</p>
<p>Now lets take a look at writing a custom achievement. In order to do this, all we have to do is write up the XML and stick it into our <code>achievements.xml</code> file. Wezzle will automatically read this new achievement and incorporate it into the game, including placing it into the achievement browser.</p>
<p>I will walk you through the creation of another one of the available achievements currently in the game. We would like to have an achievement for when a rocket fires into another rocket. In the game the name of this achievement is &#8220;A Tale of Two Rockets&#8221; and its a Silver achievement.</p>
<p>So to start we make our achievement tag: <code>&lt;achievement name="A Tale of Two Rockets" difficulty="SILVER"&gt;</code>. Then we make our description: <code>&lt;description&gt;Fire a rocket into another rocket.&lt;/description&gt;</code>. That&#8217;s the easy part. In order to get the functionality we need, we have to properly create our rules. The rule we are looking for here is called a COLLISION. A collision takes an operation and a list of items. We will be using the BETWEEN operation and our item types will both be ROCKETS.</p>
<p>Our rules will look like this: <code>&lt;rule type="COLLISION" operation="BETWEEN"&gt;&lt;item type="ROCKET"/&gt;&lt;item type="ROCKET"/&gt;&lt;/rule&gt;</code>. This is pretty intuitive. This XML reads as COLLISION BETWEEN ROCKET AND ROCKET. Pretty simple.</p>
<p>The full achievement looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;A Tale of Two Rockets&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;SILVER&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fire a rocket into another rocket.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;COLLISION&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;BETWEEN&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>There&#8217;s one more thing we need to make sure of when adding our custom achievement. Within the XML file there are two entries: <code>&lt;entry name="User.Achievement"&gt;</code> and <code>&lt;entry name="User.Achievement.Completed"&gt;</code>. By default the only entries in the <code>achievement.xml</code> file are in the <code>User.Achievement.Completed</code> entry. So to add our custom achievement, we will have to make a new entry for our non-completed achievement.</p>
<p>The final file (with a completed achievement) looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas, monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;User.Achievement.Completed&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Get A Level&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;BRONZE&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Starting from level 1, get to level 2 without
      getting a game over.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;date</span> <span style="color: #000066;">day</span>=<span style="color: #ff0000;">&quot;27&quot;</span> <span style="color: #000066;">month</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">year</span>=<span style="color: #ff0000;">&quot;2009&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;START_LEVEL&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;EQ&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;LEVEL&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;EQ&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;User.Achievement&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;achievement</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;A Tale of Two Rockets&quot;</span> <span style="color: #000066;">difficulty</span>=<span style="color: #ff0000;">&quot;SILVER&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fire a rocket into another rocket.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rule</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;COLLISION&quot;</span> <span style="color: #000066;">operation</span>=<span style="color: #ff0000;">&quot;BETWEEN&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;item</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;ROCKET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/achievement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/settings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>That&#8217;s all there is to it.</p>
<p>Hopefully you guys enjoyed this and will get to making or suggesting some custom achievements!</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/01/27/wezzle-xml/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
