Developing for Unity and HoloLens at NASA Space Apps Challenge

I've always said that a hackathon is a great place to investigate new technology. It's an occasion where you can spend time concentrating solely on something, and that can be both instructive and useful. So, when I signed up for the Nasa Space App event I was keen to try something new.

I had a tiny go with Unity a while back, which was fun, but I've never written code for a Microsoft HoloLens. Number one son had an idea for an app that let you see where satellites are in the sky or in the ground. The idea was that it would use satellite data to predict positions and then render them in a way that was locked to your present position and orientation. Then you can look around and see what is up there, even through the surface of the earth you're standing on. 

It was quite an objective, particularly as neither of us had developed for the HoloLens before. But we thought we'd have a go. Number one son was in charge of getting the satellite data and doing things with it, while I looked at finding and displaying a globe. 

You can get the Unity framework here. It's free for personal use. If you want to make HoloLens applications you'll need some other things which you can find out about here.  You don't need a physical HoloLens to get started, there's an emulator you can use to find out what your apps will look like. I managed to run the emulator, Unity and Visual Studio on my Surface Pro 3 with 8 Gb of memory and it worked OK (although it got a little upset when I tried to load Adobe LightRoom as well....).

Number one son was using a MacBook Pro for his part of the development, so he installed the Mac version of Unity and the .NET framework and set to. I was amazed that you can do HoloLens development on a Mac, but when we took his code and moved it to the Surface Pro it worked fine, which I found astonishing. Even compiled dll files added as assets moved across.

A Unity solution is driven by the assets that it contains. These can be images, models, scripts, dll files, shaders, sounds and lots of other different things. You create scenes by bringing assets together and create behaviours by binding scripts to events. The scripts can be written in C#. I really like that. 

The items in a scene are fiercely hierarchical. Changes a container will affect the things in it. Scripts can be bound to objects and there are start and update behaviours that you fill in to get your scripts to act on your objects. Variables in your scripts can be mapped onto elements in game objects and used to affect their appearance and behaviour.

If you've played with game development in XNA you'll find the "set things up and then update them every frame" way of working very familiar. But it is both more powerful and more confusing, in that every item in your game can have its own start and update, rather than being driven from a single, central, game engine. You can run your game in the editing environment at any time, and you can turn elements on and off at will. 

Unity have created an asset store that plugs directly into game projects so that it is very easy to find paid (and free) items that you can include in your game. In no time at all we'd found a really nice globe and I'd kind of managed to get it into a Unity project.

There are some settings that need to be customised in Unity for HoloLens development. You can do this by hand (there are instructions here) or you can find a ToolKit that automates the process. 

You create your software in Unity and then use it to build a Visual Studio solution that is compiled and deployed to the target device. We had the HoloLens attached to the Surface Pro via a USB cable, and we ran the program that way. You can use WiFi deployment too, but one of the golden rules of hackathons is that once you've got something to work you stop working on it and move on to the next problem.

Number one son made awesome progress. He found some tools online for computing orbits and even tracked down some 3D models for the satellites themselves. I learned a lot (which is software engineer speak for went more slowly) but I did manage to get a globe displayed and spinning.

With half an hour to go before judging we brought the software over from the Mac, fixed a tiny issue with exceptions in the satellite code and then built and deployed the program to the HoloLens. And then the problems started.

Everything was upside down and wrong way round. The code worked fine in Unity on the PC, but on the device it was wrong. And, since we'd not done anything that could cause this behaviour, we didn't really know how to fix it. Not good. 

After a bit of frantic searching we managed to find this which fixed the problem. By turning off an apparently irrelevant option (MSAA) we got the code to work. This was very annoying. There is no mention of this issue in any of the release notes anywhere. It means that anyone who carefully follows the "getting started" sequence for the HoloLens would be rewarded with a solution that does not work properly and no information as to how to fix it. Not good. 

I was really impressed by the ease with which you can get started and the power of the HoloLens itself. I'm going to try and hang on to my loaned device for as long as I can.

Space Apps Challenge Judging

 A tense moment in the judging.....

A tense moment in the judging.....

That was such fun. At the end we had four teams that produced projects that gave Derek, our judge, some meaty developments to get his teeth into. In the end the overall winner was the Fire Finder app, although everyone who took part produced some lovely results. 

I was part of Team "What'sUp", trying to build a HoloLens application that let you look into the "sky" (or the ground) and see what satellite are around relative to your position. It was my first foray into Unity and HoloLens development and it's worthy of a blog post all it's own. Which it will get....

You can find details of what the teams got up to here. Many thanks to c4di for the use of their lovely work area and to Dileepa for hosting the event. And getting us pizza.

Everyone who took part had a whale of a time. All of the starters finished with a working solution. Here's to next year.

NASA Space Apps Challenge

We started our NASA Space Apps Challenge at c4di first thing this morning. We've got teams looking at the NASA challenges and getting to grips with them. We've got satellite trackers, fire reporting systems, solar power simulations and orbiting robots. And another 24 hours or so to finish.....

..although of course it's really all about the stickers...and the pizza....

NASA Space Apps Challenge at c4di Hull

I love hackathons. I actually won a prize at one once. And at another I was part of a team that won a special "most ambitious failure" award (perhaps less impressive). I also love hackathons because they are so good for those that take part. They broaden your skills, let you try out new ideas, meet new people and stretch yourself a bit. They look good on your CV, you can talk about them at interviews. And you get to eat pizza. Lots of pizza.

I'm helping to run a hackathon at the c4di at the end of April. It's in partnership with NASA, and the winners of the Hull heats are entered into the NASA round of the competition for consideration for worldwide acclaim. There'll be a bunch of space related themes that we aren't allowed to tell you about just yet, and all kinds of fun things to do.

It's over the weekend of the 29th-30th of April. You can work all night, or you can nip home for a few hours sleep (which is what I'll be doing). We'll be working at the c4di down at the waterfront, so if we are lucky we should get a nice sunset and sunrise over the water to spur us on.

You can sign up here, and you really should. I'm after team members; get in touch if you fancy working with me.