Monday, 13 August 2012

Intel Ultimate Coder Challenge - Part One


When Intel asked me to write an app, in just six weeks, with a mission to tap into every facet of a next generation pre-production Ultrabook, I started to giggle.

The Guy

My name is Lee Bamber, an over-worked, under-appreciated developer from a British company called The Game Creators. I’ve been a programmer for almost 30 years and still get the giggles when someone gives me a crazy coding mission.


Your intrepid guide on this journey of digital discovery

The App

With discretion over the design of the app, I decided to pick an idea from the ideas pile that would really show off what an Ultrabook could do. Coming from an engineering background, I plumbed for features, and lots of them. So I made a list of what I suspected the new Ultrabook could do; Multi-touch screen, instant notifications, 3D graphics, multi-core performance boost and sensors.



The app itself is called Love Hearts ®, and is an ambitious attempt to combine social messaging and gaming into a single fun and surprising experience. The initial idea came from those crazy 8-balls you shake, resulting in some random fortune cookie style advice to your most pressing questions. What if you could shake your device and a game would pop up or a piece of a puzzle, or a tool to create new things with. Naturally the idea was not fully formed, and asking users to pick up and shake their Ultrabooks would not win me any favours. Even so, the initial idea grew into an app design that would encourage creativity, sharing and fun, whilst at the same time tapping into the unique features of the Ultrabook.

The Love Hearts ® brand has been officially licensed from the UK confectionery company (Swizzels Matlow www.swizzels-matlow.com ) that makes these popular sweets here in the UK. By using a recognised brand we increase our chances of creating a popular app that will be recognised by millions of customers who have experienced this fun and well known candy.

The Technology

These days, you can’t throw a stone without hitting a solution for developing apps. From drag and drop wizards to notepad and compilers, there was no shortage of ways to develop such an app within the time allowed. As luck would have it, in a former life, I used to create programming languages for a living and it just so happens, the last one created, App Game Kit (AGK) www.appgamekit.com , meets my needs just fine.

AGK – App Game Kit – Create cross platform applications in easy to use BASIC

Capable of producing apps on seven different platforms, and written entirely from scratch, I would be able to tailor and add commands for the Windows platform as and when I need them.

The Unboxing

Everybody likes a good unboxing, but due to the fact I live out on the frontiers of Wales, I suspected the courier had delivered my device to a long lost tribe of druids. Nonetheless, a large and ominous box arrived on Wednesday 8th August, and inside, the object of my challenge; a drop dead gorgeous next generation Ultrabook.

The Ultrabook - A universe crammed full of new and exciting technology

The App Development

With the why, who, what and when out of the way, I will dedicate the rest of the blogging to the best bit, the how.  How do you start such a project, how do you support new features or how do you stay sane and still get it finished in six weeks?

It was clear from the size of the app design and the tight deadline that I needed to assemble a small team to help out. I recruited a few fellow developers to help with the heavy lifting, including an extra pair of coding hands who for the purpose of our story we shall call Steve, a 2D artist - Peter and a 3D artist - Mark.

When not exploring lost civilizations, Steve explores his code for long forgotten bugs

Many apps consist of the same basic ingredients and these can be sourced and prepared ahead of time. One such ingredient is the functional prototype, which defines the basic shape of the app, and highlights very quickly where the majority of the development work will focus.

An early draft of the app in a native Ultrabook landscape format

The above prototype is two days old and shows a basic panoramic backdrop, and then a number of functional foreground elements. As you can see from the proportions, we are designing the layout to be form-factor friendly so the same app can run on a small screen as well as the ample screen proportions of the Ultrabook. It also makes for a great touch experience!

Anticipating future devices by building portrait awareness from day three

Using AGK, we are able to instantly broadcast the app directly to an iPad and Android phone to test screen layout constraints, give the button sizes a quick tweak, and then carry on developing on a larger screen. This saves us huge amounts of porting pain later when more of the app is coded.

The 2D sweet packet in the foreground will eventually be replaced with a 3D model so we can have more fun with rotation, position and shake effects, but we needed a nice looking place holder to give us a sense of the finished graphical style.

