GameDevHQ Intensive Training Program - 01 - Intro and AI
Tags: unity3d, gamedev, programming
Published: 2021-02-16 05:06:35

I've been programming in one form or another, both professionally and for fun, for over 20 years now. Most of this was in the online space, working with e-commerce and web apps. I enjoy the challenge. I (mostly) enjoy that there's always something to learn. I enjoy making something that starts in my head into a thing that other people can interact with.

I've been playing computer games or even longer than that. I have a particular love for city- and colony-builders, dating right back to the first SimCity. I enjoy planning thing out. I enjoy making life wonderful for my little digital people. If I'm playing Dwarf Fortress I (sort of) enjoy watching my whole city drown in magma because I botched up an engineering project.

Over the past year or two I started trying to combine these two passions of mine and develop my own computer game. It's a slow road, especially since the game I'm building is pretty ambitious for a first go. Still, I'm more likely to see it through to the end if I'm building a game I'm excited about than if I just try and crank out something small and simple that I'll never actually want to play myself. But the important thing is that it got me on the road to learning Unity, and I've been really enjoying that despite the occasional frustrations.

A year ago I joined GameDevHQ, a fabulous community of Unity developers. I took some of their on-demand courses, and I joined a number of their regular webinars where we explored a variety of topics and techniques around Unity development. And this year I got the chance to join their Intensive Training Program.

This is an 8-week course that is all about cranking your skills up that extra notch so that you're "thinking like a programmer". The emphasis is very definitely on problem-solving and not on teaching you to code - there was an interview in order to get a place in the course, and you had to demonstrate that you already knew a reasonable amount about Unity programming. They don't want to take in folk who will find themselves struggling to stay afloat because it is, as the name suggests, going to be intense.

We're going to be building a tower defence game in these 8 weeks. The first week looked suspiciously light-weight in terms of technical stuff, but I suspect that this is because it also has to include setting up our project and Git repository and this is a place where so many things can go wrong. I'm going out on a limb and guessing that next week will be a lot more full-on.

Still, even as low-key as it looked it hasn't been without challenges. The first is that we are given a starting project to build on - all of the assets are set up, things are structured and named in a certain way, all challenges that you don't generally have when you're building your own projects and starting from scratch. If you actually want to work in the industry, whether for a game studio or one of the myriad industries where Unity is being used, you'll almost always be working with an existing project. So this is good experience from that point of view, and I'm taking at as a challenge to follow the existing naming convention for assets and for objects in the hierarchy just as I'd be expected to do if I was working for someone else.

The first task, once we had the project up and running, was to set up a basic AI system on our enemy mechs. This involved using Unity's NavMesh, which I'd never worked with before. I'll admit, I thought for a while I was going to fall at the first hurdle as I tried to make sense of how to bake a sensible walking path for my mechs. I tried a number of different permutations (making the terrain static, adding in extra rocks, etc.) but either my mechs ignored the obstacles and walked right over them, or the walkable areas contracted to the point where there was no longer a contiguous path from start to finish.

Thankfully the other 11 people in the course with me are fabulous and so is our mentor. I was given several pointers - never a direct solution, but just nudges towards different ways that I could approach the problem. And I finally realised how to make it work! Now I have my two mechs trundling through the course quite happily:

{% youtube Q3FMwGAuewo %}

I've also set them up with some basic stats, but they're not doing anything yet because there's nothing for them to react to.

Next up: Spawning enemies automatically.