Categories
personal unity

My Year’s Journey

In December 2019, I decided to commit myself to learning a new skill, something that would be different than what I had done before. I also wanted to do something that would help create a lot of communication with my kids – unsurprisingly, they are not excited by discussing inventory levels or lambda functions, so I decided to take a whack at something more relatable to them, game development.

The last time I programmed a game was the 1980’s on an IBM PC running DOS working in Microsoft QuickBasic. So I started by Googling around for how to make games, found some systems based around javascript, said “Hey, I know that”, downloaded PixiJS and started learning.

PixiJS was actually pretty easy to pick up and work with, but the danger of sticking to things you are familiar with is that they are sometimes ultimately a poor fit for what you are trying to do. You can do a lot with JS – if you wanted to create embeddable, interactive web content, PixiJS is probably a decent direction to go in – but its not how 90+% of the gaming industry does there work and it ultimately limits your capabilities. You’re going to have a hard time creating immersive 3D in JS – or VR, or AR, or creating something that can run on a Switch or a PlayStation.

In the game industry, 90+% of everyone, from the single developer self-producing their own title to the AAA shops that put 100+ developers on a game at a time, use either Unity or Unreal. If you’re going to learn how to make modern games and you’re not using one of those two, you should look yourself in the mirror and ask what is so special about your requirements that you would not go down those paths. There are some legit use-cases to not use Unity or Unreal: maybe you only develop in the Apple ecosphere, never want to leave it and already know Xcode; maybe you need to make something that will run on a Raspberry Pi; maybe you really do just want something to slap on a website and that’s as far as you want to take it. For most everything else, you should really try Unity or Unreal.

I spent January 2020 trying both Unity and Unreal. They are both very good gaming IDE’s. In the end, I chose Unity. Why?

  • Better online training
  • Easier to code against

Unreal is a very, very good system. There is a reason why many high end games use it and why its making deep inroads into movie productions. Its graphics capabilities almost certainly eclipse Unity’s. It also seemed to me to be very geared towards people who do not want to code – most changes are done via graphs, so what could have been one line of code turns into adding a dozen nodes to a graph and interconnecting them and setting their properties – to me, that’s significantly harder than writing one line of code. As a result, the training videos are often a monologue of someone saying “now click here, then click here, and then click this, then drag this and click that and drag the connector to click next to the last click and then click again” – that’s a huge turnoff for me personally. I might revisit Unreal at some point.

unity is a good thing…

Unity is much easier to write code against – its a strength to their IDE that is often also criticized as a weakness, because you will almost certainly have to write code at some point to use Unity (although they recently added Bolt visual graphing so you can do more things without writing code). Their tutorials tend to come in “programmer” or “designer” flavors which I greatly appreciated and, generally speaking, I found myself up and running much more quickly than with Unreal.

I spent February and March going through Unity’s Create with Code course: https://learn.unity.com/course/create-with-code. Its a 40 hour free course, but if you’re considering using Unity and you have a programming background, I would recommend you do it. If you have a programming background, you’re going to find that tutorial very basic, however, part of what its trying to teach you is not just how to write code, but when to write code – and this is a very important distinction that took me a while to get my hands around.

Unity comes with a physics engine built in. You might think, “ok, that’s nice, but who cares – I can write code”. No, stop – do not get your old college physics book out and start writing code that describes the arc a physical object traverses while flying through the air with force applied to it. Instead, put a rigid body component on your object and simply apply a force to it – Unity will figure out how far it travels and where it falls – then add a collider to trigger an event when the object hits the ground, you know, like an explosion on landing.

If you work on a billiards game, for instance, you can simply put all the pool balls out there, wrap them in rigidbodies and colliders and just let them knock into each other and roll around however they see fit. The only code you really need to worry about is how the player controls the cue stick – everything else is just the physics of “solid” objects reacting to collisions and rolling around. This makes it incredibly easy to, for example, add obstacles to increase the amount of ricocheting that happens in the game without adding any code. Or to “slo-mo” everything by decreasing the speed of time, freezing everything in place by turning time off, controlling speed by increasing or decreasing drag or controlling the strength of gravity – these are all either settings or one-line code changes.

You do a lot with colliders in Unity – colliders create triggers when things touch each other. Colliders, combined with the physics engine, make it possible to implement games in a very “event-driven” model – if you embrace the approach, you will find it very flexible and it will reduce the number of lines of code you write. Flattery’s initial release, for example, was just over 3K lines of code – I’ve written HTML pages with more lines than that.

As a programmer, I found a lot of new concepts that I needed to get my head around – I had no idea what “normals” or “inverse normals” or “baked lighting” were let alone what the difference was between “shaders”, “materials”, and “textures”. And quaternions – omg – “a complex number of the form w + xi + yj + zk, where wxyz are real numbers and ijk are imaginary units that satisfy certain conditions.” There were also a lot of considerations about game mechanics, what makes for good game play, how do you legally get music and artwork that can be distributed with your game, what kind of privacy policy do you need – the list goes on and on.

I spent most of my “covid lockdown spare time” going through all these kinds of topics and considerations. I was happy that I was using Unity – it gave me common ground with thousands of others out there who were ready, willing, and able to give pointers about what to do or why to care. I also spent this time torturing my kids with review sessions – they were my “UAT testers”. They were very good at giving me constructive feedback and I don’t think I could have completed Flattery without them. Those review sessions were some of the longest discussions I have ever had with my son and daughter about software engineering – some review sessions literally went on for over two hours.

Somewhere around summer 2020, I decided I wasn’t going to be happy with myself unless I actually finished a game and got it up on the Apple App Store. I originally targeted Labor Day, but it wound up being Thanksgiving when I submitted the first build to Apple (for the record – no, I did not get approved first build). It might not be the greatest game ever, but I learned way more than I ever would have thought and got to spend a lot of time with my teenagers collaborating on a project and that was really awesome.

I would highly recommend Unity for any kind of multimedia development (anyone remember Macromind Director?). I would also highly recommend this as a path to do something with software collaboratively with your kids – just remember, they are your target market, they are the business sponsors, listen to them, take their feedback seriously and they’ll feel more engaged.

Feel free to check out Flattery (its free): https://apps.apple.com/us/app/flattery/id1542242326