How much time should I spend a day learning to code?

This is the question I asked myself when I first started learning (well relearning really) to code a while back. Obviously I Googled this and found some really interesting answers, but generally speaking, the common wisdom is about 4 hours a day.

I call bullshit on this. In my experience (and your mileage may vary) you should code every day, but it really doesn’t matter how much. Sure, you’ll get to the destination faster if you’re able to put 4 hours a day, but that number is completely unrealistic for a good chunk of the population.

Personally, I have a full-time job, 2 young kids, and a wife. 4 hours a day is an absurd amount of free time for me each day to work on much of anything. So when I study something I work to a very simple philosophy. Do some study every day. That’s it. Change is all about momentum. You don’t have to stop sleeping to make a change, you just have to show up every day and do something.

Routine is key

My personal routine is to get out of bed early, normally around 5-5:30am. Then I do as much of my course work before the kids get up as possible. Normally I’d get around an hour or so done. Some days I might sleep in and only get 30 mins, but I still progress. To solidify my learning, in the evening I go over what I did in the morning and write up notes. Sometimes those notes turn into a blog post. In that way, I’m sort of doing double duty. Sharing what I’ve learnt and documented it for my own retention all in one.

The thing about learning anything over and above your already busy life is that you have to make it accessible or it won’t work. Lowering the barrier to just do something each day means I might only research something I learnt the day before or add some comments to code I wrote a week ago. It really doesn’t matter what it is, as long as I get started each day.

So if you’re wanting to study but don’t think you have the time? Explore study options that let you learn in small chunks and to your own deadlines. I’ve found both Udacity and Udemy great services for this sort of thing. You won’t get a formal qualification from these services, but if you’re just interested in the skills then does that really matter?

Udacity VR Nano degree retrospective ⏳

When I started my Udacity VR Nano degree I knew I was in for a challenge. Now that I’ve successfully completed my final assignment I thought I’d share some lessons learnt. So in no particular order:

  • Use version control. Thankfully I started doing this very early on. I had heard of the benefits and for whatever reason actually took them seriously. I started a religious habit of regularly pushing changes to GIT. I only used GIT to roll back to previous versions of projects hand handful of times, but had I not had the option I would have had a much bigger problem on my hands.
  • Don’t underestimate the time required. Taking on any study that requires large blocks of time can’t be taken lightly. It’s not going to be enough to only do a 30 min stretch at lunch, or an hour once the kids are in bed. You’re going to need a clear half day at least once a week to make real progress. Also, make sure you know what’s going to consume your time on projects in any given block. No sense clearing 4 hours for study only to have 3 hours of that time consumed rendering a 4k 360 video.
  • Don’t forget to look after yourself. With pressure on your time, it’s easy to cut out things like exercise or time with your family. Don’t do that. Cut out things that are actually a waste of time instead. TV is a big one but also think of ways of compressing your time. Like listening to audio books while you go for a run rather than reading a book alone.
  • Take breaks. If your mind is cluttered you’re not going to learn as well as you might. I found when I spent more than an hour trying to solve an issue the thing to do was take a 20-minute walk, clear my head, then take another crack at it. It’s amazing how often your mind will solve problems for you when you let it.
  • Take notes. Even if you never refer to them, take them anyway. Do this with a pen and paper (or a tablet and a pencil). It’s all about making the information get in your head. I almost never refer to my notes, I don’t take them to remember later. I take them to remember them now.
  • Try and integrate your life into your study. I did this by using my kids as the target audience for my projects and used them as user testing subjects while developing. It let me spend quality time with them and get some study done. It was also an education for them too so a real win-win.
  • Scope out what you’ll need before you begin. I started my course with a late 2009 Mac Mini. While old, it was fine for much of the course. The later parts that required 4k 360 video editing, not so much. This sort of thing can add considerable costs to your study budget so make sure you have a line of sight on this and save accordingly.
  • Get involved in the community. A huge part of successful study for me was the community of learners and educators around the subject. Help others and ask for help when you need it. Don’t waste time beating yourself to death if you get stuck. Solving your problem on a public forum helps everyone else with the same issue in future. So don’t be selfish, ask for help.
  • Be grateful. To your partner for looking after the kids. To your friends for listening to your ramblings about project issues. To your classmates and mentors for helping you along the way. Be grateful.
  • Stick it out. Software development is hard. It’s not supposed to be easy. It is literally constant problem-solving. There will be times you’ll think “maybe I’m just not good at this”. Just keep going.

