16 November 2015

Eleven Fifty Academy

Last week I was fortunate enough to join with the two Daves from getfretless and help them to teach a group of developers the core concepts of angular.js and node.js.
This was a full five-day course where most students stayed and learned for more than 8 hours per day at the campus of the Eleven Fifty Academy.
I had a wonderful time helping students create a real application with a Node.js REST API, and well constructed angular front-end. I will be continuing to teach courses like this in the future at Eleven Fifty and hope to have many more classes that were as receptive and eager to learn JavaScript as this one. Thanks to the class for a great week.

16 September 2015

Introduction To React - Officially Published!

It has been a while since I posted that I was writing a second book, Introduction to React. Today it is officially available in both ebook and paperback formats. I hope you enjoy reading the book and the introduction to React as much as I enjoyed writing it.



Introduction to React teaches you React, the JavaScript framework created by developers at Facebook, to solve the problem of building complex user interfaces in a consistent and maintainable way. React.js shrugs away common front-end conventions in an effort to make things more efficient – use Introduction to React to learn about this framework and more today.

You will learn what React is, and why it was created to solve the problems it does. You will get to know the React API, and be introduced to React’s specific JavaScript extension, JSX, which makes authoring React components easier and maintainable. You will also learn how you can test your React applications and the tools you can use while building. Once you understand these core concepts, you can build applications with React. This will help you cement the ideas and fundamentals of React and prepare you to utilize React in your own use case.

What you’ll learn

How to use React to maintain complex user interfaces in an efficient way
How to integrate existing user interfaces and move forward with React
How to manage application architecture using Flux
How to easily utilize JSX, React’s JavaScript extension

Who this book is for


Introduction to React is for a web developer who is comfortable writing JavaScript and CSS. You will apply JavaScript to build web pages that utilize the paradigm shifting React framework. Introduction to React will provide you with the tools to create maintainable complex user interfaces.




15 September 2015

Trying to Run React Native Android on Windows

React Native for Android was released yesterday. As soon as I spotted the release I wanted to give it a whirl on my work PC. I did the npm install and got started right away, only to find that the init command was failing. I expected this because officially React Native isn't supported on windows but there is this master tracking issue for this in Github =>  https://github.com/facebook/react-native/issues/2693 ... anyway.. so I got an error:

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm ENOENT
    at exports._errnoException (util.js:837:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)
    at Function.Module.runMain (module.js:477:11)
    at startup (node.js:117:18)
    at node.js:951:3

Not being one to give up right away I wanted to fix it. I noticed from the error message that the spawn of npm using ('child_process').spawn was causing the error. Luckily, npm contains several modules that can be a drop-in replacement for this and I just grabbed the module cross-spawn. I needed to fix this inside the react-native-cli/index.js file.

This fixed this first error. Next, I encountered an error where the script could not find my Android SDK. This is pretty much expected because on my machine I'm running Android Studio so it is the only place that knows about the SDK.  The quick fix here is to find the path to the Android SDK and add that to a new environment variable ANDROID_HOME.  I also needed to make sure that my JAVA_HOME environment variable was correct so that the build process would be able to find it.

Awesome, now I'm nearly there. I started my JS Server to watch for changes, I'm using Console 2 and Git Bash here

$ react-native start

Then in another console tab I run:

$ react-native run-android
Result:
It works, but not really.

First it seems to think that I'm not running my JS server, but then it kicks in to fetch the file changes. 

This gets my hopes up. but then goes back to the red screen of fail.  Why did it do this?!!?  Well it seems that there may be an underlying issue with the way that the packager works on Windows based on the error that the packager spits out. I'm guessing that there is a simple thing to get this to work, but for now I'm moving back to OSX to do React Native.
        React packager ready.

