Monday, 17 September 2012

Intel Ultimate Coder Challenge - Part Five

Welcome back to my penultimate chapter which chronicles the adventures of writing an Ultrabook app in just six weeks. Last time you saw more of the app design and some of the sensor additions, and I expect you are looking forward to more of the same. Well all developers need to blow off steam, and this blog covers some of that too.

Lee Bamber at the EXPO, wearing his coveted Exhibitor badge

All six developers competing were given the previous week off to attend IDF 2012, and to participate in some of the events. My calendar was particularly busy hosting two live coding events in the decompression lounge, manning the Ultrabook stand in the Expo area three times, sitting on a beanbag for a few hours with Tom and the HTML5 Hackathon students, attending an Intel fellowship and Ultimate coder get together, and of course, attending the Black Belt dinner where I gave a short speech which I hope was at the very least entertaining. One day and 20 hours of travelling later, I was back in the UK, ready to continue my coding quest.

Two Weeks Left

Despite not posting a blog last Monday some progress had been made by then, primarily to get our live demo of Love Hearts ready for IDF. I also made a short video of the demo, just in case my Ultrabook exploded en-route:

For the IDF 2012 demo, I managed to coax the following out of the Ultrabook:

DirectX for 2D/3D performance
Accelerometer used by Clouds
Light Sensor for Night Time Mode
Swipe Gesture for Touch Interface
Keyboard for Messaging
Multi-finger for Image Rotate & Resize
Notification for New App Events
NFC for Free Love Credits
Compass in Main Screen
Geo-location in default Message

I discovered a driver issue with the accelerometer, light sensor and geolocation, but nothing that prevented the live demo during the event, and on the whole the Ultrabook performed admirably under event conditions.

Notification in Windows 8

To prevent this blog turning into an IDF report, I wanted to single out one of the technical hurdles defeated in order to prepare the final IDF demo, and unique to developers of Ultrabook apps. Windows 8 offers app developers the opportunity to modify the tile that represents their app that appears in the main tile page. In the Windows API, you will find it in the Notification section.

I wanted my app to change the tile icon if my app wanted to alert the user of a pending action (such as an untapped feature or a message had arrived). Rather than write all the code from scratch, I highly recommend you seek out an example that includes the 'NotificationsExtensions' project. This project includes a whole slew of helper functions that allows you to change the tile icon with just a few commands:

auto tileContent = TileContentFactory::CreateTileSquareImage();
tileContent->Image->Src = "ms-appx:///Assets/LogoNotify.png";
tileContent->Image->Alt = "Love";

As you can see, the code is almost self-explanatory at this level and means you can carry on with more important features. I used this code as part of the AGK / Freedom-Engine command called SetNotificationImage which simply changes the icon by passing in the new image index.

The 'NotificationsExtensions' project goes on to allow a whole host of additional functions to create double wide tiles, additional text notifications and all manner of hooks into the Windows 8 notification system. Given the present deadline, these wonderful calls will have to wait for another app.

New Feature Ahoy

During the IDF event, I learned a few more tricks Windows 8 and the Ultrabook could do including a swipe from the right which would call up a button called ‘Share’, which when selected would list all the apps I could export to.  

Discovering the Ultrabook - The all new 'share' feature for apps

That is, any apps installed which are compatible with Love Hearts would be listed and allow me to send ‘media’ to that app. It also occurred to me that an app such as an Art Package could send the image directly to Love Hearts and forwarded as a message. This feature was added to my ‘must learn more’ list with the hope I can squeeze it into the app before my deadline.

Meanwhile, back in England

Approximately, half an orbit away, my backup coder Steve was busy in a darkened room adding wonderful new things to the app.  He started the cupid mini-game which will form part of the ‘Play Games’ feature within the app. Work also started on the innards of the messaging system:

Keep track of your friends in the Love Hearts app

The messaging code which both sends and receives messages between apps, with new functional and visual elements integrated to keep the ball rolling. A particularly difficult issue was encountered whilst attempting to send images to the server, but was quickly overcome and the latest version of the app can now send and receive image messages between two Love Heart apps.

Development Items Remaining

With less than two weeks to go, it was time to itemise the tasks left to do. Clearly, we needed to complete the integration of the graphics, removing the last of the place holder artwork, and we also needed to integrate the monetisation component that would allow in-app purchasing within the Windows 8 Store. A particularly neat trick when you consider that Windows 8 Store does not have an in-app purchasing API. We also had a few loose ends to tie off such as adding 3D shader and engine code plus optimising the DirectX code to run smoothly on the Ultrabook.

The goal for the competition is a deliverable that will install and run on the judges Ultrabook devices. Getting the app submitted and available on the Windows 8 Store is unlikely given the validation time required by Microsoft. It is also unclear if submitting the ‘former-Metro’ package will also succeed given the issues discovered at IDF when moving from one version of Windows to another.

INSIDER TIP: A Windows 8 app package created in ‘Windows beta preview’ will likely not work in ‘Windows RTM’ when sharing a developer licensed version of that app. As this is largely undocumented, I highly recommend upgrading to Windows RTM for the sanity of your end users.

Freedom for Everyone

As an aside, I am pleased to report the launch of the Freedom Engine went very well (, and even provoked disbelief among IDF attendees.

We also snatched some time with Bob Duffy, who kindly agreed to interview me about the Ultrabook app, IDF and Freedom Engine. Looking back at the video, I think I was on my fifth cup of coffee. Until technology exists to dial down the insane grin on my face, you'll have to take me as is:

During the IDF HTML5 Hackathon, I also learned how to tap the Ultrabook sensors from a browser using Javascript and a Chrome extension, which means we now have a method of bringing Ultrabook sensors to the browser via Freedom Engine. Visit the website above for more details!

Ultrabook at the Airport

Over the course of this competition, I have really subjected the Ultrabook to some extreme tasks. Not only from the inside by pushing WinRT as far as it can go, but also from a users perspective by deciding to code the entire engine from the Ultrabook itself. This was taken yet further on my way back from San Francisco when I broke out the Ultrabook at an Airport cafe, activated my 3G hub and carried on coding as though I was back at home.

On re-reading my blog before I click 'Publish', I got the sense the connection between Freedom Engine and the Love Hearts app might not be clear. The connection is that Love Hearts is written in AGK, which is really Freedom Engine by another name. The upshot is that when Love Hearts is finished, and running nicely on the Ultrabook, it will also instantly become available for all the other supported platforms such as HTML5 and Android. This means Love Heart app users can exchange messages and play games, irrespective of which device they are on at the time. Cross-platform development is no longer optional!

More Information

For more information about the Ultimate Challenge, check out the official website at:

Next Time

Plenty of development and a good deal of research still to come. With IDF obligations complete, I can close all the windows and doors, make an especially large pot of tea, and focus my blunderbuss mind entirely on the mission.  The next time you read my blog, you should be reading about an app that looks and plays like the real thing.

I also want to extend a special hello to the Ultimate Coder contestants and judges who I met at IDF during our fifteen course Pizza meal.

Lee and Andreas at the 'Death by Pizza' restaurant
Had it not been for the Guinness washing it down, I don't think I would have survived all that pizza. As our industry is such a small place, I very much look forward to meeting you all again and hope everyone had a pleasant journey home.

No comments:

Post a Comment