<?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>Jesse Freeman</title>
	<atom:link href="http://jessefreeman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jessefreeman.com</link>
	<description>Artist, Interactive Developer and Writer.</description>
	<lastBuildDate>Mon, 07 May 2012 13:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Building HTML5 Metro Games For Windows 8</title>
		<link>http://jessefreeman.com/articles/building-html5-metro-games-for-windows-8/</link>
		<comments>http://jessefreeman.com/articles/building-html5-metro-games-for-windows-8/#comments</comments>
		<pubDate>Sat, 05 May 2012 18:41:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=507</guid>
		<description><![CDATA[About two months ago I did one of my HTML5 game development workshops at Microsoft&#8217;s NYC ...]]></description>
			<content:encoded><![CDATA[<p>About two months ago I did one of my HTML5 game development workshops at Microsoft&#8217;s NYC office. It was a huge success with over 100 registered attendees. One of the highlights of my workshop was showing people just how easy it is to build an HTML5 game for Win8 in just a few minutes. By leveraging the <a href="http://impactjs.com" target="_blank">Impact</a> game framework, it is easy and fun to build a Metro game with very little modification to the core source code. I figured I would go through what I did before the workshop to get <a href="http://gamecook.com/games/resident-raver" target="_blank">Super Resident Raver</a>, a modified version of the game I show people how to build in my <a href="http://jessefreeman.com/workshops/" target="_blank">workshops</a> and <a href="http://amzn.to/ztxjm7" target="_blank">book</a>, running on Win8.</p>
<p><span id="more-507"></span></p>
<h2>Metro HTML5 Apps</h2>
<p>One of the most exciting aspects of development for Windows 8 is the ability to build a native app using nothing but HTML and JS. I think this is a huge advantage over other platforms, and one that will help liberate HTML apps from the browser and bring them to the desktop in a way that no other platform has been able to do. All of this is made possible by Windows Runtime (WinRT), which is built into the core of the operating system.</p>
<p><img width="500" src="/wp-content/uploads/2012/05/image001.jpg"></p>
<p>As you can see, there are now three pillars for building Win8 apps: C++/XAML, C#/XAML and JS/HTML. It&#8217;s this last pillar that enables us to take any existing HTML5 Canvas-based game and turn it into a native Metro app with very little modification at all. In addition to simply being able to port over your JS game to a Metro app, Win8 provides an entire JS runtime with hooks into the OS via the WinJS library. These hooks allow you to extend your HTML5 app even further and blend it seamlessly into the OS. For the purpose of porting over Impact games to Win8, I am not going to touch on WinJS, but you should read more about it since your game will probably need to hook into Win8 core systems such as the file system, screen resize events, application focus events and any Metro-style controls you may want as part of your game&#8217;s UI.</p>
<p>In addition to the power of running HTML5 games natively on Win8, Visual Studio 11 also got a huge update to help support building JS applications. VS is now on par with the likes of WebStorm and other powerful HTML5 IDEs by proving code completion, refactoring and support for Metro-specific hooks provided by the WinJS runtime. I highly suggest giving VS a try since it&#8217;s the best and only way to build Win8 apps right now but, as the platform matures, VS is going to end up being one of the best HTML IDEs out there. I loved using VS for C# WP7 dev and am really excited about the new HTML, JS and CSS support MS is adding into it.</p>
<h2>Getting Up And Running</h2>
<p>One of the advantages I had over starting from scratch when it came to making an HTML5 Metro game was the Impact game framework. I have talked about this framework <a href="http://http://jessefreeman.com/articles/my-adventures-talking-about-html5-gaming/" target="_blank">before</a> and, since I already had a bunch of games written in Impact, it was a no-brainer to just port them over as is. One thing to keep in mind is that there is now a JavaScript equivalent of XNA for Win8 so, if you don&#8217;t want to use Impact, you will have to find another game framework or build one from scratch. Grant Skinner has been optimizing his own JS frameworks to run on Win8, and the consumer preview ships with one of his Canvas-based games called Pirates Love Daisies. I suggest you give it a try, but keep in mind that Impact is made specifically for game development and comes with its own level editor, which can help dramatically speed up your game development.</p>
<p>Once I had a basic Impact game ready to go, it was incredibly easy to get it set up in Visual Studio. I simply created a new JS-based Metro project and copied over my code into the project.</p>
<p><img src="/wp-content/uploads/2012/05/new_project.jpg"></p>
<p>Here you can see I am simply selecting the Blank JavaScript Metro app template.</p>
<p><img src="/wp-content/uploads/2012/05/impact_files.jpg"></p>
<p>One I created the project, I copied over my game&#8217;s lib and media directories.</p>
<p>Don&#8217;t forget that you need to manually add your files to the project. You do this easily by following selecting show all files.</p>
<p><img src="/wp-content/uploads/2012/05/show_all_files.jpg"></p>
<p>Now you can see all the hidden files which apear with grayed out icons. Simply select the files or folders you want in your project then right click and pick &#8220;Include In Project&#8221;</p>
<p><img src="/wp-content/uploads/2012/05/include_in_project.jpg"></p>
<p>Once all your Impact files are included in the project, you will need to set up the default.html file to import and load up your Impact code. I simply copied over the contents of my Impact index.html files over to the default.html and everything worked great. One thing to keep in mind is that by replacing the contents of defult.html you lose the references to the WinJS runtime so becarfuul as you copy your code over. I would take a look at the default.js file to see the hooks for handling launching, exiting and resuming your game as part of the Metro App&#8217;s lifecycle.</p>
<p>Now, with everything linked up, you can compile your game and test it out.</p>
<p><img src="/wp-content/uploads/2012/05/app_icon.jpg"></p>
<p>The app should run great, but there are a few more things you may want to consider when moving forward:</p>
<ul>
<li>
<p>It&#8217;s really easy to set up Metro live tiles, which represent the icon of your game on the Win8 launcher screen. You have a lot of freedom when it comes to designing these, so check out <a target="_blank" href="http://blogs.msdn.com/b/windowsappdev/archive/2012/04/16/creating-a-great-tile-experience-part-1.aspx">this article</a> to learn more about how to set them up.</p>
</li>
<li>
<p>Metro apps have a minimum resolution of 1024&#215;768 but actually support many different resolutions larger than this. It is good to think through how your application is going to scale across different screen sizes by checking out the <a target="_blank" href="http://blogs.msdn.com/b/b8/archive/2012/03/21/scaling-to-different-screens.aspx">following article</a>.</p>
</li>
<li>
<p>Check out the <a target="_blank" href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465493.aspx">WinJS APIs</a> and map out what features you want to support in your game. This may be especially helpful for UI or saving files to the local storage system.</p>
</li>
<li>
<p>In the end, once you have linked up your Impact code to the default.html file, you should have everything you need to run, debug and test your game. From there you will need to add support for keyboard/touch controls, optimization and eventually look into publishing your app to the Win8 Store, which you can learn more about <a href="http://blogs.msdn.com/b/windowsstore/archive/2012/02/13/submitting-your-windows-8-apps.aspx">here</a>.</p>
</li>
</ul>
<p>Here is a screen shot of the game running with touch controls so you can play it on Window 8 Slates and I also have the Impact profiler running to test out performance.</p>
<p><img src="/wp-content/uploads/2012/05/rr_win8.jpg"></p>
<p>As you can see the game is running smoothly at 60 fps on the preview device I got at the Microsoft Build conference.</p>
<p><img src="/wp-content/uploads/2012/05/fps.jpg"></p>
<h2>Optimization</h2>
<p>After I had my game set up in Visual Studio and everything was compiling, I started to notice some performance issues. Out of the box my game was running at 30-40 FPS, but I wasn&#8217;t very happy with the performance. My game was skipping frames and sometimes the system lag would lock up the game. What was confusing me was that the draw calls in the game were being executed incredibly fast. Canvas, by default in Win8, is hardware accelerated. At first I attributed this to the higher resolution but, after some research, I started to learn that Win8 games run slow if their game loop relies on setInterval instead of requestAnimationFrame.</p>
<p>Unfortunately this wasn&#8217;t an easy fix. This required patching one of the core classes in Impact to make the modification. Dominic, who created Impact, used to use requestAnimationFrame earlier on in the framework&#8217;s development but pulled it out. I reached out to him and he gave me the following <a href="http://bit.ly/KsHZFw" target="_blank">plugin</a> which I was able to use in order to patch the framework to use requestAnimationFrame. Once I loaded this plugin into my Win8 version of the game I saw an incredible boost in performance. Dominic is aware of the issue and will hopefully add support for requestAnimationFrame in future builds of the framework.</p>
<p>I also want to point out that the slowdowns weren&#8217;t solely related to requestAnimationFrame; my game was not optimized at all at this point. Before I started building the Win8 build of my game, I had only focused on desktop with no mobile optimizations at all. While Win8 on my development devices is as powerful as a desktop computer, you really need to think of these new computers as mobile devices. This means that any optimizations you would normally make to an Impact game to run on iOS&#8217;s browser will make a huge difference in the performance of your game on Win8. Part of the issue is the incredibly high screen resolution of Win8 apps. The goal really is to limit the number of draw calls your game is making. Here is a list of optimizations I performed, which drastically improved the performance of my game:</p>
<ul>
<li>
<p><b>Pre-Render Layers</b> &#8211; Make sure your map layers have &#8220;Pre-Render in Game&#8221; selected, which will speed up the rendering by creating larger images of the tiles resulting in less draw calls. The only down side is that you will not be able to have animated background tiles, but the increase in performance is noticeable.
</li>
<li>
<p><b>Limit Entities On-Screen</b> &#8211; I started relying on lots of object pooling and limited the number of entities being spawned at any one time. This was especially expensive with all my blood particles that were getting created when entities would die. If I had a level with 10-20 zombies, and a grenade would go off killing most of them, it would spawn almost 20 blood entity particles per zombie. By reducing that to around five, I dramatically increased the responsiveness of the game when lots of entities would die at the same time.</p>
</li>
<li>
<p><b>Limit Weapon Fire Rate</b> &#8211; This is along the same lines as limiting the number of entities on the screen, but I wanted to call it out specifically. I went through and added object pooling into my weapon classes and also limited the number of projectiles per weapon. So, guns could only shoot three bullets at a time, shotguns could only do one bullet at a time and I restricted the player from throwing more than one grenade or land mine at a time, since they tended to kill more than one entity, which contributed to the blood particle slowdowns.</p>
</li>
<li>
<p><b>Remove Text Where Possible</b> &#8211; Text ended up being the biggest rendering issue I found in Impact. Every text field you render out incurs a draw per character so, if you have a HUD with the score and other stats at the top of the screen, you could end up with an additional 50 draw calls that will bog down your game. I removed the stats from the top of the game and put them in the pause screen. So, when you pause the game and all the entities stop drawing, the game has enough resources to render out all the text.</p>
</li>
<li>
<p><b>Pause Entities</b> &#8211; The last optimization I did was to add logic to correctly pause or suspend my entities when I needed to. Every time pause or game-over screens come up I still need to call draw on all the entities, but I added a flag to each one that lets the render loop know if it should pause or ignore the pause. This is helpful when you have menus that rely on entities to render out text or images but you want the rest of the game to be suspended behind the screen. Also, make sure you take into account any timers you may have running when the game pauses and restore them correctly or your game may get out of sync.</p>
</li>
</ul>
<p>While this may seem like a long list of optimizations you need to make to your game, realistically you should already be doing this kind of stuff in order to support other slower platforms such as mobile. Win8 is going to be a huge mental shift for desktop and Web developers since you can no longer throw anything at the application and assume it will run. Win8 is going to be on high-end hardware as well as low-end mobile devices, so it&#8217;s incredibly important for your game to scale accordingly. That means building for the lowest common denominator first if you want to have the broadest reach possible. Unfortunately, I have not been able to test my game&#8217;s performance on an AMR device, but all the optimization tips I have outlined above will help keep your game running smoothly on any device.</p>
<h2>MS-Specific Hacks</h2>
<p>I wanted to talk a little bit about some of the specific IE hacks I had to do in order to run my game. While Microsoft touts IE10, which is the backbone of HTML5 Metro apps, as being standards compliant there is a lot of gray area in their interpretation of &#8220;compliant.&#8221; While it is true that IE10 is light years ahead of IE8 and some aspects of IE9, the fact still remains that in order to access a lot of features WebKit browsers take for granted you will need to use MS namespaces in front of specific hooks in IE. The two biggest offenders are touch events and requestAnimationFrame.</p>
<p>I briefly talked about needing to use requestAnimationFrame above in my optimization section and, while this is becoming a standard across all browsers, MS still uses its own implementation of the feature via the msRequestAnimationFrame hook. While this is easily fixed with a polyfill and some conditional magic, the fact still remains that even with IE10&#8242;s support for some of the new standards being proposed as part of the HTML5 spec, you should still expect to have to preface your API calls with MS namespaces. </p>
<p>While requestAnimationFrame was easy to fix, adding touch events to an existing Impact game was a little bit more of a chore. IE does not support the WebKit implementation of touch events and has its own completely different API. This meant that I had to hack Impact&#8217;s input class specifically for IE10 on Metro. Here is a sample of how I was able to handle touch events:</p>
<p><code>addEventListener('MSPointerUp'...</code></p>
<p>and</p>
<p><code>addEventListener('MSPointerOver'...</code></p>
<p>I found this really annoying because, while touch events aren&#8217;t standardized yet as part of the spec, I consider mobile WebKit to be the standard seeing how iOS, Android and even BlackBerry all implement it. MS should have tried to build off the predominant API instead of introducing their own system. This means that you will not be able to support touch events out of the box or with a simple polyfill, so be prepared to have to tailor your touch events specifically to IE10 until Dominic modifies Impact&#8217;s core to support IE10 when it eventually launches.</p>
<p>The last MS-specific issue is that it&#8217;s incredibly difficult to determine what platform Win8 is really running on. Is it a touch device or does it have a keyboard? Is it a desktop or a mobile device? These questions are incredibly difficult to answer without doing a lot of testing and, even after polling the browser to figure it out, you still don&#8217;t have a clear idea of what the processing power of the Win8 device is. This means you need to support everything out the gate. So, when I would normally disable touch events on desktop and enable them on mobile WebKit, I just end up leaving all the events in because at any point you could turn a Win8 touch device into a desktop by docking it and adding a keyboard. Hopefully how to differentiate devices will become easier over time as MS fine-tunes the OS, but right now without any real devices to test with it&#8217;s going to be a lot of trial and error optimizing your games on all the different types of devices that will support Win8 at launch.</p>
<h2>Moving Forward</h2>
<p>While I focus on the trouble spot I had with porting over my game to highlight issues you need to take into consideration, I don&#8217;t want to overshadow how incredibly cool it is to actually get my HTML5 game up and running on a desktop with very little additional work. Most of the issues I had can be quickly patched in Impact and, if you are not considering doing multi-platform deployment with your Impact game, then it should be really easy to get your game up and running in no time on Win8. I was really blown away by the level of performance I was able to get out of my HTML5 Metro game right out of the box, and Microsoft really nailed the tools/workflow for creating Metro apps with HTML/JS. I couldn&#8217;t have asked for anything better and, over time as the tools and OS get refined, it&#8217;s just going to get better and better.</p>
<p>I am really looking forward to seeing how Win8 runs on ARM devices, and I think that it&#8217;s clear this is the direction MS wants to take the OS. Make it as fast and portable as possible. It should help liberate Windows from the desktop and give iOS a run for its money. I am confident that Microsoft will be able to get the performance of ARM devices to be impressive. Right now I am already getting 60 FPS on iOS in the browser with my Impact games, so I don&#8217;t see why ARM-powered Win8 devices will be any different. </p>
<p>Right now I would like MS to support more of the WebKit standards in order to help accelerate porting of existing HTML5 apps and games over to Win8. While they have made some incredible headway with IE10, all the MS-specific hacks I have to do in my game make me feel a little dirty inside. It also makes it incredibly hard to deploy my game on different browsers and OSs, which may also be MS&#8217;s intent. I didn&#8217;t hook into any of the WinJS APIs since they are tied specifically to Win8 and, since IE10 doesn&#8217;t run on Macs or Linux, you will always be stuck in Windows from development to deployment. If Win8 takes off then this will be a moot point, but right now the spotlight is on iOS and it&#8217;s clearly the leader of the pack. Most, if not all the clients I deal with, have iOS first Web strategies. MS is going to have a lot of convincing to do in order to win back developers who lived through the IE6 Web app days.</p>
<p>Hopefully it&#8217;s not too late for Microsoft to catch up but, given the number of Windows computers in the world, even if a small percentage of existing users adopt Win8 we will see massive gains in penetration numbers for the fledgling OS. That means the potential to distribute your app and monetize it is going to be incredible. I truly believe that Windows 8 is going to be the catalyst we have been waiting for to see HTML5 games come into their own. Since HTML5 Metro apps are as responsive as native C# apps, it&#8217;s an incredible opportunity to translate your Web skills into desktop development. Now is a great time to get ready for Win8&#8242;s launch, so start working on your HTML5 games now!</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/building-html5-metro-games-for-windows-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Adventures Talking About HTML5 Gaming</title>
		<link>http://jessefreeman.com/articles/my-adventures-talking-about-html5-gaming/</link>
		<comments>http://jessefreeman.com/articles/my-adventures-talking-about-html5-gaming/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 14:25:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=474</guid>
		<description><![CDATA[I&#8217;ve just returned from Toronto where I spoke and did a workshop at the &#8220;Future. Innovation. ...]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just returned from Toronto where I spoke and did a workshop at the &#8220;Future. Innovation. Technology. Creation.&#8221; (<a href="http://www.fitc.ca/events/about/?event=124" target="_blank">FITC</a>) conference. This marks my second FITC talk and is easily one of the most successful talks I have ever done! Not only did I get to speak about a topic that I am incredibly passionate about, but I ended up with a packed room for both my talk as well as my workshop. My workshop and talk were on my own experiences with HTML5 game development, and I wanted to share some highlights as well as give people my own insight to the future of HTML5 gaming.</p>
<p><span id="more-474"></span></p>
<h2>My Workshop</h2>
<p>On day one of the conference I did an &#8220;<a href="http://jessefreeman.com/workshops/" target="_blank">Introduction to HTML5 Games with Impact</a>&#8221; workshop. It was great to have another sold-out workshop with 30 registered attendees. This marks the fourth workshop I have done on this topic with my one at Microsoft&#8217;s New York office being the largest with over 100 registered attendees. I have full- and half-day versions of my workshops now and have ironed out all the kinks. </p>
<p>I split my workshop into two parts, theory and code review, with a break in the middle for lunch. The amount of material I try to cover is truly massive, and it&#8217;s next to impossible to do any live coding. I focus on teaching people how to think about game development, go over a real, fully functioning game and analyze why I set things up in specific ways so that when people leave the workshop they have everything they need to go home and continue their learning. I also hand out copies of my book so that people can go through all the code examples at their own pace after the workshop, and I encourage people to play with the supplied code during the workshop to get a feel for how everything works.</p>
<p>I have been thinking about turning this into a two-day workshop so I can have more time to let people experiment and actually make their own game. Since most of the people who take my intro workshop have never built a game before, I even had a person who never even coded before, it&#8217;s incredibly difficult to expect them to be able to make a game from scratch without going through all my material in-depth. Making games is not an easy task, which is why I also focus on how to think through an idea to make a game along with answer peoples&#8217; questions about how to build things in Impact.</p>
<h2>My Talk</h2>
<p>The day after my workshop I got to do an hour-long talk on &#8220;My Adventures in HTML5 Gaming.&#8221; This is the second time I have done this talk, and for FITC I gutted about 70% of my original slides and redid them from scratch. I was trying to do the entire talk off of my iPad, from slides to code examples, to show off how powerful HTML5 really is, but I just couldn&#8217;t pull it off in time so I simply ran the presentation from my laptop. As I have mentioned, I spoke to a packed room and being able to follow someone like Grant Skinner is an honor. Grant is really doing a lot to help push HTML5 forward. I, on the other hand, have narrowed my focus on the platform to a few specific areas, one of which is game development with the Impact framework. I wanted to share some of the material from my talk for those who couldn&#8217;t make it out in person to see me present.</p>
<p>I start my talk out with the following quote:</p>
<blockquote><p>&#8220;Success consists of going from failure to failure without loss of enthusiasm.&#8221;<br />
- Winston Churchill</BLOCKQUOTE></p>
<p>I love this quote, and it really highlights my experience trying to make games with HTML5 as well as development in general. I am not a professional game developer, and I wouldn&#8217;t argue that I am even a good game designer. I make this very clear in the beginning of my talk. I use game development in a much different way than most people would think. I have always loved making games but ended up doing agency and enterprise development for my day job. For me, games are one of the most challenging programing systems to build, and I use games to teach/push me to be a better developer. Whenever I learn a new language, I always start by making a game first and, when it comes to my day job, I use everything I have learned from games to help me be a better application developer. Game development teaches you how to simplify complex systems, optimization and advanced graphic techniques, all of which can be applied to any type of development, especially enterprise.</p>
<p>I have my talk broken up into five parts:</p>
<h3>Part 1 </h3>
<p>Game Design &#8211; In this part of my talk, I go over the basics of game design, what a Game Design Doc (GDD) is and tips on how to organize your own game ideas. I talk about how I use a game journal to keep track of the parts of games I play that I like as well as my daily code warmups. A code warmup is a 30-minute coding exercise I use to learn new techniques, try out new APIs or SDKs and vet out ideas while forcing myself to produce something in half an hour.</p>
<h3>Part 2 </h3>
<p>Why Use Impact? &#8211; In this part of my talk I go over why I chose Impact to make HTML5 games. Impact is incredibly powerful and one of the best JavaScript game frameworks out there. Most people dismiss it since there is a $100 licensing fee but, once you pay the fee, you get the source code, example games and a level editor, which is worth the price of admission. I also cover how modules, classes and extensibility work in Impact, which is helpful for those developers coming from ActionScript, Java or C# and looking for more structure in their code.</p>
<h3>Part 3 </h3>
<p>Automate Everything &#8211; In this part of my talk I go over how I use automation for my asset pipeline and creating deployment builds of my Impact game. I am a big proponent of building automation scripts for all my projects, especially in Photoshop, so I take some time to go over how I created a sprite sheet generator for Photoshop. I also talk about how I use Ant to build out versions of my game for the Web, iOS, Win 8 and the Chrome Web Store. Impact runs almost anywhere so, by taking advantage of the power of Ant, I am able to simplify generating each build I need for all the platforms I want my game to run on. If you are interested in learning more about how I use Ant with Impact, you should check out the post I wrote on my site called &#8220;<a href="http://jessefreeman.com/articles/automating-impact-builds/" target="_blank">Automating Impact with Ant</a>.&#8221;</p>
<h3>Part 4 </h3>
<p>Games I&#8217;ve Built &#8211; In this talk I go over the games I have built with Impact. I have four examples and talk about each one, what I learned from them and end with a project I have been working on in my spare time for a crowd-sourced rogue game called Tile Crusader. Here are some highlights of my games:</p>
<h4><a href="http://gamecook.com/games/ld22-alone/" target="_blank">Alone</a></h4>
<p><img width=470 height=265 src="/wp-content/uploads/2012/04/image002.gif"></p>
<p>Alone was created during my first Ludum Dare competition. The game is built around an Edgar Allan Poe poem and is devoid of any visuals except for the words themselves, allowing the players to imagine the game&#8217;s visuals in their own head.</p>
<h4><a href="http://gamecook.com/games/jetroid/" target="_blank">Jetroid</a></h4>
<p><img width=470 height=314 src="/wp-content/uploads/2012/04/image004.gif"></p>
<p>In Jetroid, you land on a planet to look for lifeforms and artifacts while trying to make it back to your ship before you run out of air. As you explore the underground caves, you will find power-ups (air, life and energy), new alien lifeforms and artifacts.</p>
<h4><a href="http://gamecook.com/games/resident-raver/" target="_blank">Resident Raver</a></h4>
<p><img width=470 height=314 src="/wp-content/uploads/2012/04/image006.gif"></p>
<p>Resident Raver is Super Crate Box meets Elevator Action. The goal of the game is to survive wave after wave of raver zombies that have taken over the dorms at FSU.</p>
<p>I spend some extra time talking about Resident Raver, since it is the example game I wrote for my book, and talk about how I built on top of the book example with more advanced level designs.</p>
<p><img src="/wp-content/uploads/2012/04/rr-map.png"></p>
<p>I also talk about some of the more advanced features of Impact&#8217;s level editor, such as setting up triggers and connecting entities together to create elevators and spawners.</p>
<p><img width=470 height=525 src="/wp-content/uploads/2012/04/image012.gif"></p>
<h4>Tile Crusader &#8211; Coming Soon</h4>
<p>Tile Crusader is a crowd-sourced, coffee break, rogue-like game that gives anyone the ability to pick up and play a random crusade in just a couple minutes. What makes Tile Crusader unique is that the players can also create their own custom levels to share with others.</p>
<p>Since this is an unfinished game, I talk about how I go from<br />
sketch to design to final HTML page.</p>
<p>My initial sketch:</p>
<p align="center"><<img width=247 height=328 src="/wp-content/uploads/2012/04/image014.gif"></p>
<p>My first design in Photoshop:</p>
<p align="center"><img width=254 height=223 src="/wp-content/uploads/2012/04/image016.gif"></p>
<p>Refining my first design in Photoshop:</p>
<p align="center"><img width=254 height=222 src="/wp-content/uploads/2012/04/image018.gif"></p>
<p>My final design for the game built out in HTML:</p>
<p align="center"><img width=272 height=222 src="/wp-content/uploads/2012/04/image020.gif"></p>
<p>The other thing that is interesting about this project is that I have connected the Impact level editor to WordPress so that each level of the game is basically a post, so I have created the first RPG blog ever!</p>
<p>Screen shot of Impact&#8217;s level editor inside WordPress:</p>
<p><img width=470 height=259 src="/wp-content/uploads/2012/04/image022.gif"></p>
<p>As you can see, I have been incredibly busy making games with Impact, but it&#8217;s important to remind people that making good games is not easy. It takes a lot of trial and error when you are starting out, and game design/development is like any skill, you need lots of practice before you become good at it.</p>
<h3>Part 5 </h3>
<p>What I Have Learned &#8211; The final part of my talk focuses on four bullet points of what I have learned while doing HTML5 game development. For the most part, they are self explanatory:</p>
<ol>
<li>JavaScript can be fun when you are making games.</li>
<li> HTML5 games are the future.</li>
<li>This is just the beginning; it&#8217;s only going to get better.</li>
<li>Be a leader, not a follower.</li>
</ol>
<p>I was never a big fan of JavaScript, but I have grown to enjoy it while making games. When learning new languages it&#8217;s important to find a fun project to explore how everything works, and nothing touches all parts of a platform like a game. When it comes to HTML5 games being the future, I illustrate how important the iPad is now. I can run all my games on the iPad from the browser and, while there are still issues with sound and performance, most clients aren&#8217;t interested in starting a new Web project unless it will run on the iPad. It&#8217;s only a matter of time before HTML5 games mature on the Web and we start to see the same proliferation of the platform as we did with Flash. We are still in the early stages of HTML5 game development, and I remember making games in Flash 4 with AS1 and how primitive that was. That was 13 years ago. In another three to five years HTML5 games will easily be on par with what Flash can do today, especially with accelerated canvas and WebGL.</p>
<p>The final part of my talk is the most important. Be a leader, not a follower. This really goes for anything but is especially important when it comes to HTML5. Those people who are pushing the technology forward, sharing what they learn and talking about it are the ones who will be ahead of the curve. Don&#8217;t wait for a platform to mature; there will always be something new and better to replace it. If you don&#8217;t have the luxury of pushing technology at your day job then spend your free time sharpening your skills. The way I see it is that if you are going to spend your valuable free time learning something new then have fun with it. For me having fun means making games!</p>
<h2>Conclusion</h2>
<p>It&#8217;s been an amazing experience to be able to travel and talk about something I truly love, which is making games. For me it&#8217;s all about following your passions, and people will notice and reward your for inspiring them. I am very grateful to have this opportunity to speak at conferences as part of my job at <a href="http://www.roundarch.com/" target="_blank">Roundarch Isobar</a>. A big thanks to <a href="http://twitter.com/phoboslab" target="_blank">Dominic</a>, for creating Impact, and for letting me give out free licenses of Impact at my workshops. It&#8217;s incredibly hard to find a balance between doing these workshops, my work responsibilities and being home for my family, but so far it has been working out. And, the best part about learning a new technology via building games is that I also get to sneak in some extra practice time on my game design skills. Please check out Impact, and I will be speaking at the end of May in San Francisco at the <a href="http://fluentconf.com/fluent2012" target="_blank">Fluent conference</a> if you would like to see my talk in person.</p>
<p>Also if you would like to see my slides I have them hosted on <a href="http://speakerdeck.com/u/jessefreeman" target="_blank">Speaker Deck</a>:</p>
<p><script async class="speakerdeck-embed" data-id="4fa00e9b111c07002200dbfe" data-ratio="1.299492385786802" src="//speakerdeck.com/assets/embed.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/my-adventures-talking-about-html5-gaming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dropbox For Developers</title>
		<link>http://jessefreeman.com/articles/dropbox-for-developers/</link>
		<comments>http://jessefreeman.com/articles/dropbox-for-developers/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 11:39:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=448</guid>
		<description><![CDATA[Dropbox has become an indispensable tool for almost everything I do on my computer as well ...]]></description>
			<content:encoded><![CDATA[<p class="c1"><span>Dropbox has become an indispensable tool for almost everything I do on my computer as well as my mobile devices. Dropbox is also one of the most powerful dev tools I use. One of the best features of using Dropbox is the ability to sync your code projects across multiple computers. In the following post, I will describe my Dropbox setup and go through the pros and cons of using Dropbox to keep all your projects in sync.</span></p>
<p><span id="more-448"></span>
<p class="c0"><span></span></p>
<p class="c1"><span>First off, let&rsquo;s talk about my computer setup. I have three main computers that I use on a daily basis: my desktop (27&quot; iMac), my laptop (11&quot; MacBook Air) and my work computer (15&quot; MacBook Pro). On these computers I am constantly switching between OS X and Windows 7. In addition to these three computers, I also have several different phones, that I use personally as well as for testing, and my iPad. Finally, I have a Windows 8 tablet, which I also do development and testing on. As you can see, I have a lot of computers I use daily, and trying to keep everything in sync would be a daunting task if it wasn&rsquo;t for Dropbox.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>After realizing how valuable Dropbox was to my workflow, I upgraded to the Pro account to get 50 gigs of space.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><img src="/wp-content/uploads/2012/04/image04.png" width="500"></p>
<p class="c1"><span>Also, between getting other people to sign up to gain free referral space and taking advantage of a few other offers, I was able to end up with 62 GB, which is more than enough for any dev you may be trying to do. If you haven&#39;t signed up for Dropbox yet, you can use my </span><span class="c4"><a class="c7" target="_blank" href="http://db.tt/WLGbhS3l">referral link</a></span><span>&nbsp;to get extra space when you sign up.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><img src="/wp-content/uploads/2012/04/image06.png" width="500"></p>
<p class="c1"><span>The biggest limitation for me is the fact that my MacBook Air can only hold so much due to its small SSD drive space. While you can limit which folders sync on your computer, I have noticed that, for the most part, my development files don&rsquo;t take up that much space. You can probably just get by with the 2 GB of free space you get when signing up.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>Once I was signed up and installed the software I just used the default folder location. I set up three main directories inside the Dropbox folder:</span></p>
<p class="c0"><span></span></p>
<ul class="c6" start="1">
<li class="c2 c1"><span>design &#8211; This is where I keep all my design work for my project, ideas I am sketching out and space to store images I like from the web for inspiration.</span></li>
<li class="c2 c1"><span>development &#8211; This is where I do all my development from. I&rsquo;ll talk about this folder structure next.</span></li>
<li class="c2 c1"><span>writing &#8211; This is where I keep all my writing. Everything from posts like these (if I am not using Google Docs) to ideas I have, game design docs and even the book I wrote.</span></li>
</ul>
<p class="c0"><span></span></p>
<p class="c1"><span>I also have a lot of other folders in Dropbox since I keep a lot of my files in there, but these are the main development folders I have set up.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>Let&rsquo;s talk about how I set up my development directory. Here is a screenshot:</span></p>
<p class="c0"><span></span></p>
<p class="c1 c5"><img height="252" src="/wp-content/uploads/2012/04/image08.png" width="212"></p>
<p class="c0"><span></span></p>
<p class="c1"><span>As you can see, I work on a lot of different platforms. Here are the most important folders to note:</span></p>
<p class="c0"><span></span></p>
<ul class="c6" start="1">
<li class="c2 c1"><span>sdks &#8211; This is where I keep installers, code libraries such as APIs for other services and any dependencies I would need to install to get my development environment to work on another computer.</span></li>
<li class="c1 c2"><span>tools &#8211; These are installers for tools or additional apps I would need to install on other computers.</span></li>
<li class="c2 c1"><span>web &#8211; This is the root of my web server for any HTML, PHP, JS, etc. work. Basically, anything that needs to run on a server, with the exception of node.js, which has its own folder, is hosted from here.</span></li>
</ul>
<p class="c0"><span></span></p>
<p class="c1"><span>Outside of these core folders, I simply create a new folder named after the platform I&rsquo;ll be working on. The goal of my development folder in Dropbox is to have quick access to all my projects on any computer as well as all the SDKs and tools I would need to set up a new computer if I had to.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>From here I can work directly from any of these folders in my IDE of choice. I&rsquo;ve tested lots of these IDEs and not had any problems moving between different computers or across each OS. Here is a list of some of the editors I use:</span></p>
<p class="c1"><span></span></p>
<ul class="c6" start="1">
<li class="c2 c1"><span>IntelliJ &#8211; For Android/Java dev.</span></li>
<li class="c2 c1"><span>Web/PHPStorm &#8211; For HTML, JavaScript and PHP dev.</span></li>
<li class="c2 c1"><span>Sublime Text &#8211; An excellent lightweight code editor.</span></li>
<li class="c2 c1"><span>Visual Studio &#8211; For Windows Phone 7 and Windows 8 dev.</span></li>
<li class="c2 c1"><span>Xcode &#8211; For iOS development.</span></li>
</ul>
<p class="c0"><span></span></p>
<p class="c1"><span>As I have mentioned, I&rsquo;ve not had a single problem working in any of the above IDEs from within my Dropbox folders. The only thing to be careful of is to make sure your IDE saves its project resource files within the project. You may have noticed directories such as .idea or .eclipse in the root of your project like this:</span></p>
<p class="c0"><span></span></p>
<p class="c1 c5"><img height="188" src="/wp-content/uploads/2012/04/image09.png" width="201"></p>
<p class="c0"><span></span></p>
<p class="c1"><span>As long as your editor keeps its settings in with your project, even if the folder is invisible, Dropbox still syncs them.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>You may also notice from the above screenshot that if you are using Git, or even SVN/CVS, for version control those directories are also part of your project folder, so Dropbox can keep those in sync as well. This is great because I always have the most up-to-date version of my code, regardless if I remembered to check the code in before I left for work or wherever I need access to it. Then I can commit my changes when I am ready from any computer. This solves one of my biggest issues with multi-computer development, which is keeping my version control commits in sync.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>Next up, I want to talk about how I handle running local servers and testing from my web folder. On the Mac I use MAMP and on windows I use XAMP, which are great one-click Apache, PHP and MySQL solutions. Normally you would use the default web server directory on your computer to host your files. I have actually set my Apache&rsquo;s root to my Dropbox&rsquo;s development folder&rsquo;s root like so:</span></p>
<p class="c0"><span></span></p>
<p class="c1 c5"><img height="252" src="/wp-content/uploads/2012/04/image03.png" width="383"></p>
<p class="c1"><span>Now you may be thinking, why not set this to my web directory in my development folder? If you remember back to how I break up my dev projects by platform, I tend to keep my Impact game dev in its own folder along with any Flash projects or, if I am doing PhoneGap in Xcode, I can launch any web content from within my entire dev directory from the browser. So when I launch MAMP, I am automatically taken to my localhost, which exposes all my projects:</span></p>
<p class="c0"><span></span></p>
<p class="c1 c5"><img height="380" src="/wp-content/uploads/2012/04/image07.png" width="339"></p>
<p class="c1"><span>So now my entire dev workspace is navigable via the browser, and when I navigate to a project with web content in it I can test it in the browser. This is critical for doing any kind of PhoneGap or Windows 8 dev where the entire project is all done in HTML/JS, and you can use your computer&rsquo;s browser to debug as you work much faster than trying to recompile the app on the simulator or device each build.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>Here is an example PhoneGap app I was working on called Room112 and wrote about on my site </span><span class="c4"><a class="c7" target="_blank" href="http://jessefreeman.com/articles/room112-phonegap-exploration/">here</a></span><span>.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><img height="288" src="/wp-content/uploads/2012/04/image00.png" width="365"></p>
<p class="c1"><span>As you can see, I keep all my PhoneGap code in www/ and, if I open the directory, I can test it out right in the browser:</span></p>
<p class="c1 c5"><img height="550" src="/wp-content/uploads/2012/04/image01.png" width="404"></p>
<p class="c0"><span></span></p>
<p class="c1"><span>When I am done testing, I simply go into Xcode and compile it to the simulator or my device. When I need to debug I do it all in the browser. I have found this to be one of the best workflows around and, to top it off, all my work is synced thanks to Dropbox.</span></p>
<p class="c0"><span></span></p>
<p class="c1"><span>Now, before I talk about some of the limitations of Dropbox, I want to talk about how I use my development directory to quickly install and share Android APKs to all my devices. Since I do all my Android work in my Dropbox directory, and Android allows you to install APKs from the Android Dropbox app, it&rsquo;s incredibly easy to immediately test new builds of your application without having to connect your device. Simply install the Android Dropbox app on your phone, navigate to your Android project folder and when you compile a new APK it is right there waiting for you:</span></p>
<p class="c0"><span></span></p>
<p class="c1"><img src="/wp-content/uploads/2012/04/image05.png" width="500"></p>
<p class="c0"><span></span></p>
<p class="c1"><span>This is also helpful if you are doing a lot of AIR for Android development. I even set up my Ant builds to generate output folders for each platform and can share that folder with other people who want to test my game so they always have the latest build:</span></p>
<p class="c0"><span></span></p>
<p class="c1 c5"><img height="114" src="/wp-content/uploads/2012/04/image02.png" width="203"></p>
<p class="c0"><span></span></p>
<p class="c1"><span>I have covered a lot of advantages of using Dropbox, but I want to cover a few of the issues I have had and some mistakes to avoid as you get used to this new workflow. Here are a few things to keep in mind:</span></p>
<p class="c0"><span></span></p>
<ul class="c6" start="1">
<li class="c2 c1"><span>While I have never had any issues with missing files or sync conflicts, this setup is not ideal if there is more than one developer working on a project at a time. </span></li>
<li class="c2 c1"><span>I would also avoid sharing a folder you are actively doing development in since the people you share it with have access to all your files but have to download every change you make. If you want to share compiled apps like APKs or IPAs for testing, just share the output folder for these themselves and only push out updates when you are sure they are stable.</span></li>
<li class="c2 c1"><span>Dropbox is not a backup solution or version control replacement. Once you delete stuff it&rsquo;s usually gone forever. You can pay for backup history but IDEs do lots of different non-destructive and destructive modifications to files and directories, so it may be a mess to try and sift back through any changes via Dropbox. Always use version control on top of your Dropbox solutions.</span></li>
<li class="c2 c1"><span>When conflicts do arise, Dropbox is smart enough to give the files the same name, but one will have a conflict identifier added to the filename so you can tell there was an issue. If you feel like some file has not correctly updated, make sure you check the folder in the OS and not in your IDE. Most project-based IDEs like Visual Studio and Xcode don&rsquo;t automatically add new files unless you manually include them in the project, so always check in the folder itself first.</span></li>
<li class="c2 c1"><span>Remember that in order to keep your projects in sync Dropbox needs time to download all the changes when you move to a new computer. Don&rsquo;t leave your IDEs open or in sleep mode on multiple computers then turn them on expecting all your changes to be there. Always make sure you give yourself enough time to download the latest files before doing any edits.</span></li>
<li class="c2 c1"><span>Some IDEs such as WebStorm do not store global settings like servers in the project folder. I have had issues moving from computer to computer and WebStorm not being able to remember the default server for uploading web files. This is usually an easy fix but frustrating if you move around computers a lot.</span></li>
<li class="c2 c1"><span>Pay attention to file paths, especially when doing cross-platform development like moving from Mac to PC because if your project has hard coded library dependencies there will be corruptions in your project. In IntelliJ, I tend to add Mac and PC paths to the project settings so if one fails it can still generally find the right library for the OS it is on. I also just group my project dependencies in the project itself since most IDEs use relative paths for files inside the project and that cuts down on most of the file system conflicts.</span></li>
</ul>
<p class="c0"><span></span></p>
<p class="c1"><span>While this may have been a long list of things to watch out for, and not a complete list by any means, I have found Dropbox for my development to be an invaluable tool that has mostly solved my biggest problem of keeping my projects in sync across all my computers and devices. I would make sure you start small if you want to give this a test and work your way up. I have done a lot of trial and error perfecting my workflow and, when something does blow up, it&rsquo;s not fun. As long as you go in knowing that something could happen if you are not careful you will do fine. Plus, there is nothing more gratifying than being able to turn on a computer, wait for all your changes to sync then pick up coding right where you left off. In some IDEs even your last open window and all your code history is saved into the project and synced automatically by Dropbox, which is truly amazing that one time you need to remember what you did at 1AM on the computer you left at home and you are in another state, which happens to me more times than I care to talk about.</span></p>
<p class="c0"><span></span></p>
<p class="c0"><span></span></p>
<p class="c0"><span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/dropbox-for-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Impact Builds With Ant</title>
		<link>http://jessefreeman.com/articles/automating-impact-builds/</link>
		<comments>http://jessefreeman.com/articles/automating-impact-builds/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 17:20:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=421</guid>
		<description><![CDATA[Impact is one of the most powerful HTML5 game engines out right now, and one I ...]]></description>
			<content:encoded><![CDATA[<p><a target="_blank" href="http://impactjs.com/">Impact</a> is one of the most powerful HTML5 game engines out right now, and one I have been spending a lot of time talking about via my book, workshops and even showing off with my recent games. One of the most attractive parts of Impact is just how versatile it is. You can deploy the game to the Web so people can run it in desktop browsers such as Chrome, Safari, Firefox and Internet Explorer, but also to a multitude of different platforms and app stores. In this post, I am going to talk about, not only how I apply my years of enterprise software development automation build skills to my own Impact games, but also show off some great time-saving features of build automation that will help you with any project you are working on.</p>
<p><span id="more-421"></span></p>
<p>One of the most important parts of setting up automated build scrips is reducing the amount of mistakes caused by performing repetitive tasks. Builds are probably one of the most complex things you are going to do in any project and they require machine precision. They are also incredibly hard to document or reproduce over and over again without a script. The problem of maintaining builds becomes compounded when you add in multiple platforms and platform-specific libraries or packaging.</p>
<p>But wait, isn&#8217;t Impact a JavaScript-based framework? You may be thinking that JavaScript doesn’t need compiling or packaging. While this is true, once you start trying to deploy Impact to multiple platforms you will quickly see how complex the process can get. In addition you have to “bake” your game, which compresses all your game JS classes into a single file before deploying to help cut down on load time as well as offer basic code obscuring. Let’s take a look at the process I normally follow when it comes to setting up an automated build script and how it applies to Impact.</p>
<h2>Target Platforms</h2>
<p>As I had mentioned, Impact runs on a plethora of platforms. Whenever I am faced with a project that has multiple deployments, even as simple as QA and production (Prod), I list out all the possible targets. Impact provides us with a lot of options, so let’s take a look at what platforms are supported in a little more detail:</p>
<ul>
<li>Desktop Browsers: Chrome, Safari, Firefox and Internet Explorer 9+</li>
<li>Mobile Browsers: iOS and Chrome for Android</li>
<li>Web Markets: Chrome Web Store and Mozilla’s soon-to-be-released Web Store</li>
<li>iOS Native: Impact allows you to compile your game natively for iOS</li>
<li>WebView Wrappers: AIR, PhoneGap and OS X using a native app with WebView</li>
<li>Windows 8: Windows 8 allows you to create native Metro apps with HTML5/JS</li>
</ul>
<p>As you can see, Impact is incredibly versatile and allows lots of options to deploy and monetize your game. Managing all these deployments can be a total nightmare. To help make sense of all the work that needs to go into supporting each platform, I created a matrix that can help identify the level of effort required to support each build:
<p><STYLE TYPE="text/css"><br />
table<br />
{<br />
    border: 1px solid grey;<br />
}<br />
td{<br />
    border: 1px solid grey;<br />
    vertical-align:top<br />
}<br />
</STYLE></p>
<table cellpadding="0" cellspacing="0">
<tbody>
<tr >
<td >Platform</td>
<td >Core Code</td>
<td >Packaging</td>
<td >Controls</td>
<td >Optimize</td>
<td >Notes</td>
</tr>
<tr >
<td >Web (desktop)</td>
<td >Main codebase</td>
<td >Bake and deploy directory</td>
<td >Keyboard</td>
<td >None</td>
<td >None</td>
</tr>
<tr >
<td >Web (mobile)</td>
<td >Disable sounds and keyboard controls</td>
<td >Same as Web deployment</td>
<td >Touch</td>
<td >Draw calls, particles and entities on-screen</td>
<td >Android has performance issues</td>
</tr>
<tr >
<td >Web markets</td>
<td >No changes</td>
<td >Needs manifest files </td>
<td >Keyboard</td>
<td >None</td>
<td >Chrome Web Store requires code to be zipped up</td>
</tr>
<tr >
<td >iOS native</td>
<td >Import iOS plugin, load iOS-specific sounds and disable keyboard controls</td>
<td >Needs to be deployed into an Xcode project</td>
<td >Touch</td>
<td >Draw calls, particles and entities on-screen</td>
<td >XCode project only needs the core game code and uses a JS wrapper file to instantiate the game, so there is no need to copy over the index files</td>
</tr>
<tr >
<td >Web wrappers</td>
<td >Should support desktop and Web features based on if the wrapper is for desktop or mobile</td>
<td >Each Web wrapper has its own project structure for Web content in order to run</td>
<td >Keyboard and touch</td>
<td >Same issues as desktop and mobile Web</td>
<td >PhoneGap requires routing sound via native bridge to support sound on mobile</td>
</tr>
<tr >
<td >Windows 8</td>
<td >May require wrapping game code inside of WinJS library if native features are needed</td>
<td >Deploy into HTML Metro app project in Visual Studio</td>
<td >Touch and keyboard</td>
<td >Unknown how ARM devices will run. Game engine needs to use msRequestAni-mationFrame vs setInterval for better performance</td>
<td >Windows 8 and Internet Explorer 10 don&rsquo;t support WebKit touch events</td>
</tr>
</tbody>
</table>
<p>Now that we can clearly see what we are working with, it is easy to go through each platform and decide if the level of effort has any return on investment (ROI). Creating these kinds of matrices are also helpful to keep track of platform-specific optimizations or modifications to the core application logic you will need to make. While the above matrix has been simplified greatly, I would suggest keeping a more detailed list in a spreadsheet or document depending on how complex your build gets.</p>
<h2>Creating An Ant Build</h2>
<p>When it comes to setting up an automated build script, there are a lot of languages you can choose from. I prefer Ant since it is easy to pick up, doesn’t require learning any other language, is portable, is installed by default on Macs and exposes all the power of the command line, which you will need for manipulating files on the operating system. If Ant isn’t your thing, I have used Maven, Python, PHP (which is what Impact actually uses for its bake script) and shell scripts. Everything I will set up in Ant should be portable to other build script languages, and I will focus more on the steps required to set up our build script instead of focusing so much on Ant itself.</p>
<p>If you don’t have any experience with Ant, let me give you a quick rundown of how it works. Ant is an XML-based wrapper for executing command lines on your computer. Anything you can do from a terminal or console can be run in Ant. One of the key advantages of using Ant is that, due to its XML markup, it makes it very easy to pick up and start working with. On the same token, XML is not great for logic and, as your build scripts grow in complexity, you will probably find Ant to be incredibly limiting and frustrating. For simple things like Impact, it is perfect.</p>
<p>One of Ant’s key features is grouping actions into tasks, which allows us to break out repetitive actions into reusable blocks we can call over and over again to minimize code duplication in our script. Now that we have a matrix of the supported platforms, we can look at our build process and break it down into tasks to find similar actions we may need to create individual tasks for. Let’s take a look:</p>
<ul>
<li><b>Cleanup</b> &#8211; This is a standard task that removes any files created from the previous build. You always want to run this type of task to make sure you don’t corrupt your deploy folder (where our final output will be copied to).</li>
<li><b>Post Build Cleanup</b> &#8211; Generally, when we are moving around a lot of files, we will create tmp folders to keep our script’s files separated from the main codebase and the final deploy directory. It helps to remove these temporary files once you are done with them.</li>
<li><b>Bake</b> &#8211; As I had mentioned earlier, Impact’s license requires that you bake your game so you don’t inadvertently distribute the source code, and it also allows you to merge all your JS files into a singe file. The bake script is run from the command line and is written in PHP. Luckily, Ant can execute PHP scripts as long as you have PHP installed in your system and are able to run them via the command line as well.</li>
<li><b>Web Build</b> &#8211; This will be our base build script. We will make sure that we clean up our final codebase to be deployed to a Web server. We’ll need to point our HTML page to load the baked JS files instead of the default impact.js and your custom game.js files. From here, we will also use this for our other builds since it is our baseline for creating a functional game.</li>
<li><b>iOS Build</b> &#8211; Since iOS has its own Xcode project, we simply want to copy over the core game code into that directory. The rest of the Xcode project will handle initializing the game on iOS and is not worth us trying to generate any of the iOS-specific wrapper files.</li>
<li><b>Windows 8 Build</b> &#8211; This is going to be similar to our iOS build. We only need the core game classes, and we’ll rely on the default Visual Studio project to handle setting up and initializing our game for us.</li>
<li><b>Web Store</b> &#8211; We’ll have two builds for our Web stores, one for Chrome and the other for Firefox. We’ll use our default Web build but handle creating the manifest.json file in Ant (another cool feature of Ant that allows you to write out text to a file). For Chrome, we’ll just zip up the final output so you can upload it to the market.</li>
<li><b>Full Build</b> &#8211; Once we have all our build targets set up, we can create one master target that will call on each one, in a specific order allowing us to automate the entire process of deploying to all these different platforms.</li>
</ul>
<p>Now that we have a plan for building out our Ant scripts, let’s go through each one and take a look at how the code will work.<br />
The Build Script</p>
<p>Setting up a Ant build is relatively easy. Each build script starts out the same way:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family: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: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Impact Ant Build&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;full-build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>As you can see, we give the script a name, set a base directory to its current directory and set a default target to get called. Right now we don’t have one set up, so if you tried to run this it would fail. Next we are going to want to set up some properties, which are variables we can use throughout our script to help centralize properties that would change on different developer’s computers at the top of the script.</p>
<p>We are going to start with the following properties, each one of them should be self-explanatory:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Project meta data --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.name&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;Resident Raver&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;company.name&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;GameCook&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;company.site&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://gamecook.com&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.version&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0.8.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;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.description&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;This is Resident Raver the Game!&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;project.url&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;http://gamecook.com/games/resident-raver/&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>As you can see, we are setting up the project-specific properties. These are the ones that would change from project to project. Things like project.name, project.version and project.description are required by the Web stores in their manifest files, but we can also use these values to name our final output as well as version it.</p>
<p>Next we need to set up some paths to where our files are:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Deployment directories --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;web.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${deploy.dir}/web&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;chrome.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${deploy.dir}/chrome&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;mozilla.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${deploy.dir}/mozilla&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ios.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${deploy.dir}/ios&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;win8.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${deploy.dir}/win8&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>As you can see, these represent all the directories we will be deploying our final game to. It’s important to note that when you see something wrapped in <tt>$()</tt> that it is a variable that can be used anywhere in the Ant build script. All these paths use <tt>$(deploy)</tt>, which is set up at the beginning of the property block.</p>
<p>Also, it is important to note that in your build script you would want to change the ios.dir and win8.dir to your Xcode and Visual Studio projects, respectively.</p>
<p>The final property we need to set up is Impact’s directory itself:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Path to Impact directory --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;impact.dir&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${basedir}/impact&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Now that we have our properties set up, we can start building out our targets. Let’s start with our cleanup and post build cleanup targets:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Delete deploy directory and create a new one --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;pre-build-cleanup&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${deploy.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${deploy.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Here you can see that we delete the entire deploy directory and then create a new one from scratch. Here is the post build target:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Removes the minified game from the impact directory--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;post-build-cleanup&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${impact.dir}/game.min.js&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pre<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>All we do here is remove the baked game files from our main code directory. The last thing we need to do before creating our first build target is to make a wrapper target to call the bake.php script:<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pre</span> <span style="color: #000066;">lang</span>=<span style="color: #ff0000;">&quot;xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- Run the bake script - you need PHP to be runnable from the command line. --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;bake&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exec</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${impact.dir}&quot;</span> <span style="color: #000066;">executable</span>=<span style="color: #ff0000;">&quot;php&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${impact.dir}/tools/bake.php&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;lib/impact/impact.js&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;lib/game/main.js&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;game.min.js&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/exec<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>As you can see, we are taking advantage of Ant’s exec method, which allows us to call a script from the command line. In this case, we are letting Ant know it will execute the script with PHP. The arg nodes supply additional information to PHP so it knows what to do, such as the script to run, the directories where our code lives and the final output file name.</p>
<p>We now have enough of a foundation in place to create our first build target for the Web:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;web-build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Copy over the impact directory to the deploy folder and ignore what is not needed. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sync</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${impact.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;weltmeister.html&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/tools/*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;**/lib/**&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sync<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- replace js source paths in HTML with minified game js. Make sure code is surrounded by &quot;source script&quot; comments so the regex can find it. --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;replaceregexp</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${web.dir}/index.html&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">match</span>=<span style="color: #ff0000;">&quot;\&amp;lt;!--source scripts--\&amp;gt;(.*?)\&amp;lt;!--end source scripts--\&amp;gt;&quot;</span></span>
<span style="color: #009900;">                   <span style="color: #000066;">replace</span>=<span style="color: #ff0000;">&quot;\&amp;lt;script src='game.min.js'\&amp;gt;\&amp;lt;/script\&amp;gt;&quot;</span> <span style="color: #000066;">flags</span>=<span style="color: #ff0000;">&quot;gs&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/replaceregexp<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- This will copy over debug CSS if game is running in debug mode. --&gt;</span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${impact.dir}/lib/impact/debug/debug.css&quot;</span></span>
<span style="color: #009900;">          <span style="color: #000066;">tofile</span>=<span style="color: #ff0000;">&quot;${web.dir}/lib/impact/debug/debug.css&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>I’ve commented on this before but wanted to call out a few things that are important. First, let’s just walk through what is going on here. We need to copy over all the files, so we use Ant’s sync todir call and pass it a fileset. Filesets are a way to organize copying over multiple files and exclude ones you don’t need. In our case, we don’t want to copy over the level editor HTML page and the tools or lib dir. Once the files are copied over, we will replace the two JS imports to point to the baked JS game code file. I am using a regex call here, and in my Impact project’s index file I had to set up a special comment block around my two JS imports so Ant could find and replace them. Here is what that looks like in my game’s index.html:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--source scripts--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;lib/impact/impact.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;lib/game/main.js&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!--end source scripts--&gt;</span></pre></div></div>

<p>This is a great trick if you have any other parts of a document you may want to modify via Ant but don’t want to set up complex regex searches. Simply wrap the code that needs to be modified with a comment block and search for that.</p>
<p>The last thing we do is copy over the debug.css file. This allows you to still publish a debug build of your game and see the debugger. Without this call, if you forgot to remove Impact’s debugger, it would appear messed up. In situations when you don’t have debug enabled, the CSS isn’t loaded.</p>
<p>Now that we have seen how to set up our Web build, let’s take a look at the Chrome Web Store build, which is similar but adds in creating a manifest file along with zipping up the entire project for distribution:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;chrome-build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Create chrome market app --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sync</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${chrome.dir}/tmp&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${web.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sync<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${chrome.dir}/tmp/manifest.json&quot;</span> <span style="color: #000066;">append</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        {
        &quot;name&quot;: &quot;${project.name}&quot;,
        &quot;description&quot;: &quot;${project.description}&quot;,
        &quot;version&quot;: &quot;${project.version}&quot;,
        &quot;icons&quot;: {
        &quot;16&quot;: &quot;images/icons/icon-16x16.png&quot;,
        &quot;48&quot;: &quot;images/icons/icon-48x48.png&quot;,
        &quot;128&quot;: &quot;images/icons/icon-128x128.png&quot;
        },
        &quot;app&quot;: {&quot;launch&quot;: {
        &quot;local_path&quot;: &quot;index.html&quot;
        }},
        &quot;homepage_url&quot;: &quot;${project.url}&quot;
        }
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/echo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;zip</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${chrome.dir}/${project.name}-${project.version}.zip&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;${chrome.dir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${chrome.dir}/tmp/&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>This build has a dependency on our Web target, but we will set that up later in our main build target. For now this target assumes the Web build exists and copies its contents to its own tmp directory called ${chrome.dir}/tmp. Once it is copied over, we create our manifest.json file via the echo file command. The append attribute flags the action to override the file if it already exists.</p>
<p>It’s important to note that we can still use build properties inside of the echo call so we can populate our manifest .json file with the project properties we set up earlier. Finally, once everything is in place, we zip the tmp directory, using project.name and project.version to name the file then delete the tmp directory. After this you can simply upload your game to the Chrome Web Store.</p>
<p>The rest of the build process is straightforward. I am not going to cover the other targets, but I do want to show you how I tie this all together with the full build target:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;full-build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Clean --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;pre-build-cleanup&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;bake&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;web-build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;ios-build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;win8-build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;chrome-build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;mozilla-build&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;antcall</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;post-build-cleanup&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>As you can see, I simply call all the targets in the correct order. There are lots of ways to set up something like this, especially if you just want to call a specific target without calling everything else, and I encourage you to look into the dependency attribute in Ant if you want to streamline this.</p>
<p>As for the rest of the targets, you can view the full build script <a href="https://gist.github.com/1889757" target="_blank">here</a>.</p>
<p>Finally, once you have the Ant build file created, simply place it in the root of your Impact project, open up the command line, cd into that directory and type out Ant. The default target will get called and you should see that all your deploys get created.</p>
<p><img src="http://jessefreeman.com/wp-content/uploads/2012/04/image00.png" alt="" title="image00" width="500" /></p>
<h2>Wrapping Up</h2>
<p>This is just the tip of the iceberg of what you can do by automating your build scripts. Like I mentioned at the beginning, this technique is useful for any kind of builds you may be doing. I have used this technique with Flash applications/games and even Android. Before I end this post, I thought I would give you some pointers on what the next steps would be from here:</p>
<ul>
<li>Cut down on target repetition &#8211; As you can see in my script (unless I have updated by the time you read this), I have the Chrome and Firefox manifest.json files being created in their own targets. It may make sense to just break that part out into its own target so I can call it whenever I need a manifest file.</li>
<li>Extract the properties &#8211; In more elaborate Ant build scripts, have their properties in a separate file called build.properties and have their build script import them by adding

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;build.properties&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>This allows you to have different property files on multi-team projects since the build script is checked in by each developer and you don’t want any custom settings to be overridden.</li>
<li>Break out each task into its own micro build XML &#8211; You can then import each file by adding them to your main build like so

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;import</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${includes.loc}/custom-build.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>This is a great technique to share custom build files across multiple projects yet have a fully customized main build script tailored to the project.</li>
</ul>
<p>There are a lot of resources out there about setting up and maintaining Ant builds. There should be enough in here to help you build a solid foundation on how to create your own build scripts for your next project.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/automating-impact-builds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Room112 &#8211; PhoneGap Exploration</title>
		<link>http://jessefreeman.com/articles/room112-phonegap-exploration/</link>
		<comments>http://jessefreeman.com/articles/room112-phonegap-exploration/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 17:18:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=349</guid>
		<description><![CDATA[Whenever I start to play around with a new technology, platform or framework I usually plan ...]]></description>
			<content:encoded><![CDATA[<p>Whenever I start to play around with a new technology, platform or framework I usually plan out a small and easy to complete project that tries to address some of features I am most interested in testing out. To vet out PhoneGap I decided to build a simple app called Room112 to keep track of my hotel room number when I travel. This exploration document outlines how I approached architecting my app but also some of the issues I ran into while exploring how PhoneGap works.</p>
<p><span id="more-349"></span></p>
<p align="center"><img style="float:left;margin:0 5px 5px 0;" src="/wp-content/uploads/2012/03/image07.png"/>Room112 is a simple way to keep track of your hotel room number. Enter your hotel room number into the app and the next time you open it the number is displayed for you along with the time you checked in, the floor your room is on and a map of the hotel&rsquo;s location. TripIt doesn&rsquo;t really track the last two bits of information. This app is just like the card a hotel would give you with your room number on it.
</p>
<h2>Goals</h2>
<p>I collaborated with <a href="http://arraymode.com/" target="_blank">Wesley Crozier</a> (who did all the artwork) on Room112 with the goal of creating a simple PhoneGap app that looks and feels as close to native as possible. I travel a lot and always forget my hotel address, room number and floor. I set the following goals when creating this application:
</p>
<ul>
<li>Create a simple one-screen app</li>
<li>Test our local storage</li>
<li>Make the app feel like a native iOS app</li>
<li>Have most design done via CSS3</li>
<li>Test out animation on mobile Web browsers</li>
<li>Take advantage of some simple jQuery</li>
<li>Understand how to set up and publish a PhoneGap app in Xcode</li>
<li>Display a Google Maps image via built-in GPS support</li>
</ul>
<p>The full source code for this project is availbile on github <a href="https://github.com/jessefreeman/Room112" target="_blank">here</a>.</p>
<h2>Architecture</h2>
<p>Room112 is very simple. When you launch the app it checks for saved room data. If no data exists you are taken to the check-in screen. If data does exist then the check-in card is displayed with the saved data. I also planned on being able to review past check-in data, but this feature didn&rsquo;t make it into the initial release.
</p>
<p align="center"><img width="490px" src="/wp-content/uploads/2012/03/image22.png"></p>
<p>Over the next few pages, we will discuss each of the application&#39;s screens based on the designs with functional notes on the logic.
</p>
<h3>Loading Screen/Background</h3>
<p>
    This represents the loading screen of the application, which is the same as the background image. </p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image05.png" width="320"><br/>Loading Screen</p>
<p>When the application is fully loaded, a small pocket is faded in to allow for easier masking of the check-in card animation.
</p>
<p align="center"><img height="80" src="/wp-content/uploads/2012/03/image11.png" width="320"><br/>Pocket Image</p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image09.png" width="320"><br/>Background Plus Pocket</p>
<p>Once the application is fully loaded, the two layers (background and pocket) work very well to mask off the card animations and offer up a little more depth to the design.
</p>
<h3><a name="h.g96gjfc6cgj3"></a>Before Check-In</h3>
<p>This is the screen you see after launching the app when no hotel information is saved. Simply enter a room number to activate the Check In button and save your data.
</p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image18.png" width="320"><br/>Before Check-in</p>
<p>During this process, the user is not able to actually check in until the room is entered. All other data is optional to make adding room data as fast as possible. Once a room number is added, the Check In button is highlighted and the user can save their data.
</p>
<h3><a name="h.f2m5ytt0ide5"></a>Check In</h3>
<p>When you have entered your hotel information you are ready to check in. The Check In button becomes active, allowing the data to be saved.
</p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image02.png" width="320"><br/>Checked In</p>
<p>One thing to note is that the date is automatically filled in before checking in. Again, the goal is to simplify the check-in process by not forcing the user to have to add information we can assume is going to be contextual to the check-in process. Also, the user can add their room number as well as a map to the hotel&rsquo;s location by pressing on the top part of the card at any time.
</p>
<p>Once the user checks in, the card slides down into the pocket and the Check In button is changed to a Check Out button indicating that the data is set. At this point, if the user exits the app and comes back, their data will be saved and re-displayed until they check out.
</p>
<h3><a name="h.umz4hldpaz1"></a>Check Out</h3>
<p>After you have checked in, you can edit your data at any time or check out. Checking out clears the card data and a new empty card is shown allowing the user to start the process over.
</p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image14.png" width="320"><br/>Check Out</p>
<p class="c4 c15">
<p>Once the user hits the Check Out button, they are asked if they are sure they want to proceed.</p>
<p align="center"><img height="159" src="/wp-content/uploads/2012/03/image06.png" width="358"></p>
<p>If the user gives the OK to check out, the card slides out of the pocket and off the top of the screen and is reset before a new card slides back down into view.
</p>
<h3><a name="h.rt50vg4du6yg"></a>Error Screen</h3>
<p>There is only one error state for the app, which is displayed when the app is unable to locate the GPS position of the check-in.
</p>
<p align="center"><img height="480" src="/wp-content/uploads/2012/03/image23.png" width="320"><br/>Map Error Screen</p>
<p>Error handling and messaging is done by swapping out images. The initial state of the application is to display the Add Your Location image. If there is a failure, the Could Not Locate Your Position image is displayed. If the location can be used, an image of the map from Google is loaded in on top of the display area.
</p>
<p align="center"><img height="84" src="/wp-content/uploads/2012/03/image00.png" width="296"><img height="84" src="/wp-content/uploads/2012/03/image01.png" width="296"><br/>Error Screen Details</p>
<h2>Code Review</h2>
<p>Due to the nature of this application, the codebase was architected to be as small and portable as possible. I did not break out the JS logic into classes and relied heavily on frameworks to help speed up my development. Let&rsquo;s take a look at what is going on under the hood.
</p>
<h3><a name="h.kgj1xvze43ba"></a>Application Structure</h3>
<p>For the most part the application is very flat. There is a standard www directory, which houses all the Web content loaded by PhoneGap. In that directory are my css, images, js and index.html files.
</p>
<p align="center"><img height="298" src="/wp-content/uploads/2012/03/image12.png" width="257"></p>
<p>In addition to the www folder, PhoneGap automatically adds all the needed libraries to run on iOS when you create a new PhoneGap template from Xcode.
</p>
<p align="center"><img src="/wp-content/uploads/2012/03/image15.png" width="490px"></p>
<p>It&rsquo;s important to note that once you create a PhoneGap project you will need to manually link the www directory into the project. Here is how the project looks in the finder:
</p>
<p align="center"><img height="104" src="/wp-content/uploads/2012/03/image26.png" width="200"></p>
<p>Notice the www sites outside of the Xcode Room112 project and how I tend to include my own design directory in the root to keep my source designs organized, especially when I check in a project.
</p>
<p>Let&rsquo;s take a quick look at each of the directories in the www folder.</p>
<ul>
<li>css&nbsp;- There are two css files, one for the base of the project and the other that has overrides for retina resolution graphics. I&rsquo;ll talk more about this in the next section.
    </li>
<li>images&nbsp;- This contains all the images the Web side of the PhoneGap application requires to display.
    </li>
<li>js&nbsp;- This contains all my JavaScript libraries. I am using the following libraries for this project:
<ul>
<li>jquery-1.7.1.min.js&nbsp;- to handle animation, changing data on the page, etc.
		    </li>
<li>jquery.animate-enhanced.min.js&nbsp;- allows jQuery animations to use CSS3 transitions where supported to help improve performance on mobile
		    </li>
<li>lawnchair-0.6.1.min.js&nbsp;- handles local storage
		    </li>
<li>phonegap-1.3.0.js&nbsp;- PhoneGap&rsquo;s APIs and native to JS bridge
		    </li>
<li>room112.js&nbsp;- application logic</li>
</ul>
</li>
</ul>
<h3>Room112 Core Code</h3>
<p>I designed the application to be a simple state machine. It handles three states: not checked in, checked in and checking out. From there I was able to manage the state changes and update the display accordingly. Here is a high-level overview of the app&rsquo;s functions and what they do:
</p>
<ul>
<li><b>onDeviceReady&nbsp;</b>- This is the main init function of the application. It handles setting up the initial visuals of the application along with requested saved room information from local storage via Lawnchair. Once everything is set up, the room card is animated in and the app is ready to be used.
    </li>
<li><b>loadGPS&nbsp;</b>- This handles making the request to the browser&rsquo;s built-in GPS API:
    </li>
<p><br/></p>
<pre>navigator.geolocation.getCurrentPosition(showMap, showMapError);</pre>
<p>I decided to use the built-in browser&rsquo;s GPS instead of the API provided by PhoneGap to help minimize any dependencies on their library. The call to navigator.geolocation accepts two callbacks, one for success and the other for failure. When the request is made, a pop-up is shown automatically to allow the user to accept permission to use the built-in GPS.
</p>
<p align="center"><img height="219" src="/wp-content/uploads/2012/03/image17.png" width="356"></p>
<li><b>showMap</b>- This is called when the GPS is able to find the user&rsquo;s location. It simply makes a request to Google Maps for an image and displays it at the top of the check-in card. The URL for the map is saved locally so the service doesn&rsquo;t have to be called when the app re-loads and the user is checked in.
    </li>
<p><br/></p>
<pre>cacheMapURL = &quot;http://maps.google.com/maps/api/staticmap?center=&quot; + coords.latitude&nbsp;+ &quot;,&quot; + coords.longitude&nbsp;+ &quot;&amp;zoom=13&amp;size=&quot;+width+&quot;x&quot;+height+&quot;&amp;maptype=roadmap&amp;key=MyGoogleMapsAPIKey&amp;sensor=true&quot;;
</pre>
<p>The method accepts a position argument that can be used to determine the coordinates the Google Maps API needs to generate the image. I also provide the image size manually so I can support standard resolution and retna.
</p>
<p align="center"><img height="133" src="/wp-content/uploads/2012/03/image16.png" width="362"></p>
<li><b>showMapError&nbsp;</b>- This is called if the GPS is unable to return a valid position to the application. I simply show the error image allowing users to try again later.
    </li>
<p><br/></p>
<p align="center"><img height="138" src="/wp-content/uploads/2012/03/image20.png" width="357"></p>
<li><b>addInputListeners&nbsp;</b>- This handles adding listeners for the buttons and other UI elements such as each input field. This allows me to listen for when an input field loses focus so I can call invalidate()&nbsp;in order to see what data has changed.</li>
<li><b>invalidate&nbsp;</b>- This method compares the data in the form to what has been saved. This allows the application to automatically save any changes made while checked in and also test if the user has entered enough information in order to check in.
    </li>
<li><b>updateDisplay&nbsp;</b>- This manages updating the action button based on the state of the application.
    </li>
<p><br/></p>
<p align="center"><img height="100" src="/wp-content/uploads/2012/03/image25.png" width="396"><br/>Before Check-in State</p>
<p align="center"><img height="100" src="/wp-content/uploads/2012/03/image21.png" width="396"><br/>Able to Check In</p>
<p align="center"><img height="100" src="/wp-content/uploads/2012/03/image13.png" width="396"><br/>Check Out</p>
<li><b>getHotelData&nbsp;</b>- This is a simple utility method for accessing saved hotel data from Lawnchair.
    </li>
<li><b>formAction&nbsp;</b>- This is called after invalidate()&nbsp;and simply switches between the application&rsquo;s mode methods: checkIn(), checkOut()&nbsp;and saveRoomData().</li>
<li><b>checkIn&nbsp;</b>- This is the default state of the application when no saved data is found upon launch.
    </li>
<li><b>checkOut&nbsp;</b>- This animates the card off the screen, calls resetCard()&nbsp;to clear the data and resets the application&rsquo;s mode method back to checkIn().</li>
<li><b>saveRoomData&nbsp;</b>- This is called when the user is checked in and they change any values in the form.
    </li>
<li><b>resetCard&nbsp;</b>- This clears the data on the check-in card while it is off-screen. This is called after the card is animated off the screen.
    </li>
</ul>
<h3><a name="h.3vrej9uoj0fo"></a>Design/Retina Display Support</h3>
<p>The application was designed with iPhone 4S Retina display support in mind. In order to do this you must provide two resolution images and a secondary CSS sheet to override the base image paths. This is relatively easy to set up.
</p>
<p><code>&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/normal.css&quot;&gt;<br />
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/retina.css&quot; media=&quot;only screen and (-webkit-min-device-pixel-ratio: 2)&quot;&gt;<br />
</code></p>
<p>As you can see, the initial CSS sheet is loaded and then we use a media query, which is supported on WebKit on iOS to detect if the pixel ratio is 2x larger. Here is an example of a low res image:
</p>
<p><code>#pocket<br />
{<br />
    background: url('../images/pocket.png') no-repeat;<br />
    background-size: 320px 80px;<br />
    width: 320px;<br />
    height: 80px;<br />
    position: absolute;<br />
    bottom: 0px;<br />
}</code></p>
<p>and the retina override:</p>
<p><code>#pocket<br />
{<br />
    background-image: url('../images/pocket@2x.png');<br />
}<br />
</code></p>
<p>It&rsquo;s important to note that in the base style we need to define the background size so that when the retina image loads it&rsquo;s not rendered at its native resolution. Here are the two images:
</p>
<p align="center"><img height="80" src="/wp-content/uploads/2012/03/image11.png" width="320"><br/>pocket.png 320 x 80px</p>
<p align="center"><img height="160" src="/wp-content/uploads/2012/03/image08.png" width="490px"><br/>pocket@2x.png 640 x 160px</p>
<p>All the images in the application have retina size graphics to support the higher resolution, and the difference visually on the device is noticeable. On a website, this approach would be problematic since we are loading both sets of images and would probably want to use a better solution so the application is only loading the right image to cut down on bandwidth. I didn&rsquo;t take this into account since it was a locally running app, but if the app is image intensive this could end up being a performance issue.
</p>
<p>Finally, there is some mobile WebKit-specific CSS code you should add to your style sheets as well to help make your app look and feel more native.
</p>
<p><code>&lt;!--<br />
* {<br />
    -webkit-touch-callout: none;<br />
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);<br />
    -webkit-text-size-adjust: none;<br />
    -webkit-user-select: none;<br />
}<br />
--&gt;<br />
</code></p>
<p>This allows you to hide the fact that your app is running in WebKit and remove highlight colors on taps and user selection on form elements. Also, adding the following metadata block will disable scaling and zooming, which is built into the WebView by default:
</p>
<pre>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width; initial-scale=1.0; user-scalable=0;&quot;&gt;
</pre>
<p>This extra line of CSS and meta tag will make your app run at native resolution and is important to have in your project&rsquo;s HTML code.
</p>
<h3><a name="h.qnnwfoy5cq1r"></a>Animation</h3>
<p>I chose to go with jQuery for the animation and ran into performance issues, which I will discuss later on. My reasoning for this was to make sure the app wasn&rsquo;t dependant on CSS3-specific animations that may not be supported on other platforms. To me this was a big concern even though I focused on an iOS app only, so if you have a clear understanding of where you application will be deployed to you may just want to go with CSS3 animations from the beginning.
</p>
<p>jQuery did allow me some additional control with call backs and delays, which I still don&rsquo;t find to be well supported with CSS3 animation right now, especially when you need to execute JS during a key point in the animation sequence.
</p>
<h3><a name="h.7r0ymcmpnsrr"></a>Local Storage</h3>
<p>I chose to go with a local storage wrapper framework called Lawnchair. Using local storage directly is relatively easy, but I had read good things about it and liked its implementation. It is very straightforward to set up a pointer to local storage by doing the following:
</p>
<pre>hotelData = new Lawnchair({name:'hoteldata'}, function (e) {console.log('Storage Open', this); });</pre>
<p>Then, at any point when I need to save data, I simply reference the Lawnchair instance and save my data out.
</p>
<p><code>var formData = {<br />
	room:$("#room").val(),<br />
	floor:$("#floor").val(),<br />
	date:$("#date").val(),<br />
	map: cacheMapURL<br />
}<br />
hotelData.save({key:"room", value:formData});</code></p>
<p>I save out my application&rsquo;s state to a simple JSON object, which makes loading and parsing the data very easy.
</p>
<h2>Development Workflow</h2>
<h3><a name="h.e9e27omcngaa"></a>Browser Prototyping</h3>
<p>I experimented with several workflows, the first of which was doing all my development locally and testing it out in Safari on the Mac. This allowed me to quickly prototype the application using the tools I was most comfortable with along with WebKit&rsquo;s built-in debugger. One of the biggest issues I ran into while testing was being able to simply debug my CSS and JS, which is incredibly difficult to do when running the PhoneGap application on the iPhone simulator.
</p>
<p align="center"><img height="499" src="/wp-content/uploads/2012/03/image10.png" width="364"></p>
<h3><a name="h.ha4dhp2wak"></a>Development in Xcode</h3>
<p>Once I was happy with the application and the way it ran in Safari, I moved the project over to Xcode. Development tended to slow down considerably for me since debugging issues and JS integration were difficult without better debug tools. The big downside to testing in Xcode is the compile time. While it isn&rsquo;t too bad, it does take a few seconds to go back and forth between the two environments.
</p>
<p>I did find Xcode to have good JS support and was even able to continue to use Xcode to write and fix my JS logic without much issue.
</p>
<h3><a name="h.st0zbrgxiinu"></a>Deployment</h3>
<p>Once you have everything set up in a PhoneGap project, your application runs just like any other iOS application. Technically, this is a native app, so you get to take advantage of Xcode&rsquo;s built-in support for setting up provisioning.
</p>
<p align="center"><img height="396" src="/wp-content/uploads/2012/03/image04.png" width="471"></p>
<h2><a name="h.6x7cyymjugaw"></a>Issues</h2>
<p>I ran into several issues that in the end made it hard for me to make Room112 feel like a native app. I have outlined a few of the issues below to help you address them in your own app as well as things to keep in mind when planning out your own development.
</p>
<h3><a name="h.w8ewccidswdz"></a>Animation Performance</h3>
<p>I ran into lots of issues trying to get native-looking animation using PhoneGap. At first my issue was the performance penalty of using jQuery for animation. Doing direct DOM-based animation is incredibly slow. There are lots of hacks you can do in order to force hardware-accelerated CSS3 animation on iOS, and it wasn&rsquo;t until I started using <a class="c8" href="http://playground.benbarnett.net/jquery-animate-enhanced/">jquery.animate-enhanced</a>&nbsp;that I began seeing better performance. Also, at some point everything slowed down on later builds and I was unable to debug.
</p>
<p>My suggestion for iOS is to simply use CSS3 transitions from the beginning and make sure you take advantage of the -webkit-transform: translate3d(0,0,0);&nbsp;hack, which is said to force all other CSS3 translations to be hardware-accelerated. This could also be problematic if you are trying to directly port over an existing mobile site to PhoneGap, which may not have support on other platforms for CSS3 transitions. I will probably continue to experiment with this to find the best solution with good fallback support to allow the code to be as portable as possible.
</p>
<h3><a name="h.m3j8maishddb"></a>PhoneGap Issues</h3>
<p>I was running into a lot of issues trying to disable the native scrolling of the Web page via JS. The only way I was able to fully disable it was to add the following Objective-C code to disable scrolling and bouncing directly in the PhoneGap WebView instance:
</p>
<p><code>UIScrollView* scroll;<br />
for(UIView* theWebSubView in self.webView.subviews){<br />
    if([theWebSubView isKindOfClass:[UIScrollView class] ]){<br />
        scroll = (UIScrollView*) theWebSubView;<br />
        scroll.scrollEnabled = false;<br />
        scroll.bounces = false;<br />
    }<br />
}</code></p>
<p>I ended up having to add this to the AppDelegate.m class, which is auto-generated by PhoneGap because the JS code to ignore scroll events didn&rsquo;t block the user from scrolling from inside a text field. This is a good example of how you may need to augment your PhoneGap app with native code when JS hacks simply don&rsquo;t work.
</p>
<p>I was also running into issues trying to access the Google Maps APIs and had to whitelist the URL in PhoneGap&rsquo;s .plist file, which is located in the native project.
</p>
<p align="center"><img height="252" src="/wp-content/uploads/2012/03/image19.png" width="254"><br/>Project -&gt; Support Files -&gt; PhoneGap.plist</p>
<p class="c4 c15">
<p>Once you have PhoneGap.plist open, simply go to the ExternalHosts property and add any URLs your application will need access to.
</p>
<p align="center"><img src="/wp-content/uploads/2012/03/image24.png" width="490px"></p>
<p>After that you shouldn&rsquo;t have any issues.</p>
<h3><a name="h.2vj7on39l82"></a>Alerts and Messages</h3>
<p>I ran into several strange issues with displaying alerts in my app. At first I was trying to avoid using the native PhoneGap hooks so I could continue to test my app in Safari on my computer, but when you call JS&rsquo;s default alert you&rsquo;ll see the parent page the alert is being called into.
</p>
<p align="center"><img height="150" src="/wp-content/uploads/2012/03/image03.png" width="360"></p>
<p>I wasn&rsquo;t really expecting this, and it certainly takes away from the native feel of the app. I tried to switch over to PhoneGap&rsquo;s built-in <a class="c8" href="http://docs.phonegap.com/en/1.5.0/phonegap_notification_notification.md.html">native alert message</a>&nbsp;bridge but had problems getting it to run. I was using an older version of PhoneGap, so hopefully updating it will fix the issue. Other people on the forums had similar issues with it as well.
</p>
<h3><a name="h.jjqhs4e5q3ep"></a>Graphics Issues</h3>
<p>I didn&rsquo;t run into many issues, but the few that I did see are slightly annoying. The biggest issue I noticed is after the application loads there is a split second flash of white, which happens when the WebView loads right after the loading image is removed and the index.html page&rsquo;s background hasn&rsquo;t fully loaded. I believe there are ways to keep the loader image up longer to smoothe out the transition, but that would have to be done in Obj-C and there isn&rsquo;t much you can do about it. This just means you need to pay special attention to the loading of your main page, especially if it is graphically intensive or requires a lot of JS to initialize.
</p>
<p>The only other issue I want to highlight was the difficulty I ran into with getting fonts to match up exactly with my Photoshop designs. At first I tried to do the entire design via CSS3 and use fonts where possible. I was unable to get the layout to match my PSD to my satisfaction and ended up using rasterized images instead for most of the UI. While this app would be relatively easy to localize, since I could swap out different images via CSS based on the default language of the phone, in a production application this would not be ideal. While CSS3 and browser fonts have come a long way, there is still a gap between what can be done in the browser versus Photoshop, so that limitation should be in the back of your mind when trying to figure out how to set up the visuals of your PhoneGap app.
</p>
<h3><a name="h.711ri0xp0oep"></a>Development Bottlenecks</h3>
<p>While I only focused on doing an iOS application, I have heard of issues building for Android. In addition, it became next to impossible to maintain a Web-only version of the app. So, while it would be ideal to be able to deploy the same code base to a mobile website and have the PhoneGap wrapper app for people who want to use native, you will end up having to modify each build for each platform.
</p>
<p>You could write a wrapper to emulate or disable the PhoneGap-specific JS logic so that your application would degrade better on the Web, but the level of work required to architect a single app that could run on the Web and in PhoneGap on all its supported platforms would be a huge undertaking. It&rsquo;s not impossible but I just don&rsquo;t think that it ends up being worth the level of effort. In that case you are better off defining blocks of code that are portable and spending the last 10-20% of your development customizing the code base to each platform.
</p>
<h2>Moving Forward</h2>
<p>While this was a fun little exercise to help me get up and running in PhoneGap and vet out Web-based app building, I still have a lot to do and learn.
</p>
<h3>Deploying to Multiple OSs</h3>
<p>The next steps are going to be getting this app to run on different OSs such as Android and Windows Phone 7. The biggest reservation I have with porting the app to other platforms is that each one has its own UI and navigation paradigm. While Room112 was designed according to what most iOS apps are starting to look like, using real-world textures to look photo realistic, this may look out of place on Android and Windows Phone 7. Luckily, I could easily swap out the CSS and images and quickly reskin the app; it&rsquo;s just extra work and platform-specific customization I don&rsquo;t want to do. This is just another problem with the dream of having a single app that runs and uses the same code base across multiple platforms.
</p>
<h3>iPad/Tablet Support</h3>
<p>I would also like to eventually support the iPad, tablets and other higher-resolution devices but would have to rethink my design approach. Right now the app doesn&rsquo;t warrant a larger-resolution design, but I would like to test out how to handle scaling up in a PhoneGap app. I may just try this on another project. Again, I hope it would be a few quick CSS changes, but most phone apps need to be rethought out for tablets so it would be interesting to see how much of the application logic I could keep and what the performance would be on larger screen devices.
</p>
<h2>Conclusion</h2>
<p>While this wasn&rsquo;t the most awe inspiring application I have ever built, it did give me a great opportunity to learn more about PhoneGap as well as how to style for iOS mobile browsers. All in all, while PhoneGap is easy to use and being able to leverage a Web Stack for development is a great advantage, it&rsquo;s also incredibly difficult to get a native feel and responsiveness most users would be expecting on iOS.
</p>
<p>I think if you approach your PhoneGap app understanding the limitations and pain points, you can actually produce something really polished and portable across multiple platforms. I wouldn&rsquo;t rule this out because over time, as devices get faster and support more HTML5 features, this may turn out to be a viable development solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/room112-phonegap-exploration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Four Days With Microsoft And Win 8</title>
		<link>http://jessefreeman.com/articles/four-days-with-microsoft-and-win8/</link>
		<comments>http://jessefreeman.com/articles/four-days-with-microsoft-and-win8/#comments</comments>
		<pubDate>Thu, 08 Mar 2012 20:39:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=322</guid>
		<description><![CDATA[Last week I was in Seattle for a meeting with Microsoft about Windows 8. I felt ...]]></description>
			<content:encoded><![CDATA[<p>Last week I was in Seattle for a meeting with Microsoft about Windows 8. I felt like I was the only &#8220;non-hardcore&#8221; Windows developer at this meeting. I met with some of the Win 8 evangelist team, engineers and other attendees. Here are my thoughts about Windows 8 and its appeal to developers looking to make apps for it as well as some of the challenges the new platform faces.<br />
<span id="more-322"></span><br />
<b>Win 8</b><br />
The new build of Win 8 is more complete than the developer preview. It’s an interesting concept, but I still find it incredibly clunky to move between the touch-centric Metro apps and the legacy Win 7 desktop experience. Microsoft needs to do a lot of work to make this seamless. Perhaps the most appealing part of the two environments is that you can have an iPad tablet-like experience on the go then dock it for a full Windows experience. During the event, I did all my coding and testing on the device. I think this is great as long as MS can sort out the problems switching between the different experiences.</p>
<p>Perhaps the most jarring part of the entire experience is the way that legacy Windows apps are contained inside of what would seem like a single Metro app, which you access via the desktop tile. So if you have Metro apps open and legacy Windows apps open, it becomes difficult to move between them quickly. There is a new dock that previews open apps on the left of the screen that sort of helps, but I found pulling it up difficult. I think over time these issues will be worked out but, in the end, having desktop support is simply a stopgap until more developers create Metro apps and the desktop eventually goes away. At least that is my take on it. I actually don’t have any idea what Microsoft’s goal is with Win 8 and future builds.</p>
<p><b>HTML5</b><br />
Microsoft is betting on HTML5 in a big way. You can build three types of Metro apps: C++, C# and JS/HTML. I honestly couldn’t tell the difference in terms of performance from JS/HTML apps and C# ones. I got to meet with the head of the compositor team who is in charge of rasterizing HTML and rendering it via the GPU. Internet Explorer 10 has full hardware acceleration, and this also translates into HTML Metro apps. For this reason, HTML5 apps are first-class citizens on the OS, and I would tell anyone who is interested in making apps for the platform to build them with JS/HTML and not bother with C++ or C#. I love C#, but what is the point if you can take advantage of HTML and JS, which are more portable? You can even write wrappers for C++ and access them via JS through WinJS (the Win 8 JS layer that runs HTML Metro apps).</p>
<p><b>WinJS</b><br />
While I was impressed with building Metro apps, I was not very happy that in order to get the best experience from your JavaScript app you need to build on top of their WinJS and IE10-specific HTML tags. MS keeps talking about how they are fully supporting Web standards, but every code example I’ve seen from animation to touch events requires -ms prefix selectors, which force you to use their version of the standard. Even worse is that WinJS only works on Windows, so you are locked into their platform. While I was able to get one of my HTML5 games up and running as a Metro app in less than 10 minutes, I needed to go through and rewrite parts of the underlying JS to run better on their platform. I feel like MS missed a huge opportunity to build a new rich Web UI framework that could have replaced Silverlight/Flex but chose instead to force developers to build apps for their OS and not the Web.</p>
<p><b>Potential</b><br />
I see a lot of potential in building Win 8 HTML Metro apps since my primary type of development is Web-based. Especially now as companies transition out of Flex and go deeper into writing HTML5 Web/mobile apps, all the skills, people and development practices required to build these new apps will help position them well for this kind of work in Win 8. This is good because most companies won&#8217;t have to hire specialized developers to build Metro apps. I am confident that building HTML5 Metro apps will be straightforward and that any competent JS developer would be able to optimize the app to run on WinJS if this is a port for existing Web sites/apps. The way I see JS/HTML Metro apps is like PhoneGap on steroids. So, theoretically, clients who are already heavily investing in HTML5 could quickly port their Web apps over to the Win 8 platform and use Metro’s components/controls to modify the views to fit within the Metro style.</p>
<p><b>Long Term</b><br />
Microsoft is betting on the fact that its Windows 7 user base is going to upgrade to this new OS. Even if they do, there is a huge disconnect between running Win 8 on a touch screen versus a desktop. That being said, people do buy new computers, so there will be a faster adoption rate than with their phones (which had most people locked into two-year contracts when they came out). If MS can get people to buy these new Win 8 devices, and the ARM-based tablets have enough power to be usable, then this will become a viable platform. The biggest hurdle in my mind is going to be finding the right price point. Basically, Win 8 tablets need to sit in the $200-$500 range, and there is no clear indicator if that will be possible. Also, MS is not very upfront about what classic mode apps will be supported on ARM. I am not convinced that it’s going to be as easy as recompiling an existing Win 32 app and it will work. ARM devices may have to rely heavily on Metro apps getting out of the gate until older software is updated and optimized for ARM, or those vendors simply decide to move over to Metro (which is probably the smartest move at this point).</p>
<p><b>Hardware</b><br />
The other thing working against Microsoft is hardware. Apple excels in the phone, tablet and computer space since they control &#8220;the entire widgets&#8221; and limit the choices consumers have to deal with. Microsoft is at the mercy of their hardware partners to come up with innovative devices to show off the OS. I don’t think consumers are going to find it easy to pick the right Win 8 device. Do they want a laptop, a desktop or a tablet? If they get a desktop should they get a touch screen? What is the performance difference between ARM and Intel/AMD? I guess Windows users are used to this, but I think that radically changing the entire OS to be touch first focused while the majority of the existing hardware out there isn’t that way is problematic. The hardware is going to need to be up to the task to deliver the best experience possible. I also don&#8217;t think I need to elaborate on the fact that Apple is just moving so quickly now in the hardware space, just check out the new iPad, and most companies will have difficulty catching up. The new iPad already highlights the lower resolutions these unreleased Win 8 devices will have. It will be interesting to see how quickly Microsoft can adapt.</p>
<p><b>Conclusion</b><br />
I spent some time going through Windows Phone 7 and doing development on it when it was announced. I loved the platform, the tools, the language and even the submission processes, but none of that helped make people buy the phones. It wasn’t until Nokia got involved that sales started picking up because they make really good hardware. I think Win 8 is going to live or die by its hardware. Granted, phones are a totally different beast, especially since most people get locked into a contract for two years. With Win 8, most people have Windows and can buy a new computer as needed, so the barrier or entry is much lower.</p>
<p>For developers who are currently doing HTML5 development, such as apps or games, it’s a no-brainer to make a Metro app. I do agree with the Microsoft evangelists when they say to simply sell your app to 1% of the existing Windows market and you will make a lot of money. I plan on releasing any app I would put on the Web or in the Chrome Market on Win 8, and I suggest that at the very least you do the same. Download the <a href="http://bit.ly/getwin8" target="_blank">consumer preview</a> and <a href="http://bit.ly/getwin8" target="_blank">the tools</a> and give it a try; I think you will be very impressed by how well HTML5 is integrated into the OS.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/four-days-with-microsoft-and-win8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Game Over: How Adobe Killed Flash</title>
		<link>http://jessefreeman.com/articles/game-over-how-adobe-killed-flash/</link>
		<comments>http://jessefreeman.com/articles/game-over-how-adobe-killed-flash/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 21:06:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=228</guid>
		<description><![CDATA[It has been a very interesting week in the Flash world. Who would have known that ...]]></description>
			<content:encoded><![CDATA[<p>It has been a very interesting week in the Flash world. Who would have known that the biggest deathblow to Flash would have actually come from the company that is responsible for it?  After announcing major layoffs, Adobe slowly started revealing their intentions to end Flash Player development on mobile browsers. Adobe tried to message that this was not going to be a big shift in their overall Flash roadmap but yesterday they reveled that Flex is being shelved and turned into an open source project after version 4.6.  Make no mistake, Flash is now a dead platform and here is why:<br />
<span id="more-228"></span><br />
First off, Flash has been on shaky ground ever since Steve Jobs called Adobe out Flash’s horrible performance and why it will never be allowed on iOS. He was 100% correct. Up until that letter, Adobe had basically sat on its ass and did nothing with Flash for almost 2 years after releasing Flash Player 9. Even before that Flash has failed miserably to make a dent in the emerging mobile market. Flash Lite was a total disaster and impossible to even develop anything of any value with. The Flash player was bloated trying to support 6+ years of new features. By the time Apple came in and changed the mobile phone market Adobe was so far behind with making Flash mobile friendly that it was way too late. The last 3 years of pushing Flash forward have basically been for nothing and honestly the performance Adobe was able to achieve was ok for Flash but a fraction of what an unskilled developer could achieve natively.</p>
<p>Next up is the fact that Adobe’s story with Flash has always been a VM that works exactly the same on any platform. The only problem with this story is that they never achieved it, even on desktops. For years Flash player was noticeably slower on Macs then PC. Adobe hardly supported Linux and the player was so buggy it was clear Adobe couldn&#8217;t care less about it. When Adobe started pushing Flash to run on Mobile, Apple locked them out and thanks to the fragmentation of Android Flash just could not deliver. By the time Adobe finally figured out how to get Flash to run decently on iOS via AIR they had lost performance on Android. The two mobile platforms were never in sync, nor would Adobe ever be able to keep them on par performance wise since they lack the resources to support hundreds of different mobile devices. When you have to spend more time optimizing your AIR app for one platform over the other, especially when your desktop/web code would run fine but fail on mobile (for good reason given the limited resources these devices have) it becomes a logistical nightmare to support fractured code bases of the same application.</p>
<p>Let’s not forget that Adobe was always far behind the native language and it took constant updates to the runtime just to support the most basic features of each devices. To accommodate this Adobe started supporting something called Native Extension where you mix native code in with your AIR project to roll your own solution for features Adobe didn’t support. For me this was the deathblow and clearly showing that AIR was a total failure. Why would I write native code that is not portable across each mobile OS and still try to maintain a horribly performing Flash application? There is no cost savings and as a develop you are now responsible for “patching” the runtime so if you don’t know the native languages you are basically screwed. It’s not like Adobe released a community site to share native extensions easily among developers so everyone is just forced to reinvent the wheel on their own projects. Native Extension is just another half-baked solution and one more nail in the runtime’s coffin.</p>
<p>On top of this Flex just wasn’t up to the task of being a mobile UI. Originally Adobe announced that they were going to create a new mobile friendly version of the Flex framework. They never delivered, instead they decided to try and patch the existing framework and optimize it for mobile. That may have worked except Adobe still hadn’t even finished porting over most of Flex’s components from 3.0 to 4.0. On top of that Flex is a total dog, even on a powerful desktop. You would think a company who had been trying to get Flash to run on mobile devices since Flash Player 6 on Pocket PCs would have been forward thinking enough to actually build Flex in a way that would eventually work on Mobile but they didn’t. It’s no surprise Adobe announced the end of Flex’s development yesterday. They just can’t support it. Between the fragmentation of Flash across mobile devices, and the legacy code they never addressed deep in the core of the framework Flex was dead way before most people even wanted to accept it.</p>
<p>What makes the end of Flex incredibly scary is how dependent most enterprises are on it. Adobe has nothing else to offer as a transition away from the framework. They are only now shifting focus to HTML 5, which is still years away from being on par with most of what Flex could deliver. Make no mistake about it, companies like banks, financial institutions all the way up to the government are now dependent on Flex. While Flex and Flash will limp on for some time there is absolutely no reason why they should or would invest more money in moving these products forward. Most companies will have to go into maintenance mode on these apps and start moving over to HTML 5. This will be incredibly expensive and time consuming especially in a period when most companies are struggling to stay in business due to the weak economy. </p>
<p>With nothing really ready to replace Flex companies have a tough choice to make and this will no doubt create bitterness and resentment towards Adobe over screwing them over. Smaller Flash agencies that haven’t hired resources for HTML 5 yet are going to have a hard time finding new clients who will be confident making Flash sites. Sure banners and micro sites will exist for years to come but if these clients haven’t given up on Flash yet over iOS, then someone needs to sit down with them and fill them in on the reality that Flash is not making a comeback. This resentment will tarnish Adobe’s name even more then Apple has and honestly at this point who would really trust Adobe to make development tools for HTML 5 or a new platform?</p>
<p>Flash Builder, formerly Flex Builder is horrible. It’s one of the worst pieces of software I own. It’s a shame when you are a tool company that can’t build tools for your own platform. For years other companies have been able to build much better IDEs for Flash such as FDT, IntelliJ and even Flash Develop, which is totally free. Adobe knows nothing about developer tools and it’s clear in Flash Builder, Flash Pro and Catalyst the poster child for complete and utter Adobe tool failure. I mean what do you expect? Its not like we have been telling Adobe what we need in the enterprise space for years… oh wait we have been but they continue not to listen to its own community. Ironically when I saw the tweets that Adobe had announced they are exiting the enterprise space I was shocked because I never considered them actively participating in it.</p>
<p>Let’s talk about community, or what is left of it? The biggest blow to Flash from the layoffs is the dismantling of the community teams. The one thing that used to keep me interested in Flash was its community but with the restructuring most of the people who I respected are gone so who is going to help message that things will be ok? I am watching all of Flash’s evangelists trying to keep people calm and maybe it’s just me but if you can’t see through their bullshit then you probably think Adobe is going to continue to really contribute to Flex when they open source. Now with Adobe’s Flash community gone, and no new community initiative to harness disgruntled Flash developers who have moved on what incentive do I have to keep my opinion to myself? Why would you even want to be involved with a company who’s Product Manager goes around calling other developers who try new technology douche bags? I guess I get the last laugh because this douche bag knew better and spent the last 3 years learning languages/platforms that will survive long after Flash is dead.</p>
<p>It’s about time Adobe showed its true colors. Adobe is just a company, they are not your friends, they don’t care about you, shit they don’t even care about their own employees. Nothing like gloating that Adobe will reach their 4th quarter financial goals after laying off 10% of their company. I feel bad for the people who were not laid off, if you think your job is secure guess again. As Adobe quickly starts shutting down more and more resources around AIR and Flash there will be more layoffs. The best part is that no one questions the leadership of their CEO because he is “trimming the fat”. Flash represents 4% of their revenue, why would they spend so much time, energy and resources on it when everyone hates it now? Finally they woke up and realized that Photoshop on a tablet is going to make more money for them then selling overpriced licenses of Flash Builder ever will.</p>
<p>The final deathblow to Flash is this new initiative to turn Flash into a gaming platform. I guess Adobe missed the memo but Flash was already a gaming platform despite their best efforts to not improve it over the years like everyone was begging them to do. All of the things we had been asking for such as a more robust language, multi-threading, GPU acceleration and better performance would have actually made Flash a gaming platform organically. Now Adobe has to shoe horn all of that crap in or just move over to a new VM. That would be fine except the advantage of Flash was that it is installed on basically every computer. A new VM means a new download and honestly no one is going to do it. The Metro version of IE on Windows 8 isn’t even going to support plugins. Unity is way better at delivering games and their penetration numbers are incredibly low. </p>
<p>Adobe is going to have a hard time selling Flash to game companies. Not after this PR nightmare, I mean what company in their right mind would trust Adobe or Flash? Adobe knows nothing about gaming, Flash gave birth to the casual gaming market and they completely ignore it while they were on the quest to build a better video player. Now that plugins are dead the last thing we need is a new game centric plugin. That is what my mobile phone is for and my tablet; casual games. When I want real games I turn on my Xbox or PS3. Mobile gaming is where the money is at now and Adobe still can’t get Stage 3d to run on mobile. They don’t even have tools to support a 3d workflow. Remember Adobe is a tools company, if they don’t have tools to sell they don’t make money from the platform unless they license it out and who would honestly pay for that? I am sure RIM is happy with that arrangement.</p>
<p>I could probably go on for days criticizing Adobe and what has happened over the past week. In the end it doesn’t matter because Flash is such a small part of my development now. I moved on long ago because Adobe just doesn’t understand developers. They never did and they actually killed a good thing. While they were too busy criticizing my loyalty they totally proved me right. You can only get away with abusing your community until they finally turn. Now with all the negative PR, the end of development of Flex and the general public’s negative image of Flash Adobe should have just declared it dead and made this easy. Don’t be fooled, it will take a long time for Flash to finally die. When it does I will not be there to morn its loss, I suggest you don’t be around for it either. Three years ago I started telling Flash developers to branch out, learn new languages and grow their skill set, I hope someone was listening.</p>
<p>I have started a google+ thread <a href="https://plus.google.com/u/0/113373098067901951782/posts/XuPzwou9X5i">here</a> to capture your comments and start a discussion around the Adobe announcements.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/game-over-how-adobe-killed-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 8: Fulfilling A 5 Year Old Promise</title>
		<link>http://jessefreeman.com/articles/windows-8-fulfilling-a-5-year-old-promise/</link>
		<comments>http://jessefreeman.com/articles/windows-8-fulfilling-a-5-year-old-promise/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 22:55:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=220</guid>
		<description><![CDATA[About 5 years ago I spent over a thousand dollars on a device called the Samsung ...]]></description>
			<content:encoded><![CDATA[<p>About 5 years ago I spent over a thousand dollars on a device called the Samsung Q1. It was part of a new group of devices called UMPC (Ultra Mobile PCs). The Q1, and other UMPCs like it, were simple slate devices, without a keyboard, required a pen for input and were around 7-8” inches. They all ran Windows XP, had incredibly weak processors, not enough ram, terrible battery life and were supposed to usher in a new age of tablet computing. It wasn’t until a few days ago that a promise Microsoft made to people like me who bought these UMPCs was actually fulfilled. With the announcement of Windows 8 at Microsoft’s Build conference it looks like we will finally see a new slew of devices that assume the role of the UMP but are powered by an OS that is up to the task. Even better, I have a front row seat to contribute to the success of this platform by creating my own apps and games for it.<br />
<span id="more-220"></span><br />
Now before I continue I should mention a few things. I am a die hard Apple user. My first computer was a Macintosh LC (which was the first color mac ever made) and growing up I never had a PC. I wasn’t a fan of windows and tried to avoid most of Microsoft’s software. The only time I caved in and bought PCs, outside of my time with UMPCs and a failed attempt at using a tablet convertible netbook, was when apple transitioned over to OS X. I eventually went back to Macs once OS X was stable all the software I used was finally ported over. Recently however, Microsoft has been impressing me enough to try their stuff. I ditched my iPhone for a WP7 and use Windows 7 on my iMac from time to time. I bring all this up so that when I talk about my impressions of Windows 8 you can get a sense of where I come from and that I am not an MS fanboy by any means. </p>
<p>The Build conference has been an almost life changing event for me. I don’t say stuff like this lightly. I have been a Web developer for the last 13 some odd years doing mostly Flash development. I also know several other languages and have been doing lots of native mobile dev lately. If you know anything about the tech community, you probably have an idea of Flash’s downward spiral right now. Before I went to Build I was in a state of dev limbo. I had no idea what I would be doing next and no languages or platforms were really exciting me. This past year I did some wp7 development and fell in love with C# and the tools but the market for wp7 users is too small to be worth me dedicating much of my time to. Well, that all changed at Build. I can’t remember the last time I was this excited about a platform and it’s all thanks to Windows 8.</p>
<p>As an entrepreneurial developer, I look at the potential growth of any platform I dedicate my time towards learning and developing on. Picking up a new language is a long and arduous process. Sometime it’s incredibly fun but it has to be rewarding at the same time. I want to focus my time on a platform that is going to have the largest reach and opportunity for financial gain. The way I see it, Windows 8 is going to be one of the largest developer centric platforms available when it launches. It’s hard not to get excited about the prospect of reaching millions upon millions of consumers via one of the most successful computer platforms ever. Being able to reach every person who buys a PC from the lowest end sub $400 desktop to the highest end gaming rig along with the new generation of slate and ultra portable laptop computers with a single OS is about as good as it gets for me. Even with the success of the iPad I find it hard to believe that desktop and laptop computers are going to just go the way of the dodo bird over night. Perhaps Windows 8 is the opportunity hardware manufactures have been waiting for to compete in both spaces at the same time.</p>
<p>For me, the greatest advantage of doing Windows development right now is Microsoft’s  “developer centric” approach to coding on their platform. What do I mean by developer centric? Take a look at the choice of languages you have at your disposal for building Metro Style apps. You can use C++ for the most processor intensive types of applications or games. There is C# for the Silverlight and WFP developers along with Visual Basic. These three languages share XAML for the display layer and come with a suite of components developers can take advantage of to help build consistent looking apps. For developers who can’t design, Metro is made for you. By simply using the built in components you get the default Metro look and feel in your app for free leaving more time for you to focus on what matters most, the code. </p>
<p>If those 3 languages aren’t your thing there is now HTML 5 which is treated like a native language in Windows 8. This opens up the flood gate to all the Web developers who are either transitioning out of Flash or have been JS/HTML developers this entire time. My big take away from all of this is that unlike Apple who forces you to use their language and tools, MS is actively trying to cater to the largest demographic of developers possible. With Win 8, I can pick the language that best fits my needs and skill level, I am not being forced into something I don’t want to do. The only downside is that their tools only run on Windows but since the apps you will be building run there as well it’s really par for the course.</p>
<p>When I originally bought my UMPC I desperately wanted to develop apps for it. Even back then I saw the potential of the slate form factor but the hardware and software just wasn’t there. Even if I could build an app for these devices how was I going to distribute it?  The market for UMPCs was incredibly small and there was no way I would ever make a profit. With a unified App store on Win 8, and given the reach of the platform, those fears are long gone. Plus, as WP7 continues to grow market share, being able to deploy basically the same application to mobile devices in addition to desktop and tablet/slate is incredible. </p>
<p>I could probably drone on and on about how excited I am to start developing for Windows 8. At Build I didn’t go to any of the after parties and was coding in my hotel room each night. The fact that they gave out a slate with Win 8 installed on it definitely helped. Even if you don’t have one of these computers, anyone can download a preview of the OS and start coding for it. While iOS is still proving to be an incredibly lucrative platform for developers it would be crazy to miss out on an opportunity like this when Win 8 launches. &#8220;Windows 7 has sold more than 100 million copies in six months which made it Microsoft&#8217;s fastest selling operating system&#8221; according to wikipedia. So if a few million people buy Win 8 devices when they come out and I am able to sell at least 100,000 copies of my app for a $1 in the first few months I would make a healthy chunk of change. Plus it’s not just about buying new devices, all of the millions of existing Windows users can simply upgrade and instantly help grow the platform overnight. That is probably the single most important path to success with Win 8 is that no new hardware is required, it still works on most modern computers everyone may already have. All I need to do now is be ready for the launch with as many great apps and games as I can come up with. As much as I would hate to have the competition, I suggest you at least give it a try. C# is an amazing language, Visual Studio is an incredible tool and Windows 8 has the potential to be a huge success.</p>
<p>I have started a google+ thread <a href="https://plus.google.com/113373098067901951782/posts/87qrZk4STcU" target="_blank">here</a> to capture your comments and start a discussion around the Windows 8 announcement.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/windows-8-fulfilling-a-5-year-old-promise/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interviewed By Brad Manderscheid</title>
		<link>http://jessefreeman.com/articles/interviewed-by-brad-manderscheid/</link>
		<comments>http://jessefreeman.com/articles/interviewed-by-brad-manderscheid/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 20:06:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=214</guid>
		<description><![CDATA[I was just interviewed by Brad Manderscheid on Google+ today and thought it would be good ...]]></description>
			<content:encoded><![CDATA[<p>I was just interviewed by <a href="http://twitter.com/#!/bmanderscheid" target="_blank">Brad Manderscheid</a> on Google+ today and thought it would be good to repost it here. You can also follow the conversation that followed <a href="https://plus.google.com/104551464417427348669/posts/cAVnmoFHwKM" target="_blank">here</a>.
<p><span id="more-214"></span></p>
<p><strong>What projects are you working on right now and what are you using to build them?</strong></p>
<p>I have been all over the place at Roundarch lately. I recently finished up a huge Flash project then went right into a native Android app and even had to help out on a custom WordPress project for the front end of an enterprise app. Outside of coding I am involved in pitches and research. There is a lot of mobile on my plate as well as HTML 5. Flash/Flex is not so common for me but people keep telling me it is still being asked for. I do try to pitch AIR for mobile when I get the chance since right now it is still the only multi-platform game in town that I feel comfortable with. Outside of that I always say go native but have even dabbled with PhoneGap a bit as a backup plan.</p>
<p>For my development I use IntelliJ. It’s the only IDE that allows me to go from Flash to native Android and not give me any problems. I am not a big Eclipse fan and find that while there are lots of plugins out there for it, most of them are unstable or conflict with other plugins. IntilliJ doesn’t have any of those issues, it just works. When I am doing HTML 5, JavaScript or PHP I use PHPStorm which is a scaled down version of IntelliJ without all other stuff you don’t need for web dev.</p>
<p><strong>You&#8217;ve worked on all types of projects, from enterprise-level applications to casual games. What area of development do you enjoy the most</strong>?</p>
<p>I really have a passion for making games. That is actually how I got into Flash but I quickly realized there was no money in it so I started doing agency/enterprise work. Now I focus 100% of my free time to making games for the web and mobile. I have a long ways to go before I will probably make a successful one but I need all the practice I can get. I am great at the technical part but I am still trying to find that magical formula for fun. Right now mobile is big, especially for casual games. It’s a good time to try and be part of the mobile indi/casual game market since trying to monetize web games was never that lucrative. Don’t get me wrong, devs can and have made livings off of Flash based web games but people are spending more time on their phones and tablets then their computer or TVs now a days.</p>
<p><strong>As a creative developer, do you think it&#8217;s necessarily bad to move back to a more dynamic, less strict language like javascript?</strong></p>
<p>At first I was really opposed to doing Java Script. After spending years understanding Classes, Design Patterns and building large scale web applications it felt like a total step back to the stone ages. Over the last two years I have worked very hard on being able to understand development and be language agnostic. It wasn’t until recently that I could look at a language and not try to compare it to ActionScript which is what I primarily worked with. Now that I have this perspective shift I see the strength and weaknesses of JS in a new light.</p>
<p>There are some aspects of the language that are truly freeing. Then I hit a wall because I still cling to the what I am comfortable with. In the end we all have to accept whatever the next language is with open arms. At least for now it looks like Java Script is what will take us in to the next cycle of web development while Flash slowly (or quickly depending on how you look at it) becomes even more specialized.</p>
<p>If you can keep an open mind while learning a new language you will pick it up a lot faster. It’s important to try and stay positive and challenge yourself with tasks you can accomplish. In the past I would bite off more then I could chew with a new language and flounder. With JS I am taking it nice and slow and at my own pace. Also having a solid IDE like PHPStorm or WebStorm which has code hinting is monumental in easing the burden of learning JS.</p>
<p><strong>A lot of people are uptight these days when it comes to technology discussions. Why do you think people get so defensive about a specific technology?</strong></p>
<p>I once had a teacher who said that when you do something more then 3 times it becomes a habit. Think about how much repetition there is in development. Programming is a very personal experience for people. In order to be good at a language you have to be close to it, speak it and understand it. Developers form a special bond with the platform they are working on and when something disrupts that balance they tend to lash out. I probably spend more time with my code then I do my wife, my kid, my family or my friends. That’s a lot of time to spend with something and you grow to love it.</p>
<p>Programming languages come and go, they all have their own life cycle. Not to get all spiritual on everyone but it does become like a religion to some people. It also doesn’t help that the companies that develop these products brain wash their user base into thinking their platform is the best one out there and sometimes go to great lengths to bring down the competition. It is all marketing at the end of the day, companies are selling developers a dream and it’s heard to stop drinking the kool-aid. I can clearly remember how hard Adobe’s stance was on Silverlight yet when Apple called them out for their own faults they cried foul.</p>
<p>There will always be those people who can’t move on or choose not to when a platform is nearing the end of its life cycle. There was a huge rift between Director and Flash developers until it was clear that Flash was going to be the winning platform. Adobe still supports Director to some extent so these things die slow and painful deaths. Sometimes it’s hard to see the end of a platform because as more people move away from it there is an over abundance of work since less and less developers are around to do it. Eventually that work becomes maintenance and who wants to be the last one at the party. I guarantee if you can find director work you will be highly paid, not because it’s “in” but because everyone is out.</p>
<p>In the end you need to look past the marketing and find the platform that is right for you. Some people pick languages that have no commercial value simply because they are fun. Others go where the money is. The worst thing we can do is be critical of other languages or developers who chose to explore new languages. This is exactly what is going on in the Flash community and it will be the thing that tears it apart. What is even worse is that Adobe is doing little to help ease the rift between those who feel abandoned and the ones who are still making a living with it. </p>
<p>Eventually when a company doesn’t see a return on investment for a platform it gets canned and everyone feels cheated. Even bringing this up and making people nervous about it sparks all kinds of emotions. Just look at how large of an ecosystem depends on a development platform and you can see there are a lot of things at stake when it is threatened. People lose their jobs, their entire living could be flushed down the toilet just because a company failed to maintain it’s hold on the market.</p>
<p><strong>Do you still prefer WP7 as your main device OS and are you developing for it?</strong></p>
<p>Yes, my main phone is still a WP7. In my opinion it is the best OS out there right now. I also loved developing on it. I have not done much Objective C but between Flash, JavaScript/HTML5 and Java for Android, C# was the best language to develop with. The tools are top notch, especially when you add ReSharper to Visual Studio and the Mobile platform is well architected. Unfortunately I have not had much time to build another WP7 app but I think about it whenever I start a new personal project. Microsoft has a huge hill to climb when it comes to getting the adoption rate up and this is not a battle they can just throw money at like they did with Silverlight. MS is really going to have to innovate the platform and that is exactly what they have been doing so far. WP7.5 looks amazing and they are really pulling away from the heard of mobile OSs.</p>
<p><strong>Adobe Flash is still very widespread, but the tools and support are arguably lacking. C# and Visual Studio are obviously amazing, but its products lag behind. What can either of these companies do to help perfect that cycle?</strong></p>
<p>One day I am going to sit down and finish this series of articles I have been wanting to do where I talk about how I would run companies like Microsoft, Adobe, RIM and others. To say that Flash’s tools are lacking is an understatement. Just look at 3rd party IDEs like FDT and IntelliJ and you will see how far behind Adobe is on their own platform. Even worse is the fact that Unity 3D will be compiling to Flash so that will be the only real solution for a 3D IDE for Flash. Adobe continues to dump so much money into Flash Builder yet a much smaller team maintains IntelliJ which handles countless languages with ease. Adobe doesn’t have a strategy for building developer tools, and the fact that all of their IDE’s still don’t work together is a clear indication on how dysfunctional their future vision for their products is.</p>
<p>Adobe needs to learn how to become a developer IDE company or buy a company that understands what developers want. Microsoft is the exact opposite, they build the best development tools out there, they treat their developers with respect and actually listen to what they want. That kind of dedication to their community really shows through in the tools, the language, and the entire platform. The only problem MS has is that they like to kill off their platforms as soon as they mature. WFP to Silverliight, Silvelright to HTML 5, who knows what’s next? They are a wild card right now with this move to Windows 8 being JS and HTML based. We’ll have to see what they are planning on doing with C# and .Net in September at their Build conference. I’ll be there of course, I think they have an ace up their sleeves. As for Adobe if they can’t migrate Flex over to being GPU accelerated through Stage3d in the next 2 product cycles they will lose any foothold they hope to make in the mobile space. By the end of the year every major mobile language will be hardware accelerated except for Flash.</p>
<p><strong>If you could choose one programming language to rule them all, RIGHT NOW, what would it be?<br />
What&#8217;s next for Jesse Freeman?</strong></p>
<p>If I had my choice it would be C# but the reality is that I will most likely be doing JavaScript and HTML 5 for the next few months. There is a lot of posability there and it has the largest potential penetration numbers plus it runs on iOS (to some degree). Right now it’s all about iOS and I am really feeling the itch to learn some Objective C but I keep holding out for Adobe to get its act together. There is an interesting space growing with HTML 5 to Native packagers and some of them even offer native Open GL replacements for canvas. I think the person who figures out how to cross compile JS and still allow it to run on the web is going to be the winner. I have a feeling that Microsoft will be first to market with that. I dream of a C# to JS compiler that is usable. JS should not be written by hand, it’s a language that screams to be generated and I have yet to be impressed with Coffee Script.</p>
<p><strong>Let&#8217;s wrap it up with 5 TRUE / FALSE questions:<br />
Canvas games will overtake Flash games by 2013?</strong><br />
False</p>
<p><strong>WP7 will eventually take off and Visual Studio will be on all of our computers.</strong><br />
True (If every computer is a PC)</p>
<p><strong>Adobe AIR will become a wildly popular solution for cross-device development.</strong><br />
True</p>
<p><strong>People will eventually get along and start being creative again.</strong><br />
False</p>
<p><strong>Apple is evil.</strong><br />
True</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/interviewed-by-brad-manderscheid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started With HTML 5, JavaScript And Canvas</title>
		<link>http://jessefreeman.com/articles/getting-started-with-html-5-javascript-and-canvas/</link>
		<comments>http://jessefreeman.com/articles/getting-started-with-html-5-javascript-and-canvas/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 20:41:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://jessefreeman.com/?p=190</guid>
		<description><![CDATA[For the past month I have been digging deep into HTML 5, especially building games in ...]]></description>
			<content:encoded><![CDATA[<p>
			For the past month I have been digging <a href="http://vimeo.com/channels/221777" title="HTML 5 Videos" target="_blank">deep into HTML 5</a>, especially building games in JS and Canvas. I have been fighting having to go back to JavaScript, especially since I have grown to fall in love with languages like Java and C#. It wasn’t until I went to<a target="_blank" href="http://sebleedelisle.com/">&nbsp;</a><a href="http://sebleedelisle.com/">Seb Lee-Delisle</a>’s<a href="http://sebleedelisle.com/training/">&nbsp;</a><a target="_blank" href="http://creativejs.com/">Creative HTML 5/JavaScript</a>&nbsp;workshop here in NYC that my fate was sealed.
		</p>
<p><span id="more-190"></span></p>
<p>
			I’ve known Seb for a few years now and have been a big fan of his work even longer. One of the reasons I decided to take this workshop was a desire to become more familiar with the new concepts going on in HTML 5 revolving around Canvas and WebGL. Seb is a great presenter. If you have seen him at any of the hundreds of conferences he speaks at each year you already know what I’m talking about. Seb&nbsp;has a great way of simplifying complex concepts like “maths” (as he calls it) and making it approachable by design-centric developers like me. Granted, a lot of the math covered is common knowledge, or at least is to me because I have been a Flash developer for the past 10 years, but it was really great to see how all of my Flash skills still directly apply to all the new HTML 5 and JavaScript.
		</p>
<h2>What I Learned</h2>
<p>
			Seb’s workshop is action-packed with a ton of code samples and demos. Here are a few things we covered:
		</p>
<p>
			Particles. Yup, Seb is the Particle King. For the past few years, he has always shown off how versatile particle systems were in Flash. It was great to get a refresher course on how to do them with Canvas, and some of the techniques he showed off are simple yet powerful ways to achieve really rich visuals. Here are a few of my particle experiments:
		</p>
<p align="center">
			<img height="223" src="/wp-content/uploads/2011/07/image01.png" width="207">
		</p>
<p>
			After the basic introduction on how particles work, I quickly built a confetti fountain.
		</p>
<p align="center">
			<img height="134" src="/wp-content/uploads/2011/07/image02.png" width="150">
		</p>
<p>
			From there, I accidentally created a particle WiFi signal. A big part of the workshop revolves around exploration time.
		</p>
<p align="center">
			<img src="/wp-content/uploads/2011/07/image04.png" width="500">
		</p>
<p>
			Soon after the basic particle system introduction, we began working on more complex things like explosions. A great tip on how to get the trails is to repaint the canvas with a slightly transparent fill versus a full clear.
		</p>
<p>
			After particles, Seb went into more complex uses for drawing such as drawing trees. It may not sound very interesting at first, but it’s a key skill to learn because it teaches you recursion and how the rotation system works in Canvas. With Canvas, you actually rotate the entire coordinate system when you perform a rotation, kind of how it works in Processing. Seb does a good job of explaining this concept; it helps to think of it as a real canvas so you can rotate it to help make drawing easier. Canvas has a save and restore system so you can save the previous coordinate state, rotate to do your drawing, then restore it to the original state. This is probably the steepest learning curve when drawing with Canvas versus Flash’s system.
		</p>
<p>
			From there, we moved onto the building blocks of asteroids, which is a Seb staple from his Flash presentation days and probably the best real-world and fun thing do to with a drawing API. Here is my attempt at making some graphics for asteroids:
		</p>
<p align="center">
			<img height="439" src="/wp-content/uploads/2011/07/image00.png" width="500">
		</p>
<p>
			Seb presents you with round asteroids, and it’s your job to make them look more random and irregular. It takes awhile to get used to Canvas&#8217;s orientation system, but the best part of the exploration time is accidentally coming up with cool things.
		</p>
<p align="center">
			<img height="89" src="/wp-content/uploads/2011/07/image03.png" width="101">
		</p>
<p>
			Another cool exercise was creating a thruster effect for the ship. Seb has an interesting use for<a target="_blank" href="http://www.java2s.com/Tutorial/JavaScript/0040__Operators/Modulus.htm">&nbsp;</a><a target="_blank" href="http://www.java2s.com/Tutorial/JavaScript/0040__Operators/Modulus.htm">Modulus</a>&nbsp;in order to control and reset the length of the flame as the thruster burns at full blast.
		</p>
<p>
			After asteroids, Seb goes into building a simple 3D engine and eventually into Mr. Doob’s<a target="_blank" href="https://github.com/mrdoob/three.js">&nbsp;Three.js</a>,&nbsp;which is a great 3D engine for JavaScript. The highlight of the 3D presentation was seeing the speed difference between Three.js’s Canvas implementation versus the WebGL version. WebGL is a serious contender in the 3D space, and when/if other browsers actually implement it as well as Chrome has, it will be a very impressive contender to dethrone Flash. Unfortunately, or fortunately, depending on how you look at it, that day is very far away.
		</p>
<h2>Conclusion</h2>
<p>
			If you are at all interested in HTML 5 Canvas, JavaScript, and WebGL, I highly suggest checking out this workshop. It is really perfect for Flash developers looking to transition into the HTML 5 world, and you will be relieved at how much is actually the same. You may also be shocked, like I was, that most of this is old hat by now and hopefully you will be less de-motivated than I was to be revisiting all of these concepts after mastering them several years ago. Seb is a great presenter and probably one of the only people I know who is perfect at giving a class like this. Check out his site for the next workshop time/date/location, and if you want to see how the classes evolve, make sure you follow the<a target="_blank" href="http://twitter.com/#!/search/creativeJS">&nbsp;</a><a target="_blank" href="http://twitter.com/#!/search/creativeJS">#CreativeJS</a>&nbsp;Twitter tag when a workshop is going on.
		</p>
]]></content:encoded>
			<wfw:commentRss>http://jessefreeman.com/articles/getting-started-with-html-5-javascript-and-canvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

