<?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>Doug McInnes &#187; Games</title>
	<atom:link href="http://dougmcinnes.com/category/games/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougmcinnes.com</link>
	<description>Chuckle and Chortle</description>
	<lastBuildDate>Tue, 08 May 2012 17:13:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Welcome Visitors</title>
		<link>http://dougmcinnes.com/2011/07/05/welcome-visitors/</link>
		<comments>http://dougmcinnes.com/2011/07/05/welcome-visitors/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 15:30:09 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=189</guid>
		<description><![CDATA[When I released my HTML 5 Asteroids Clone last year it got a fair number of hits as the link was passed around the Twitters and random blog postings. Soon the hits dropped off and traffic normalized to slightly higher &#8230; <a href="http://dougmcinnes.com/2011/07/05/welcome-visitors/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When I released my <a href="http://dougmcinnes.com/2010/05/12/html-5-asteroids/">HTML 5 Asteroids Clone</a> last year it got a fair number of hits as the link was passed around the Twitters and random blog postings. Soon the hits dropped off and traffic normalized to slightly higher than before, still mostly from various blogs.<br />
<figure id="attachment_190" aria-labelledby="figcaption_attachment_190" class="wp-caption alignnone" style="width: 693px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.46.06-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.46.06-PM.png" alt="WHOA TRAFFIC" title="asteroids release traffic spike" width="683" height="270" class="size-full wp-image-190" /></a><figcaption id="figcaption_attachment_190" class="wp-caption-text">The traffic spike from the release of HTML 5 Asteroids</figcaption></figure><br />
Lately I have been receiving some spikes in traffic directly to the HTML 5 Asteroids game almost all of which had no referrer. It was a puzzle &#8212; up till now most of my traffic had come from a specific source but these visitors were coming directly to my site, from a bookmark, or just typing in the URL.<br />
At first I just shrugged it off, I figured some people had bookmarked the game and played it occasionally. Still the traffic kept coming, only abating on the weekends, and I couldn&#8217;t think I&#8217;d get that many hits from people casually playing from bookmarks. The WordPress stats package wasn&#8217;t giving me much beyond the plain quantity of traffic.<br />
Finally I installed Google Analytics. I had never used it before but I figured it may give me more insight to where this traffic was coming from. It would at least tell me what kind of browser they were using.<br />
So I waited a few days for it to pull some data in. This is what I saw:</p>
<p><figure id="attachment_192" aria-labelledby="figcaption_attachment_192" class="wp-caption alignnone" style="width: 600px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.36.49-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.36.49-PM.png" alt="" title="Internet Explorer?" width="590" height="223" class="size-full wp-image-192" /></a><figcaption id="figcaption_attachment_192" class="wp-caption-text">Internet Explorer? IE doesn&#039;t support the canvas element. The game is unplayable on IE!</figcaption></figure><br />
<figure id="attachment_193" aria-labelledby="figcaption_attachment_193" class="wp-caption alignnone" style="width: 671px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.37.46-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.37.46-PM.png" alt="Almost all the traffic is from Washington State" title="Washington State?" width="661" height="365" class="size-full wp-image-193" /></a><figcaption id="figcaption_attachment_193" class="wp-caption-text">Almost all the traffic is from Washington State?</figcaption></figure><br />
<figure id="attachment_194" aria-labelledby="figcaption_attachment_194" class="wp-caption alignnone" style="width: 667px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.58.49-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.58.49-PM.png" alt="Traffic only from Seattle" title="Seattle?" width="657" height="369" class="size-full wp-image-194" /></a><figcaption id="figcaption_attachment_194" class="wp-caption-text">Seattle?</figcaption></figure><br />
<figure id="attachment_195" aria-labelledby="figcaption_attachment_195" class="wp-caption alignnone" style="width: 602px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.39.05-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.39.05-PM.png" alt="All the traffic is from Microsoft Corp" title="Microsoft Corp?!" width="592" height="144" class="size-full wp-image-195" /></a><figcaption id="figcaption_attachment_195" class="wp-caption-text">Microsoft Corp?!</figcaption></figure><br />
<figure id="attachment_196" aria-labelledby="figcaption_attachment_196" class="wp-caption alignnone" style="width: 601px"><a href="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.37.21-PM.png"><img src="http://dougmcinnes.com/wp-content/uploads/2011/07/Screen-shot-2011-07-02-at-11.37.21-PM.png" alt="All the traffic is from IE 10" title="IE 10!" width="591" height="135" class="size-full wp-image-196" /></a><figcaption id="figcaption_attachment_196" class="wp-caption-text">IE 10!</figcaption></figure></p>
<p><em>Microsoft Engineers are using my HTML 5 Asteroids game to test IE 10&#8242;s new canvas element</em>.</p>
<p>There isn&#8217;t much to say but: Awesome!</p>
<p>Welcome Microsoft Engineers! Thank you for playing my game!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2011/07/05/welcome-visitors/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML 5 Asteroids on the iPad</title>
		<link>http://dougmcinnes.com/2010/05/24/html-5-asteroids-on-the-ipad/</link>
		<comments>http://dougmcinnes.com/2010/05/24/html-5-asteroids-on-the-ipad/#comments</comments>
		<pubDate>Tue, 25 May 2010 07:29:44 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[asteroids]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=168</guid>
		<description><![CDATA[I&#8217;ve added touch controls to the HTML 5 Asteroids game that will only appear when you&#8217;re running it on an iPad.  The game will expand to fill the whole screen for maximum asteroid blasting action.  Orient your iPad in landscape &#8230; <a href="http://dougmcinnes.com/2010/05/24/html-5-asteroids-on-the-ipad/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added touch controls to the HTML 5 Asteroids game that will only appear when you&#8217;re running it on an iPad.  The game will expand to fill the whole screen for maximum asteroid blasting action.  Orient your iPad in landscape fashion!</p>
<h1 style="text-align: center;"><a href="http://dougmcinnes.com/html-5-asteroids/">Play It!</a></h1>
<p> </p>
<p>There are a couple caveats (warning some nerdy content ahead):</p>
<h4>Tunneling Effect</h4>
<p>On the iPad the game runs at around 22 frames per second at its peak, not nearly as good as around 40 on a laptop, though it is enough for gameplay even if it can get choppy at times when there&#8217;s a lot of stuff whizzing around.</p>
<p>Unfortunately I&#8217;m only testing for collisions when the objects are rendered so it&#8217;s quite possible with lower framerates to have a bullet flying out of your ship first get rendered on one side of the asteroid you&#8217;re trying to pulverize and in the next frame get rendered on the other side letting it sail undamaged into your ship.  This is called the tunneling effect.  This is not a problem on a laptop or desktop because the framerates are high.  Since we&#8217;re sampling less per second (~22 verses ~40) a moving object is drawn less times though it&#8217;s traveling the same distance.  In other words if an asteroid travels from the top of the screen to the bottom of the screen in one second, on your computer it will most likely get drawn 40 times during that trip and on an iPad it will get drawn only 22 times leaving larger gaps between the drawings.  These larger gaps leave more of a chance for things to slip through and not collide when your eyes say they should have.</p>
<p>I&#8217;m considering augmenting the collision detection to remove the tunneling effect but it will need extra math which means slower framerates, at least initially.  It might be a better use of my time to pump framerates up.</p>
<h4>Buggy Touch Events</h4>
<p>There&#8217;s a bug with the iPad&#8217;s implementation of touch events in Javascript: if you have two fingers on the screen and raise one of them, a &#8220;touchend&#8221; event gets fired containing a reference to both fingers even though the second one hasn&#8217;t been raised.  If you then raise the second one, a &#8220;touchend&#8221; event is not fired.</p>
<p>It drove me nuts trying to figure this out and I haven&#8217;t been able to  work around it.</p>
<p>What this means for the game is that using two fingers at the same time will get frustrating fast as the control you&#8217;re holding down will stop working periodically.  I suggest tapping for the best experience instead of holding.</p>
<p>Oh, this does not happen on the iPhone in case you were wondering, it works as expected! I have sent a bug report to apple (with a <a href="/wp-content/uploads/2010/05/test.html">sample html page</a>) and hopefully they already have a fix that&#8217;s not available yet or they will fix it for a future release.</p>
<p>On a side note, why aren&#8217;t Apple&#8217;s bug lists searchable by the public?  They must get reams of dupes.</p>
<ol> </ol>
<p>In any case, let me know how it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2010/05/24/html-5-asteroids-on-the-ipad/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML 5 Asteroids</title>
		<link>http://dougmcinnes.com/2010/05/12/html-5-asteroids/</link>
		<comments>http://dougmcinnes.com/2010/05/12/html-5-asteroids/#comments</comments>
		<pubDate>Thu, 13 May 2010 06:42:31 +0000</pubDate>
		<dc:creator>doug</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[asteroids]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://dougmcinnes.com/?p=126</guid>
		<description><![CDATA[For some months I&#8217;ve been playing around with HTML 5&#8242;s Canvas element because I was curious about it, especially after seeing it run Flash.  I hacked at it for a while then realized I had produced an Asteroids game. Play &#8230; <a href="http://dougmcinnes.com/2010/05/12/html-5-asteroids/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">For some  months I&#8217;ve been playing around with HTML 5&#8242;s Canvas element because I was curious about it, especially after <a href="http://wiki.github.com/tobeytailor/gordon/">seeing it run Flash</a>.  I hacked at it for a  while then realized I had produced an Asteroids game.<img class="size-full wp-image-132 alignright" title="asteriods" src="http://dougmcinnes.com/wp-content/uploads/2010/05/asteriods.png" alt="" width="171" height="134" /></p>
<h1 style="text-align: center;"><a title="Play It!" href="/html-5-asteroids/">Play It!</a></h1>
<p style="text-align: left;"> </p>
<p style="text-align: left;">The source code is <a href="http://github.com/dmcinnes/HTML5-Asteroids">up on GitHub</a>!</p>
<p style="text-align: left;">The <a href="https://developer.mozilla.org/en/Canvas_tutorial">Canvas</a> element is super cool.  Basically all of the sprites in the game are simple paths defined by an array of points.  These points are translated, rotated and scaled based on their state at any given point in the game using the standard Canvas transformations.  Plus it gives it a nice retro feel.</p>
<p style="text-align: left;">Let me know what you think!</p>
<p style="text-align: left;">Here&#8217;s some cool links to things that helped me out with the game:</p>
<ul style="text-align: left;">
<li><a href="http://www.alienryderflex.com/polygon/">Determining Whether A Point Is Inside A Complex Polygon</a>.  Firefox does the wrong thing when it comes to isPointInPath(), the main Canvas method I used for collision detection; It doesn&#8217;t apply the current transformations before determining if there&#8217;s been a collision (and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=405300">they won&#8217;t fix it</a> for some reason).  I implemented this method to get around the problem but it works fast enough it could be used on all browsers.</li>
<li><a href="http://www.metanetsoftware.com/">Metanet Software</a>, the makers of the awesome flash game <a href="http://www.thewayoftheninja.org/n.html">N</a>, have made a couple of extremely useful <a href="http://www.metanetsoftware.com/technique.html">tutorials on collision detection</a>.  These describe some of the techniques I used in the game, in particular the grid based broad-phase they describe in their second tutorial.</li>
<li>I used <a href="http://typeface.neocracy.org/">typeface.js</a> &#8216;s <a href="http://typeface.neocracy.org/fonts.html">convert tool</a> to convert the awesome <a href="http://www.dafont.com/vector-battle.font">Vector Battle</a> font into some JSON point data that could be easily used in the canvas.  Typeface.js is a neat library for easily embedding arbitrary fonts in the page.  On supported browsers it creates small canvas elements and renders the font inside based on the CSS.  I borrowed bits from the library to get the font rendering.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dougmcinnes.com/2010/05/12/html-5-asteroids/feed/</wfw:commentRss>
		<slash:comments>66</slash:comments>
		</item>
	</channel>
</rss>

