<?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>Cobworks &#187; Game Development</title>
	<atom:link href="http://cobworks.ca/category/game-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://cobworks.ca</link>
	<description>A window to the snails pace of personal development</description>
	<lastBuildDate>Thu, 24 Nov 2011 20:12:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mobile Flash&#8217;s Growing Pains</title>
		<link>http://cobworks.ca/2010/11/21/report-from-mobile-flashs-front-lines/</link>
		<comments>http://cobworks.ca/2010/11/21/report-from-mobile-flashs-front-lines/#comments</comments>
		<pubDate>Sun, 21 Nov 2010 19:13:38 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Being Entrepreneurial]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=163</guid>
		<description><![CDATA[
I&#8217;ve recently commented on the lack of games on Android and thought that the Android market could use a good tower defense game. Of course, it would be nice to make money on my side projects, so I thought it would be really good to port my game to iOS and other modern devices, maximizing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cobworks.ca/wp-content/uploads/2010/11/impossible.png"><img src="http://cobworks.ca/wp-content/uploads/2010/11/impossible.png" alt="" title="impossible" width="366" height="324" class="aligncenter size-full wp-image-166" /></a><br />
I&#8217;ve <a href="http://cobworks.ca/2010/04/19/why-android-market-has-no-games/">recently commented</a> on the lack of games on Android and thought that the Android market could use a good tower defense game. Of course, it would be nice to make money on my side projects, so I thought it would be really good to port my game to iOS and other modern devices, maximizing my potential market and ideally, selling a lot more games.</p>
<p>The problem is that me and a friend working on a game don&#8217;t have the time, energy or mental fortitude to port our game to all those platforms. This has been the dilemma of the mobile application developer for years. Unlike desktop development where 90% of your market runs the same platform, mobile is, has always been and very likely will always be a fractured market with no clearly dominate player. </p>
<p>What this means is that I need to put in a lot more work for my apps to reach the majority of smart phone users. I have worked at companies that make their own mobile frameworks with the dream of one day being able to plug an xml file through their machine and have a blackjack game (for example) spit out the other end. Problem is that platforms are always being updated forcing you to always update your framework. The biggest problem though is that if your apps are so simple that a framework can make them, it will be faster and cheaper to just build the apps using reusable code.</p>
<p>Adobe is trying to be the new Java (only focusing on the front end rather than servers). As an independent developer, I applaud their efforts but gotta say mobile Flash is in an alpha stage right now and is not ready. After trying to port my tower defense game to my Nexus One, I was surprised to find everything was just really slow, across the board. I put in some diagnostic code and discovered that the mobile version of my game takes 50% longer to do everything. 30 FPS became 20 FPS. What I thought would be the processor intensive parts of the game (the path finding) actually ran fine. It was the graphics, drawing one circle around a selected tower slowed things by a further 35-50%. I have heard that when doing mobile Flash development to avoid using any vector graphics (using the Graphics API), but the truth is that any vector graphics kills your apps performance to the point where vector drawing shouldn&#8217;t be allowed on mobile Flash, it is unusable. </p>
<p>Of course, the problem is that once you do that, you fracture your cross-platform platform. But that doesn&#8217;t really matter anyways as just using Sprite&#8217;s and bitmaps alone slows my app down to the point off being unusable (and those are essential to Flash). If you look at Adobe evangelists showing off Flash on their phones, they are usually apps where there is very little movement (showing an image gallery is common). I wish they would stop doing this as I find it misleading. What would be great is for Adobe to instead advise developers on how to optimize their Actionscript code for mobile devices (other than a few <a href="http://www.actionscript.org/forums/showthread.php3?t=249212">forum posts</a>, there is really nothing on the web providing guidelines on this). If this isn&#8217;t possible, developers are going to abandon Flash as a mobile platform, but if Adobe keeps acting like there isn&#8217;t an 800 pound gorilla in the room, developers might start abandoning Flash all together.</p>
<p>Of course, if RIM and Adobe are able to make their new QNX OS and Flash work fast and zippy together, that could be the time where Adobe can start shaking the &#8220;poor performance&#8221; monkey off it&#8217;s back. If they don&#8217;t pull it off, I hope RIM has a native SDK in the works.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2010/11/21/report-from-mobile-flashs-front-lines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotating Objects Around Their Center</title>
		<link>http://cobworks.ca/2010/10/25/rotating-objects-around-their-center/</link>
		<comments>http://cobworks.ca/2010/10/25/rotating-objects-around-their-center/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 16:45:31 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=154</guid>
		<description><![CDATA[In actionscript, when you create a Bitmap or Movieclip or Sprite, it&#8217;s reference point is at the top left at 0, 0 meaning that if you rotate an object, it will rotate around the top left corner, not the center. 
I am currently working on a tower defense game and needed the turrets for my [...]]]></description>
			<content:encoded><![CDATA[<p>In actionscript, when you create a Bitmap or Movieclip or Sprite, it&#8217;s reference point is at the top left at 0, 0 meaning that if you rotate an object, it will rotate around the top left corner, not the center. </p>
<p>I am currently working on a tower defense game and needed the turrets for my towers to rotate around the center. There are many sites such as <a href="http://ryanbosinger.com/blog/2008/actionscript-30-rotate-around-center-point/">Ryan Bosingers</a> that correctly explain you need to use a matrix and transform your object so that the point you want to rotate around is at 0, 0. </p>
<pre class="brush: as3;">
private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
      var m:Matrix=ob.transform.matrix;
      m.tx -= ptRotationPoint.x;
      m.ty -= ptRotationPoint.y;
      m.rotate (angleDegrees*(Math.PI/180));
      m.tx += ptRotationPoint.x;
      m.ty += ptRotationPoint.y;
      ob.transform.matrix=m;
 }
</pre>
<p>The problem with solutions such as the above is that over time your objects can start to drift. This is caused because once you rotate your object, you are altering it&#8217;s width and height. If you rotate a square 45 degrees, it is a diamond and its width is greater. In the function above you transform an objects back X pixels, rotate it a bit then transform it back the same X pixels, ignoring the fact that the rotation changed the width and height slightly. This adds up over time, which is why you want to basically reset your matrix with the <code>identify()</code> method:</p>
<pre class="brush: as3;">
private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point) {
      var m:Matrix=ob.transform.matrix;
      m.identity()
      m.tx -= ptRotationPoint.x;
      m.ty -= ptRotationPoint.y;
      m.rotate (angleDegrees*(Math.PI/180));
      m.tx += ptRotationPoint.x;
      m.ty += ptRotationPoint.y;
      ob.transform.matrix=m;
 }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2010/10/25/rotating-objects-around-their-center/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Android Market Has No Games</title>
		<link>http://cobworks.ca/2010/04/19/why-android-market-has-no-games/</link>
		<comments>http://cobworks.ca/2010/04/19/why-android-market-has-no-games/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 13:10:21 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[emulator]]></category>
		<category><![CDATA[errors]]></category>
		<category><![CDATA[openGL ES]]></category>
		<category><![CDATA[samples]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=85</guid>
		<description><![CDATA[
After a few days of Nexus One ownership I began looking for games, preparing to be hypnotized by games as amazing as the Nexus One itself. After my first search, the list of games I found was the following: Robo Defense Lite (an ok tower defense game), Labyrinth Lite, Poke A Mole, Pinball and BreakTheBlocks [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cobworks.ca/wp-content/uploads/2010/04/opengltext.png"><img src="http://cobworks.ca/wp-content/uploads/2010/04/opengltext.png" alt="" title="opengltext" width="500" height="502" class="aligncenter size-full wp-image-87" /></a></p>
<p>After a few days of Nexus One ownership I began looking for games, preparing to be hypnotized by games as amazing as the Nexus One itself. After my first search, the list of games I found was the following: Robo Defense Lite (an ok tower defense game), Labyrinth Lite, Poke A Mole, Pinball and BreakTheBlocks Lite. The list of games after the top five were similar and included many more brick breaker, whack-a-mole, snake and pong games.</p>
<p>Underwhelmed hardly describes how I felt.</p>
<p>Being a computer programmer with notable skillz, I thought &#8220;I will make an amazing 3d game on Android and show these other Android developers how its done!&#8221;. After a weekend of tinkering, researching and compiling code, I can with 100% certainty say the reason why there are so few good games for Android is because it is nearly impossible to program good games without losing your sanity. I felt like the Charles Bukowski of computer programming by the time I was done.</p>
<p>While Iphone, webOS and windows mobile all have openGL ES 2.0 available, Android is stuck with openGL ES 1.0. The recommended way to write a string onto a 3d object is to make the text you want to draw a texture. So &#8220;game over&#8221; could be one texture and &#8220;press start to continue&#8221; would be another. But to display something that changes, like your score, onto the side of a rotating cube you need to write your own text renderer (ugh).</p>
<p>Android exposes OpenGL ES 2.0 which makes drawing text easier, but you need the <a href="http://developer.android.com/sdk/ndk/index.html">NDK</a> (Native Development Kit) to do that. Working with the NDK reminded me of working with Symbian v3 five years ago; lots of config files and directory structuring, like it was designed by engineers who spend far too much time in a terminal and think GUI&#8217;s are &#8220;nice to have&#8221;. Because I was running Windows, I needed to install Cygwin to build the native libraries. </p>
<p>After an hour or so setting up the NDK and prepping and catching up on this <a href="http://www.koushikdutta.com/2009/01/jni-in-android-and-foreword-of-why-jni.html">Java JNI business</a>, I was ready to run the openGL ES 2.0 demo that came with the NDK on the emulator. But for some reason, I kept getting an error that simply said &#8220;The application xyz has stopped unexpectedly. Please try again&#8221;. After the relatively tedious process of setting up the NDK and running the sample app and getting vague errors, I retraced my steps. I thought I screwed up my NDK during install or I somehow screwed up the sample&#8217;s build process. I spent hours trying to resolve this only to find on a forum that the emulator doesn&#8217;t do openGL ES 2.0. I had to test the app on my Nexus. No debugging and a longer than necessary process getting my .apk onto my phone (not to mention the number of times I would crash the phone testing my .apk).</p>
<p>That was bad enough, but the kicker was that after hours of hair pulling frustration, the sample app only showed a static 2d green triangle and a background that went from black to white. A 2d sample to demonstrate openGL ES 2.0, the defacto mobile 3d library. It would be nice to have a few <a href="http://nehe.gamedev.net/">Nehe</a> demos included instead (though props to <a href="http://insanitydesign.com/wp/projects/nehe-android-ports/">INsanityDesign</a> for putting some together for openGL ES 1.0)</p>
<p>Am I going to be developing an amazing 3d game that is going to make people feel like they were punched in the face because it&#8217;s so amazing? Not on Android anytime soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2010/04/19/why-android-market-has-no-games/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Flash and its Game Development Drawbacks</title>
		<link>http://cobworks.ca/2008/12/13/flash-and-its-game-development-drawbacks/</link>
		<comments>http://cobworks.ca/2008/12/13/flash-and-its-game-development-drawbacks/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 17:41:56 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=8</guid>
		<description><![CDATA[There was a time not long ago where I was super excited about the idea of really pushing Actionscript to its brink to deliver web-based games that rival the quality of older PC games (with better graphics). But alas! my dreams have been dashed! You see, Actionscript is an amazing medium; it can be used [...]]]></description>
			<content:encoded><![CDATA[<p>There was a time not long ago where I was super excited about the idea of really pushing Actionscript to its brink to deliver web-based games that rival the quality of older PC games (with better graphics). But alas! my dreams have been dashed! You see, Actionscript is an amazing medium; it can be used to make all kinds of applications, except applications that require any serious amount of processing.</p>
<p>To demonstrate my point I&#8217;ve created a wee <a title="demo" href="http://www.cobworks.ca/binree/tree.html">demo</a>. It&#8217;s a binary tree that uses recursion to draw itself. I&#8217;ve also added some code so that it can animate, but that&#8217;s more for fun rather than demonstration.</p>
<p>If you run the demonstration, you&#8217;ll find a very noticable delay when drawing more than 5 levels of recursion, or 126 branches. You&#8217;ll also notice that rendering takes an exponential amount of time longer compared to the next lowest number of recursions.</p>
<p>We aren&#8217;t splitting the atom here, we are merely drawing lines and my interpretation is that though Actionscript is great for more simple applications or a gui on a database, when it comes to serious processing power you are better off with different platforms.</p>
<p>For those who would argue that Actionscript is fine and I&#8217;m simply a crappy programmer (which I wouldn&#8217;t argue too much), you can optimize the code and prove me wrong <a title="here" href="http://www.cobworks.ca/binree/Tree.as">here</a> (CS4 fla <a title="here" href="http://www.cobworks.ca/binree/tree.fla">here</a>).</p>
<p>This is why my idea of an RTS in Flash is dead. Flash can&#8217;t handle it. Daphne is dead <img src='http://cobworks.ca/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>BUT &#8211; <a title="Alchemy" href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a> looks promising&#8230; speed of c/c++ in your browser, every browser, on every platform??? Fuck ya, that is an awesome idea (why every program for the OS then?)</p>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2008/12/13/flash-and-its-game-development-drawbacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash Keyboard Input in Full Screen Work Around</title>
		<link>http://cobworks.ca/2008/05/10/flash-keyboard-input-in-full-screen-work-around/</link>
		<comments>http://cobworks.ca/2008/05/10/flash-keyboard-input-in-full-screen-work-around/#comments</comments>
		<pubDate>Sat, 10 May 2008 17:20:45 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[full screen]]></category>
		<category><![CDATA[keyboard input]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=6</guid>
		<description><![CDATA[I have recently cut some beef with Adobe and their decision to not allow the Flash player to capture keyboard input. In my game, Daphne, I see this decision as a show stopper&#8230; Imagine playing Starcraft and not being able to use hot keys in the heat of battle, lame. Hot keys are key to [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently cut <a href="http://cobworks.ca/2008/04/24/flash-in-the-cage/">some beef with Adobe</a> and their decision to not allow the Flash player to capture keyboard input. In my game, Daphne, I see this decision as a show stopper&#8230; Imagine playing Starcraft and not being able to use hot keys in the heat of battle, lame. Hot keys are key to any self respecting RTS game developer.</p>
<p>Thought it is possible for players to play Daphne in a regular browser window surrounded by HTML, it loses a lot of appeal, especially as your mouse must always be over the Flash canvas in order to register certain fundamentally important (and basic) game features, such as the ability to scroll the game map when your mouse is at the edge of the canvas. It is too easy to move your mouse beyond the Flash canvas, especially when your base is being over run and you are frantically scrolling the map to look for defense or an exit. This significantly deteriorates game play.</p>
<p>And besides that, who wouldn&#8217;t want to play games in full screen vs a small canvas in a browser?</p>
<p>A limited solution is to have your Flash canvas take up 100% of the width and height of the browser page and rely on the browsers build in full screen functionality (usually activated by the F11 key). This is limited because different browsers have different notions of &#8216;full screen&#8217;. Firefox for example expands to full screen, but the address bar is still visible on top (though there are plug-ins that remedy this). Opera mean while implements true full screen right out of the box.</p>
<p>This is a limited solution for these reasons, and because the end user may need to install a new browser to play Daphne in full screen. The whole idea of using Flash as my development platform is so Daphne can be played in any environment and behave the same with no additional downloads or without troubling the end user to have to manually install 3rd party products.</p>
<p>Nevertheless, this proves my point that Adobe is out to lunch when it comes to the thought process behind their idea that keyboard input whilst in full screen is a security liability. It can be done by circumventing Flash and javascript entirely and just relying on the browser.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2008/05/10/flash-keyboard-input-in-full-screen-work-around/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daphne is born from the loins of my mind</title>
		<link>http://cobworks.ca/2008/04/14/daphne-is-born/</link>
		<comments>http://cobworks.ca/2008/04/14/daphne-is-born/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 19:26:10 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[Daphne]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Games]]></category>

		<guid isPermaLink="false">http://cobworks.ca/?p=1</guid>
		<description><![CDATA[Mercifully, work (only?) typically occupies 8 hours of my week day. That leaves me with about 8 hours of personal time, half of which is usually spent on less exciting things like being in transit, eating, washing up, etc.
Often, at work I can&#8217;t wait to get home, I don&#8217;t think about what I will do [...]]]></description>
			<content:encoded><![CDATA[<p>Mercifully, work (only?) typically occupies 8 hours of my week day. That leaves me with about 8 hours of personal time, half of which is usually spent on less exciting things like being in transit, eating, washing up, etc.</p>
<p>Often, at work I can&#8217;t wait to get home, I don&#8217;t think about what I will do at home and inevitably, when I get home, I spend several minutes frozen wondering what I&#8217;m going to do with my new found, temporary, precious freedom.</p>
<p>As I am not big on TV, I often find it difficult to wisely spend my precious free time. I am very conscious, almost obsessed, with the thought of me of the future looking back on my earlier years and asking my future self &#8220;Why was I such a useless git? What the hell did I do with my time?&#8221;.</p>
<p>It is for this reason that I often am programming video games in my free time. I know it is debatable whether or not mucking about with Flash and all its quirks is really a better use of my time than doing nothing, but different strokes for different folks&#8230;</p>
<p>The reason I like programming video games is that games are always unique. There is no standard list of GUI components you constantly use, there usually isn&#8217;t any database malarky to deal with. The GUI should be custom and unique and how the components of your game interact with each other and the user is totally up to you and what you think is awesome. I find that using standard components over and over again gets a bit boring. Finding slick new ways to access data is also quite dry. There are billions of frameworks that help make developing such classic database apps (enterprise apps?) super easy to the point that it&#8217;s no long fun to program.</p>
<p>Hence, I like my game programming.</p>
<p>The first step to creating any application of any significant size is finding a name by which to reference it. As I suck at finding cool names for things, I follow a Greek Nymph naming convention. So far Echo and Calypso have been used, so I randomly decided to choose Daphne, famed for her decision to escape Apollo&#8217;s gino-like obsession by transforming herself into a Bay Tree.</p>
<p>I will make no pretenses, Daphne is based upon Blizzards original Starcraft as much as possible. This is partly due to my pathetic lack of creativity, but it is also due to the fact that Starcraft is one of the best games ever made, definitely the best RTS. It is primarily for this reason that Daphne is a sort of homage to what I consider to be the best game developers on the planet right now (seriously, who makes better story lines than Blizzard? and with the glaring exception of Warcraft 3, all their games must of been at least partially developed by <a href="http://xkcd.com/224/">some sort of higher being</a>).</p>
<p>So, I have started working on Daphne, So far I have the tile map stuff working fine and a lot of the multi-player communication stuff is sorted. I would like to post the game in updated carnations as I develop it, but right now, it&#8217;s so god damn ugly and lame that I&#8217;m going to have to wait until it is at least some what presentable to people with a vivid imagination.</p>
]]></content:encoded>
			<wfw:commentRss>http://cobworks.ca/2008/04/14/daphne-is-born/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