[1:39:35 PM] <START> Building Dependency Graph
[1:39:35 PM] <START> Crawling File System
[1:39:52 PM] <END>   Crawling File System (17082ms)
[1:39:52 PM] <START> Building in-memory fs for JavaScript
[1:39:54 PM] <END>   Building in-memory fs for JavaScript (1498ms)
[1:39:54 PM] <START> Building in-memory fs for Assets
[1:39:55 PM] <END>   Building in-memory fs for Assets (1421ms)
[1:39:55 PM] <START> Building Haste Map
[1:39:56 PM] <START> Building (deprecated) Asset Map
[1:39:56 PM] <END>   Building (deprecated) Asset Map (326ms)
[1:39:56 PM] <END>   Building Haste Map (905ms)
[1:39:56 PM] <END>   Building Dependency Graph (20907ms)

<--- Last few GCs --->

  157866 ms: Scavenge 1402.8 (1455.6) -> 1402.8 (1455.6) MB, 12.3 / 0 ms (+ 3.0
ms in 1 steps since last GC) [allocation failure] [incremental marking delaying
mark-sweep].
  159306 ms: Mark-sweep 1402.8 (1455.6) -> 1402.7 (1454.6) MB, 1440.1 / 0 ms (+
4.0 ms in 2 steps since start of marking, biggest step 3.0 ms) [last resort gc].
  160988 ms: Mark-sweep 1402.7 (1454.6) -> 1402.7 (1455.6) MB, 1681.5 / 0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0000034B02A37349 <JS Object>
    1: join [path.js:~217] [pc=000002DAEE697E24] (this=0000026D39474171 <an Object with map 0000031DF7E23E19>)
    2: arguments adaptor frame: 3->0
    3: /* anonymous */(aka /* anonymous */) [c:\GitHub\AwesomeProject\node_modules\react-native\packager\react-packager\src\DependencyResolver\DependencyGraph\ResolutionRequest.js:~226] [pc=000002DAEEEC76DA] (this=0000034B02A04131 <undefined>,real...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

I'm going to be tracking this all down and hopefully then pushing this work back to the react-native repo as a pull request.

09 July 2015

Introduction to React

A few months ago I was approached by my editor from Node.js Recipes to discuss the possiblity of writing another book. This coincided with a time where I had been spending time working with React for side projects, and it just so happened that the title which I would be writing is Introduction To React.

intro_to_react

 So I decided to write the book and spent the next 11 weeks writing it. I am currently finishing up the edits and the book is due to be published in September. I'll be sure to update as the publication date approaches.

25 February 2015

dev.Objective()

Every time I attend a conference or get bogged down following all the new tools and frameworks that are coming out in the front-end development world (which seems to happen daily) - I decide that I want to write a talk about how we as developers can optimize our front-ends without rewriting everything from scratch.  I finally was able to get an abstract for a talk that will address such things written a month or so ago. I then decided to submit this talk to DevObjective, a conference happening in Minnesota in May. I feel that this talk might hit well with the audience as one of the things that stood out for me from the conference site was the following sentence:
Cutting edge stuff is awesome, but most people are more concerned about getting their jobs done now
I feel that this hits home with me, as I love to just be able to get my job done now.  I'm not saying that we can't enjoy the advances made by new and modern frameworks, even if we are working on a years/or decades old project, but we can make smart choices to modernize our applications. Luckily my talk was accepted and I'll be speaking about "Front-end Modernization for Mortals" in May  at Dev Objective.

I'm excited to be joining a group of speakers who will be discussing a wide variety of topics from which any developer should be able to gain some valuable knowledge for their daily jobs. If these sound like something you would be interested in, you should join me at the conference in May!

At the time of this writing, there is still time for the early bird pricing if you click the banner below:

04 November 2014

Firefox Developer Edition

In my most recent talk at jQuery Chicago, I spoke about the promising future of debugging that involved the Firefox Tools Adapter which is a brilliant step forward in the world of remote debugging.

This was under the radar until the day before my talk when it was announced on the Mozilla Hacks blog. So it suddenly became a bit more mainstream. 

Yesterday Mozilla has teased a developer focused version of Firefox they have codenamed #fx10 in a theatrical-like trailer. I for one am excited to see what sort of product arrives with this new browser.



So it turns out that this Firefox Developer Edition will be a replacement for the current Aurora Channel. What it will bring is a separate profile so it can run alongside the stable version of Firefox without having to mess with custom profiles. It will have easy access to developer tools, and looks as though the Firefox Tools Adapter will be built in to the product directly. This is a great advancement for those looking to use the cutting edge developer tools from Firefox on the web

07 October 2014

jQuery Mobile

I have been fortunate enough to have the opportunity to speak at several jQuery Conferences in the past two years. The focus of most of my talks, and most of my day-to-day work actually, is based around building mobile web applications with jQuery Mobile and Cordova, two wonderful open source projects. During these conferences I was able to meet and get to know many new friends and fellow developers, including many of the folks on the jQuery team. Eventually, while in Vienna at jQuery Europe I was talking with Alex, the lead of jQuery Mobile and he suggested that I start contributing to the project.
I have been fortunate enough to have an employer who is generous enough to allow my some time to donate to the project and I have been contributing through bug-triage, pull requests, and generally just trying not to get in the way since March of this year. I have already learned a ton and am always encouraged by the support of the jQuery team and the advice they give.
Yesterday - 6 October 2014 - I was officially made a member of the jQuery Team. I am honored to have this opportunityand am excited to join the team of people whom I have come to know over the past two years. I am also pretty excited about the opportunity to continue to do what I have been doing all this year, just now I have access to the GitHub repositories.

09 July 2014

Node.js Recipes Screencast Edition

Last year, I wrote Node.js Recipes in a relatively short time span. It was accomplished in something like 120 days, or about 10 days per chapter. This was exhausting and I vowed to my wife that I would not write another book at that pace again.

Then I was tempted. My publisher asked me if I had interest in several titles, and man did I, but after a couple days of deliberating over each one - I could not commit to the time frame.
Then came an introduction from someone within the publisher’s organization that proposed I create a screencast series based upon the book which I had already written. This was something I could get on board with because the material was already written (right?).
So I created a sample video for evaluation and we decided to move forward with another aggressive schedule to record ~6 hours of screencast based upon material in my book.
It turns out this was a pretty agressive and time consuming undertaking as well. Sure the material was already written, but it needed to be reworked into a standard Powerpoint format and of course I would need to be coding most of the stuff I’d already written again. All of this (with the exception of creating some of the powerpoints) was a great time and I enjoyed being able to revisit my book from an angle of a user or reader, rather than an author.
In the end I recorded nearly 12 hours of raw footage for the video which is being post-processed currently and should see release in the near future (no official date that I know of yet - stay tuned for that). The team at Apress has done a fantastic job with the final editing and composition, from what I have seen and I look forward to everyone getting the opportunity to check out the finished product when it is available.

08 April 2014

The Winter of jQuery

This winter I was fortunate enough to be able to speak at two jQuery events - First in jQuery Conference in San Diego, then in Vienna for jQuery Europe.  The traveling is always great, and these events were top notch as far as organization, content, and attendees.

While I always enjoy attending conferences, these two seemed to be extra engaging in that the attendees I talked with all brought a great deal of encouragement and excitement to continue to share what they know and learn.

I was also able to spend more time with a few of the folks I have met from the jQuery team and really see the vision of where some of the projects are headed. From this, I have even started to spend some time trying to triage and/or fix issues on the jQuery Mobile project.

In any case, here are the slides and video for my presentations about building $.Widgets for both UI and Mobile.



24 February 2014

Book Review: Principles of Object-Oriented JavaScript


I just finished reading another fantastic resource for JavaScript developers "Principles of Object-Oriented JavaScript" written by Nicholas C. Zakas. 

Nicholas C. Zakas is an excellent Front-End developer, and what I have always enjoyed about his work, is his ability to clearly articulate his knowledge to developers of all skill levels. Because of this I had high expectations for reading this book. I'm happy to say that this book did not disappoint.

The book, to me, is an reference I will keep with me throughout my JavaScript career, and I'll recommend it to any developer interested in JavaScript. Targeted toward JavaScript beginners, this book highlights areas that many who are new to JavaScript will likely have to learn the hard way, or discover after they have reached a level of frustration that makes them decide to hate JavaScript forever.

Now, this does not mean that this book contains some secret recipe to JavaScript Zen, but it does provide all the necessary tools for the reader (Seasoned JavaScripter or one who is new JS) to understand how to build great applications with JavaScript. The topics - functions, objects, prototypes, inheritance - are all covered thoroughly through well though out examples which are not too complex for even a new developer to follow. These examples and explanations are accompanied with wonderful notes and snippets that signal the voice of the seasoned JavaScript professional that Nicholas C. Zakas is. As I wrote above, I definitely recommend this book.

24 October 2013

Node.js Recipes

It started when I favorited a tweet in February in which a request was being made for some help updating a JavaScript book. I had recently spent some time contributing to a jQuery Mobile book and wanted to continue writing. Shortly after I contacted Louise (my editor) and it turns out that they had already found someone to update the book.....
 
It turns out that Louise had some plans for a Node.js Recipes book, which I thought would be spectacular so I set to work writing an outline and proposal for the book.

After a few weeks I had the proposal in hand, sent it to the publisher and it was approved. This is where things get crazy, because I now had to write the twelve chapters I'd outlined and I had less than two weeks to write each one if I was to make my deadline.

This crazy schedule, while good at keeping me on task, was not great at keeping me rested and stress free. There were many late nights and long weekends where I was not able to spend quality time with my family or friends. I am grateful that they allowed me time to research and write, because I was able to create a book which I feel will be a useful tool for any developer who wants to learn more about Node.js. It will give readers a glimpse of what goes on in Node.js not only in the Core, but also in the third-party modules that have helped to create the robust Node.js ecosystem.

If you are interested in getting to know Node.js better, or if you would just like to buy an amazing book for your coffee table or library, please buy the book.
http://www.amazon.com/Node-js-Recipes-A-Problem-Solution-Approach/dp/1430260580/
http://www.apress.com/9781430260585
Node.js Recipes

23 September 2013

FirefoxOS Apps


A few weeks ago Mozilla announced another initiative to get some more applications into the FirefoxOS Marketplace.
I had submitted a simple compass application early on in the Marketplace's life, but thought that this opportunity would be perfect to get an PhoneGap wrapped HTML application that I created for Android onto the marketplace, so I applied for a phone for app port deal. Within a couple days I recieved confirmation that I would be getting a developer preview phone from Mozilla, in exchange for my app port.
Now, I could have waited around until I received the phone to get started working, but with the FirefoxOS simulator available as a Firefox Add-On I set to work right away. I had previously submitted an application so I knew the general Firefox manifest format which is probably helpful. Once I had a Firefox app manifest being served (with the proper MIME type) from AppEngine I was ready to submit. I did however wait until I had a physical device to test and ensure it appeared and functioned as I expected.

01 September 2013

Busyness

I have had a busy time over that last few months. Firstly, I have been engaged in a very ambitious and exciting project for my day job. Aside from this keeping me busy, I also had a talk accepted for the jQuery Conference in Portland in June. Conferences like the jQuery Conference are always welcoming to new speakers and the community as a whole is open to everyone's input. Experiencing a conference such as this is always a thrill. This was my first talk at a big conference but I think it went well and I hope to do it again.



If you listened to at least the beginning of that talk, you may have heard me mention that I’ve been writing a book. This book has been a great deal of fun, but has also been challenging. Between research, writing code, writing text, editing, and following up with the technical reviewer it has kept me busy. It should be published this fall so stay tuned…

16 March 2013

Remote Debugging Revisited

A little less than a year ago, I wrote a post about remote debugging tools. Since that time the landscape has changed, so this post will try update where we are in the world of remote debugging. (Note: by ‘we’, I mean me, and by ‘world’ I really mean, what I’ve used since last year) First, lets review where we were a year ago. Chrome for Android was brand new, and had remote debugging support baked in. Opera Dragonfly had great remote debugging support. Adobe Shadow (now Edge Inspect) was new, and WEINRE was still a .jar. Fast forward to now. Chrome for Android still has great remote debugging support, when connected you can see all your inspectable tabs from your remote device, and debug away. In Opera land, things have shifted a bit. Since they have started their switch to Webkit, who knows where their remote debugger will be in another year. Adobe Edge Inspect is a very popular debugging toolset for iOS and Android. Weinre is now (debatably) more accessible as a Node.js server, making it super easy to install and run a local/or remote hosted server. Weinre powers the phonegap debug service . It is also the service behind the experimental mobile debugging option at jsfiddle.net.
The newest version of jsbin.com has a pretty incredible remote rendering capability, but you can see for yourself on youtube:
Over the course of the last year, Firefox has built a homegrown set of Developer tools, so developers need not rely soley on Firebug on Firefox. These tools have been built with remote debugging as a high priority - with the proliferation of Firefox on Android, and the fancy new Firefox OS - remote debugging is important. Remote debugging for Firefox has been around for a few versions, but I really like to live on the nightly branch (currently 22.0a1), so thats what you’ll see here. Its quite simple to enable on your computer: just swing over to ‘about:config’ and toggle ‘devtools.debugger.remote-enabled’ to ‘true’ restart, and you are set. \
Next (assuming you’ve got your android platform-tools installed) you simply connect your device to your computer and
adb forward tcp:6000 tcp:6000
Then, assuming you have enabled remote debugging on your Android device, you again go to ‘about:config’ and toggle the ‘devtools.debugger.force-local’ to ‘false’ and ‘devtools.debugger.remote-enabled’ to ‘true’.
Restart. Debug. To Debug you open the remote console by selecting ‘Connect…’ from the Tools > Web Developer menu. Thats it. Remote debugging is important. And as the web development industry moves more toward mobile, these tools need to and will get better and more accessible for everyone. I expect I’ll be revisiting this topic again soon as tools improve or emerge.

14 January 2013

Whitelisting URLs in PhoneGap

I've built a couple of HTML5 (jQuery Mobile) applications that have also targeted native app stores using PhoneGap. When building these applications, it becomes clear that to get desired navigation in iOS, one must carefully consider the PhoneGap settings for url handling "OpenAllWhitelistURLsInWebView" and "ExternalHosts". In many configurations this results in setting the "OpenAllWhitelistURLsInWebView" to "YES" and Subsequently setting a single "ExternalHost" as "*" in order to keep your application functioning within the WebView exclusively. This is great for everything except where you wish to open an external link that would break your HTML5 applications navigation (due to a lack of back button). What follows are a few tricks I have picked up to help with whitelisting. In many cases you know when you're building your application where you'd like to have the external links open, in which case you can set these external links within your Objective-C source code letting the applicaiton know which links to open. This would look something like the following Gist (which looks to the prefix of the URL in order to open a link outside of the WebView): In other cases, your application may allow for some dynamic client created content to come from the server. This can mean either a maintenance nightmare for setting up this prefixed whitelist, where you get to update the whitelist and resubmit the app to Apple everytime the list changes (icky).... Or we can come up with a solution that works better. One way in which this can be accomplished is by looking to the suffix of the URL to find a querystring parameter that would indicate that we need to open external. A perhaps more robust solution, allow for the conversion of any link with target="_blank" to open in Safari. This solution is inspired by this where you tell your iOS app to find a specified document fragment, and also tell your web application to ensure that target="_blank" links always have such a fragment. The Obj-C code looks like this: and telling the webapp to set this fragment (using jQuery) looks as follows:

28 December 2012

I read a book: JavaScript Enlightenment

I dunno if this is a full fledged review or not, but I recently picked up and read the new book JavaScript Enlightenment by Cody Lindley, and I found it ranks in my list of JavaScript books I would direct others to read in their quest to JavaScript wizardry. Lindley states he writes his book first and foremost for himself, as a personal reference, which I find handy because that is exactly how I like to read JavaScript books. His approach to teaching the language might strike some as contrary to what is found in the wild - he spends plenty of time not using object literals when creating objects in order to hammer home the underlying principles of JavaScript objects - but he does also hammer home that using literal notation is preferred for its terseness and readability.

What else did I like about this book? Well I enjoyed the use of code examples, as its always good to see JavaScript in action. He also makes many great succinct notes that help make good distinctions such as "Remember: object instances created from constructor functions are just plain old objects". Another concept that those in search of JavaScript enlightenment should find well laid out in "JavaScript Enlightenment" is how the prototype chain is traversed whilst accessing a property on an object. Along with traversing the chain, Lindley describes through an example of what not to do, how prototypes can be altered even on the Object.prototype, promptly reminding the reader that this is a "forbidden" example. Since the prototype is key in JS, the book dedicates a considerable portion to describing and outlining how it all works.

The book describes in great detail and examples many concepts that any front-end engineer should be familiar with. Things such as the Function objects instance properties and methods - you know: arguments, constructor, length, apply(), call(), toString() - including going into specific examples on how to use arguments.callee when calling a function recursively. The discussion of JavaScript scope and closures is straightforward and to the point without over complicating concepts that are sometimes hard for some developers to grasp.

Other parts of this book I would describe as desk reference material. These are items that are common and I think are generally understood by many, but in the case someone runs into a gotcha during development, they may find it useful to hit the chapters on the various objects: Array(), String(), Number(), Boolean(), as well as then utilizing String, Number, and Boolean primitives. Other desk references: Math(), null, and undefined.

I'd totally recommend this book on the same JavaScript binge handed to new developers when the get underway (things like The Good Parts, Eloquent JavaScript, JavaScript Web Applications, or any of the many many useful links to the plethora of great resources available to the modern developer). I guess this did turn into a full fledged review.

19 November 2012

Openness

On 11 November 2012, my first patch to jQuery-UI landed in the project. It was not the world's greatest pull request, nor was it the best code ever written (by a long shot).  But it was important. Not because I get my name on a change log somewhere, or that I will now conquer to world with my open source prowess. Its important because it is another tiny step in the massive open source snowball that wins. It wins big. The open web as we know it has spiraled out of openness and open source projects. The documentation that I turn to regularly and have contributed to is open and invites new contributors each day. There are countless open initiatives in the world these days - and by no means are these all software related - these encourage the scientist in us all to submit pull requests, change direction and assert for the greater good. If you have a passion, pursue it. That is all.

07 November 2012

Homework

Recently I was tasked by my son's pre-k teacher to present a paragraph that describes my occupation... in a way that 4 year olds will understand. This really put things into perspective for me, more than I thought it would. At first I think of what I might describe to my parents: "Software Engineer: I write code for web applications and databases"... No. So what is it that I do?

I was then reminded of an interview question I once had where I was asked: "How would you describe a database to your grandmother?"  These sorts of questions may seem silly to some developers, but I find them to be a great exercise. These questions help us to target and focus on what it is we really do, and how our end users or clients might perceive what someone in the software profession might be thinking. So I thought of the answer provided in that interview where I made the analogy of a jewelry box that helps to organize and sort jewelry for efficient placement and retrieval.

How does a jewelry box translate to pre kindergarten children? Well I tried to avoid an abstract analogy and simplified it by stating that I teach computers to do neat things and give us information when we ask them for it by typing or clicking the mouse.... Our children don't care about CSS, HTML5, JavaScript, objective-C, C++, Java, Ruby, Python, C#, or if we built our app for Android, iOS, Windows Phone 8 or whatever,
they care if they can learn from and enjoy whatever it is we built.

So a fresh perspective of "how can this actually benefit someone" has been bouncing in my head lately. I'm not saying one shouldn't try new cool tech... Still create experiments and things that push development forward, but perhaps a deeper look at what is truly needed should be a priority.

03 October 2012

TypeScript

This week Microsoft released its shiny new JavaScript pre-processor - TypeScript. It represents a superset of JavaScript that is designed for large-scale application development. It utilizes concepts that most developers are comfortable with in their non JavaScript languages. Things like Classes, Modules, and Type checking.

These are all things that many people complain that JavaScript does not have built in.  With TypeScript, JavaScript does not magically gain these things. TypeScript makes these things accessible to a developer through its pre processing. Developers and JavaScript do not need TypeScript, and it is not a requirement to build large scale applications. It won't magically make crappy programming better, but it may help catch a gotcha for someone every now and again, just as JSHint would. I for one think that it will take off rather well, especially in the ASP.Net community. I also will probably try it out in a project or two or three. I like that it looks and feels like JavaScript, which is a syntax that I am comfortable with.  That is one reason why I have not adopted CoffeeScript, it just looks so foreign to me. I suppose if I were a full time Ruby on Rails developer, CoffeeScript would feel right, but I'm not, so it doesn't.

I'm going to end this by just showing the difference between TypeScript and JavaScript. It is subtle and that is appealing to me. See the comparisons below:
typescript javascript

01 August 2012

Liberated Pixel Cup

July marked the beginning of the coding portion of the Liberated Pixel Cup which is an amazing two-part competition that involves amazing artists creating open game assets during part one (June) which developers then take to create a game based on those assets (July). I first heard about the Liberated Pixel Cup a few weeks into the second part of the competition. After a day or two of contemplating if I could get a game off the ground in time, decided to make an HTML5 game. Other than my orientation demo Catch and the node.js interpretation of the card game Wizard, I had not made (or at least published) what I would consider a graphics based, animated, HTML5 game. I decided to take this opportunity to dive in head first.
Over the last few years, I have seen quite a few HTML5 game engines come around and have taken note of many, experimented with some. The big name in the HTML5 engine space right now seems to be ImpactJS which I have yet to use, but of the ones with which I have experimented,cocos2dx-html and melonJS, I chose melonJS. I decided that to get an RPG style game with the assests provided in the competition playable in the limited development time that I had, melonJS fit that need perfectly. So now I can kill two birds with one stone, get an HTML5 game built and get more familiar with one of the HTML5 engines I have been eyeing for some time.
So I spent my evenings and weekends for the last couple weeks doing quite a bit of hacking. First I had to familiarize myself with making some tilemaps for the different world areas within the game that I wanted to create, figure out how that tied in with the melonJS framework that I was trying to learn, and create a simple story in the game which could be completed before interest is lost. Creating the tilemaps was easy, and the way in which melonJS incorporates them into the game is slick and effective. A couple things which weren’t clear from the melonJS documentation were 1) dynamically adding projectiles or arbitrary objects (such as the magic in my game) to the screen, and 2) how to get the level transitions to behave how I wanted. The first was pretty simple in the end, all I needed to do was check if my player had the magic, check direction, create & align, add it and make sure it displays on the scene:
Loading ....
The other major hurdle I faced was the scenes when jumping from one map to another would sometimes immediately jump to a completely different map. This seemed like a bug and was so inconsistent I nearly scrapped the whole project, but as it turns out, a few of my enemies were walking their boundaries to the point where the level transitions began, triggering a random map change as if it were the main player. So that was a quick fix (once I figured it out). I do hope to add some more fun to it as time goes on, and welcome any contributors to expanding it to whatever it becomes. So go ahead and Fork it.
I cannot thank the other contributors to the competition enough, they are a cheery bunch on IRC who have donated time and talent to a really cool open game competition.
So now you know a bit of the backstory that led up to Pixel Quest, my HTML5 entry in the 2012 Liberated Pixel Cup.