Done: Night at the museum ☑️

I’ve been AFK for a while (holiday) so I just wanted to post the details of the final version of “night at the museum” I finished a few weeks ago that I delivered as part of my Udacity VR course.

The project went well (in that I passed) but I have to admit it was an exercise in restraint as much as anything. Like a lot of people, I tend to have big plans for everything I make but those plans are not always practical. This project was no exception. While I am ultimately happy with what I created, I do consider it very much a minimum viable project. When it comes to working on assignments like this there are a number of things to consider. First and foremost for me is available time.

I’m totally loving learning VR development, at this point, I spend almost all my free time doing it. But working full time and having a young family is a busy time in life, so if I want to progress projects I have to be efficient with my time or things can stagnate. Also, I currently pay for my studies via a monthly subscription so every extra month a project slips into comes at a significant extra cost.

Just to give you a few examples of compromises made on this project:

  1. Playing content at each of the stations was fairly limited and doesn’t have much finesse. For example, the final build allows the user to play audio from all 5 stations at the same time, this leads to a fairly horrible experience if a user does this
  2. I reused a museum model from a previous project because it was faster than building my own. This means it’s not really an ideal setup. Space feels a little constrained and doesn’t provide much room to move about. Most real museums are quite spacious so it didn’t really fit the aesthetic I was aiming for
  3. I wasn’t that happy with the spatial audio implementation. The environment had a bit too much reverberated for my liking and given more time I would have improved this a bit
  4. There’s no environmental audio, just the content of the stations. I’d preferred to add some atmosphere to the scene just to add the feel of the place

There are loads of other things that could be better about the final deliverable, but ultimately what was made “did the job”. Creating anything is always a series of compromises and I think delivering something you can live with and (resourcing permitting) can be built upon, is more important than getting things perfect. Perfection, after all, is the enemy of the shipped.

If you’re interested in the project’s code, it’s all available on my Github account. Enjoy.

Optimising C# scripts in Unity 🏎

C# logoThe more I create C# scripts in Unity the more I learn about optimising those scripts. With code there are 100s of ways to solve a problem, not all of them efficient, so learning to check your codes performance seems like a must.

Things to look for

So far I’ve come across a few simple things to look out for on the projects I’ve been coding. I’ll post more as I come across them in future.

  • Anything that’s called every frame creates consistent load on the CPU, GPU or both. If what’s called is inefficient or large it will have a negative effect on frame rate. In VR this is particular bad given low frame rates can make your user physically sick. Be sure to look at what’s in the Update and FixedUpdate methods and do your best to optimise the code as much as possible.
  • Working on mobile we will almost always be maxing out the graphics capability of the device. This effects the performance of the Update method. On the other hand FixedUpdated runs in sync with Unity’s physics engine. This will make sure your physics will be the most accurate and consistent. FixedUpdate is called every “physics step”, so is regularly used for adjusting physics (rigid body) objects. Make sure you always put your physics code in FixedUpdate.
  • Avoid using GameObject.Find. It basically requires the system to cycle through all of the GameObjects in the game to find the right one, which obviously is expensive for the CPU. If you know what object we are using ahead of time, define the object at the top of the script and reference it that way. GameObject.Find is useful for testing out ideas, but that’s about it.

Adding spatial audio in VR 🎧

Part of my Night at the Museum project is adding audio descriptions to the objects on display. To do this in Unity I’m making use of the spatial audio capabilities of the Google Cardboard SDK.