I'll reveal more about what the app actually does in the next blog, when I can show you rather than tell you.

Aside from the prototype app and the new 3D commands, we are also developing a set of social commands to allow the app to connect with Facebook, Twitter, Email and direct App-to-App communication via a custom server script and database. We have those commands working great on iOS already, and during these blogs we will be converting them to the Windows platform.

The Technology Development

In an ideal world, we should have access to every kind of feature through a few simple commands, but we don’t live there. We have to dig around websites, API documentation and snatch fragments of conversation from frustrated programmers in the hopes of finding a clue on how to solve the next puzzle.

My first puzzle is how to read the Accelerometer, Ambient Light Sensor and Geographic Location from my Ultrabook under Windows. After some Googling, I found a link that seemed to fit the requirements on MSDN. After some extensive reading, I finally narrowed down the actual code which would poll a sensor in Windows:















Although I am comfortable programming with COM interfaces, that does not mean I have to like it and I can guarantee a lot of fellow programmers would prefer to avoid it altogether. In AGK, the entire code above would be reduced to something like:

If GetAmbientLightExists()=1 then Print(GetAmbientLightValue())

Theory is all well and good, but nothing beats running real code on real hardware. I wanted to see actual readings from one of the Ultrabook sensors so I turned my attention to the device itself.

The World of Metro

In order to give my new Ultrabook a real hammer test, I decided to park my monster desktop PC and install all the development tools I would need directly onto the Ultrabook.  I installed Visual Studio Express 2012, Windows SDK for Windows 8 and Chrome. I compiled and ran some sample code from the SDK to read and display Accelerometer values, which worked a charm. At once I noticed the C++ source code looked a little strange:

void Scenario1::ReadingChanged(Accelerometer^ sender, AccelerometerReadingChangedEventArgs^ e)
{
    auto ignored = Dispatcher->RunAsync(
        CoreDispatcherPriority::Normal,
        ref new DispatchedHandler(
            [this, e]()
            {
                AccelerometerReading^ reading = e->Reading;
                ScenarioOutput_X->Text = reading->AccelerationX.ToString();
                ScenarioOutput_Y->Text = reading->AccelerationY.ToString();
                ScenarioOutput_Z->Text = reading->AccelerationZ.ToString();
            },
            CallbackContext::Any
            )
        );
}

Feeling outside of my comfort zone, I foolishly tried to copy what I had created to a Windows 7 machine only to find the executable did not run there. It would never run there, it was a Metro app. Further research lead me to the news that VS Express 2012 has ‘switched off’ the ability to produce regular ‘run anywhere’ executables until later in the year. Given my need to support legacy operating systems, I uninstalled Express 2012 and installed Express 2010. Many hours later it was apparent that installing VS2010 was a mistake, as there is no way on Titan I was going to be allowed to develop Windows 8 applications from the comfort of my Win32 world. Apparently Win32 has had its decade in the sun, and it’s now time for a new star. That star is WinRT and is the beating heart of all Metro apps.

With VS2012 installed for the second time, my hope is that I can combine the new WinRT calls with the existing Win32 based AGK. I don’t have a clue whether this is possible but it will be a lot of fun finding out! 

The Next Blog

Over the next few days, I’ll have some first impressions about coding on and for the new Ultrabook, with a specific focus on whether I can build WinRT code inside my Win32 project. I’ll also report on the evolving app prototype and any new features. The goal is to create an amazing Ultrabook experience, and using the device every day should provide some useful insights.

Until next time, have a great week and for my fellow challengers, the best of luck with your projects and I’ll see you at the finish line!  May all your apps go top ten!

More Information

For more information about the Ultimate Challenge, check out the official website at: http://software.intel.com/sites/campaigns/ultimatecoder/

Blog Photos

For everyone who likes photos, I have selected a few from the hundreds I took during this weeks blog.


















4 comments:

  1. Thanks Steve, all part of the service :)

    ReplyDelete
  2. Is that really a picture of your windows 8 product key??

    ReplyDelete
  3. Yep, free Windows 8 with every blog :)

    ReplyDelete