As with most things in Unity, there’s a fairly reasoned logic to how this is done. You need three main things:

  1. An audio source. You can think of this as the media player, it is literally the source of the audio within your environment
  2. An audio clip. This is the actual audio file that will be played by your audio source. So think of this as the song that will be played by your media player
  3. An audio listener. This is effectively your virtual ears within the virtual world. Normally this is attached to your main camera.

To give you an example of how I this works in practice. I first attached a GvrAudioListener to my main camera. This will allow my player to hear the sounds produced. Next, add a GvrAudioSource to a GameObject you want to produce a sound. Now load your audio source (your media player) with an audio clip. There are a few different supported formats, any old mp3 will work nicely. Just drag your MP3 into the audio click field of your GvrAudioSource. By default, the audio will play on wake, so just hit play to enter game mode and you should hear your new audio right away.

For more information on the ins and outs of Google Cardboard Audio capabilities, check out the documentation.

Pro Tip:

If you find your audio doesn’t play, try clicking edit -> project settings -> audio and make sure the “Spatializer plugin” is set to Gvr.

More progress 👨‍💻

Managed to get everything to compile to the phone again. Also, I can move about the place now 🙂

The big issue was around the legacy Google Cardboard SDK junking up the project. Completely deleting all SDK related files, old and new, then reinstalling the new was the quickest solution.

Once that was done, recreating key items like the events system and camera using the supplied GVR SDK components made life relatively straightforward.

Big thanks to synthercat for his wise guidance.

Check out the video below.

Clicking and framerate fixed

Getting back on track 🔧

So that thing I broke, it’s getting fixed. Little by little, day by day.

So far I’ve managed to get:

  • VR working properly again (at least I think I have)
  • select objects again
  • the FPS back over 60

Unfortunately I still can’t compile to my phone but hopefully, the weekend sorts that. It’s funny how breaking this thing has been possibly the most educational part of the course so far. I’m not saying I’d make a habit of it, but it was a net positive overall.

Here’s the latest update:

Clicking and framerate fixed

Project: Night at the Museum 🏛

I’m working on a project for my studies with Udacity. The goal is to create a VR experience that demonstrates my research into a VR company. I’ll do a series of posts on this as I progress along the path to completion.

To start here’s my first crack at the initial documentation for the project:

Statement of purpose

The purpose of the "Night at the museum" application is educate the user on the HTC Vive VR solution. The experience is based on an exhibit style scene, which contains 5 "stations", each covering some aspect of the HTC Vive.

Persona

The target audience for this application is anyone interested in VR that would like to learn more about the HTC Vive VR solution. Here’s a basic persona from them:

S03e13_percival_1600x1200Name: Wade Watts
Age: 18
Role: Budding VR enthusiast  
VR Experience: Experience with google cardboard but limited beyond that
Quote: "VR is very exciting, I can't wait to learn more"
About this person: Wade has grown up with computers, game consoles, tablets and smart phones. He's a digital native that loves to escape into his devices. VR is the ultimate expression of that escape.

Concepts

I’ve started by looking at different museum and exhibit styles to select a something that fits the aesthetic I’m looking for. After looking at altogether too many museums (if that’s possible) I eventually settled on classic Greek style building with exhibits setup like sculptures on pedestals. I’m using the following images as inspiration for the design:

I like this style, it reminds me of some of my favourite museum tours, and I’ve also done some work in a previous project that shares a similar style. This should allow me to reuse some of the assets from that project, meaning I can move faster. Always important when you’re pressed for time.


Concept build

Having established a concept for the style of the experience a setup to make a concept build. Using the assets from previous work made putting something workable together relatively easy.

I added a terrain GameObject with a few mountains in the distance to give the scene a sense of depth. I dropped in a “temple” model that is a good fit for a museum and added a few items to flesh out the concept. For the actual stations I acquired an HTC Vive model from sketchfab user Eternal Realm.  I also kept an eye out for the scenes frame rate to make sure I wasn’t introducing anything at this early stage that had a big impact on performance. I still have a few more models to acquire but I’m happy with the direction the concept is heading in.

Screen Shot 2017-08-16 at 9.06.16 PM
A view from a potential starting position for the user.

Screen Shot 2017-08-16 at 9.06.29 PM
The users view approaching the entrance of the museum itself.

Screen Shot 2017-08-16 at 9.06.37 PM
A simple example of what a “station” may look like within the museum. A floating Vive headset over a stone platform.


Next steps

Now that I’ve got the basics in place the next thing on the agenda is the first round of user testing. I shouldn’t have to much trouble acquiring a suitable test subject to get things moving. I will be interesting to see how the scene changes and progresses over the course of development.

VR: Reshaping industries 🤔

As a bit of a thought experiment, I’m taking a look at an industry and imagine a VR app might reshaping it.

Given my family’s always been in the construction industry (flooring), I thought it might be interesting to look into a segment of that market; medium to large scale commercial building construction.

To that end here’s a concept for an application that would help a site foreman and workers during a construction project to visualise the job to be done.

Statement of purpose

Create a virtual version of a construction site that shows the project at various stages of construction. Allowing the team to collectively understand what is to be done and how things should be at various stages. The application should also demonstrate hazards on site without exposing workers to those hazards.

Persona



Age: 30-65

Occupation: Site foreman

Name: Alex

A Quote:

"A 200 page job spec might be required reading, but no ones actually across it all. It would be great to be able to see the spec and show it to others to explain the detail"

2–3 sentences describing what motivates them:

Alex works long hours, and carries a lot of information and responsibility in their head. A key part of Alex's role is communication and having better tools to align everyone's activities on site are critical to a success project.

Staff safety is also a top priority. Giving people a clear understand of what's going on across the site keeps everyone safe.

Their experience level with VR:

Little to none

Q and A

Q: How accessible would each VR platform be to your target student in terms of price? Take into account location, age, and income.

A: The only platforms that are really accessible is Cardboard/Daydream or Gear VR style VR. A construction site can be a busy, dirty place. An expensive tethered full immersion rig really isn't practical on site.
Q: How interactive does your lesson need to be? For example, do I need to pick things up or could I get away with just looking at objects?

A: The user needs to be able to look at various objects, select them and have some details displayed to them. Movement would be required to view various scenes but does not require movement within a scene.
Q: How realistic do your visuals need to be in order to teach? For example, could I use 2D images and videos in a 3D Environment or do you need high poly 3D models.

A: images clear enough to show construction detail and highlight hazards is sufficient. I would also be useful in some cases to be able to show exploded views of constructions, but this could also be done via images or simple animations.
Q: Does my student need to feel like a participant in the experience or can they be a passive viewer? Could they be both?

A: Primarily they could be a passive viewer. The purpose of this app is to give the user a sense of what's going on, what needs to be done and what safety issues there are. There's little to no complex interaction required.
Q: Given the answers above, what are potential platforms you could use for your experience?

A: In this case I think any platform could work, providing the right conditions. For example a dedicated space would be required for a high immersion setup. Having said that it would be far more practical to use a mobile setup on a construction site.

VR course exercise 🤔

As part of my VR course, I’ve been asked to perform a bit of a thought experiment. The outline of this work is:

Imagine you want to make a VR Education Application. This could be an exploration of the solar system, looking at fine grain detail of the human body, or teaching somebody how to program, just to name a few topics. For this experiment, pick any topic you would like to teach. And don’t worry if it doesn’t make sense in VR, we will worry about that part later. Just something you are passionate about.

The requirements include defining a statement of purpose, a persona for the target audience, answer a few short questions and post it to Medium. Given I have my own blog I figured I’d also post it here:

Statement of purpose

To demonstrate the Vet teaching hospital facilities at Massey University to prospective students.

Persona

High school students

Age: 17–18 years old

Occupation, if any: High school student

Name: Sam

A Quote: “I love working with and caring for animals”

2–3 sentences describing what motivates them:

They love working with and caring for animals. Learning in the best environment possible is important to be effective at their jobs. They want to become excellent, leaders in their field, to have the greatest impact. They are likely unsure of their specialised, but would have some idea of the options available. They already know they care for animals but are likely unsure of what the day to days of being a Vet are, but will be highly motivated to learn.

Their experience level with VR

May have had some small exposure to VR and education events or possibly in school. Given its still early days in the tech itself, it’s unlikely they are highly experienced.

Q and A

Q: How accessible would each VR platform be to your target student in terms of price? Take into account location, age, and income.

A: Accessibility of the various system is wildly different.

Mobile
Most high schoolers, of this age, have smartphones and the means to acquire a cardboard headset. Also, headsets could be supplied by the provider via the post, or at events.

High immersion
Much less accessible. The most likely source for high immersion would be the PlayStation VR and it’s unlikely prospects would think to use this given its context for gaming. The Vive and Oculus don't have enough presence yet to be meaningful for this use.
Q: How interactive does your lesson need to be? For example, do I need to pick things up or could I get away with just looking at objects?

A: The experience is purely to show off a facility and teaching capabilities, so only basic interaction is required. Select objects for more details or to play videos/animations.
Q: How realistic do your visuals need to be in order to teach? For example, could I use 2D images and videos in a 3D Environment or do you need high poly 3D models?

A: 2D images and video would be ample to communicate what needs to be communicated. If in future there was a need to train in the use of equipment etc then a more immersive VR platform would be required.
Q: Does my student need to feel like a participant in the experience or can they be a passive viewer? Could they be both?

A: To a certain extent they could be both. Selecting options (pick a path style) or just following a set path. Having the option is likely a good idea given repeat users are likely to have something specific to see rather than the whole walkthrough. So it would be good to be able to skip to the parts they are most interested in.
Q: Given the answers above, what are potential platforms you could use for your experience?

A: Given the limited access to high-end VR hardware, mobile VR (aka cardboard/daydream/gearvr) are likely the best targets. It’s fair to say highly immersive VR would be richer, but given it would reach far fewer people it’s not really relevant for outreach activities like this. The fact the content could also be easily reused and delivered via the web is also a plus for mobile.

Future technologies

Future tech – Microsoft Research: NormalTouch and TextureTouch

A few questions to consider with regards to future technologies:

Q: How would Augmented Reality better help teach your experience?

A: In this case, it likely wouldn't be. Given we are attempting to educate student prospects on what the facilities are actually like at the University recreating that experience is better suited to VR. Augmented reality could potentially be used differently if you wanted to demo a particular part of the experience, such as show a horse on a large animal MRI machine, at an event. This could give prospects a real sense of scale relative to things around them.
Q: How could eye tracking help you better tailor your experience to your students?

A: Using eye tracking to understand the users focus within an experience could enhance our ability to provide depth of field. Making the experience more natural for your eyes. We could also use I tracking to monitor what users are looking at and use this information to improve the experience over time.
Q: How would better Haptics better teach your experience?

A: Introducing a tactile feel to the animals in the environment could provide a great sense of immersion and connection with the animals. The more real it seems the more convincing it is as a sales tool.
Q: How important is graphical fidelity to your experience?

A: Given the experience is likely relatively short users are unlikely to experience eye strain. Also, we are only attempting to highlight the environment the student will be in a demo the sophistication of the facilities. Given this is the case, it's not completely necessary for the graphic fidelity to be top of the line. Having said that, improved displays that take advantage of light field technologies would vastly improve player comfort and as a result will be essential and common place in the future.
Q: How critical is it that your target student receives this training within the next two years?

A: As the university expands internationally it's of increasing value to demonstrate to international prospects what facilities are on offer without them having the expense of physically travelling to New Zealand to see them first hand. Using VR allows them to get a sense of the place, helping them make more informed decisions.