Monthly Archives: January 2016

Jumping back into gamedev with Unity

My motivation

As I’ve been getting older, I’ve found a simple trick for introspection: look at yourself a decade ago and ask that person what makes him happy. The core parts of you, the essential parts of you, probably haven’t changed much. For me it was 3 things: boardgames, video game programming, and first-person shooters. Those are the only things that would regularly get me out of my own head.

Other things, however, have changed in the last 10 years. First, for some reason I seem to have a 1/5th of the leisure time that I used to have as a kid. Second, someone now pays me to program 8 hours a day. Suddenly, the idea of spending 2 hours every night working on video games seems onerous, burdensome. It’s just not as fun when you spend every day programming stuff.

But, as I said, your core self rarely changes. Just because you don’t have the time or energy to be passionate doesn’t change what gives you joy. Growing up is kinda like being a pokemon and going through evolutions. You are still some Blastoise

Adulthood. It’s like having cannons coming out of your shell.

Since I got married, I’ve started playing a boardgame every night with my wife. It’s really been beautiful to watch. It’s great seeing a hobby you thought was lost forever, come back to life. It reminds me of the signs at the dormant

Your passions. Not dead, just dormant.

Now that boardgaming has come back to life for me, next up is reviving game development. Of course, since it’s been 7-10 years since I’ve really been into video game programming, my analogy is more like the

Jumping means my game is inherently better than Stanley Parable

It’s not a lot, but I can already see a lot of the power and appeal of the tooling. Additionally, the tutorials are top notch and very easy to follow. I really expected working with 3d to be a lot more intimidating.

Overall thoughts

Even after working with Unity for less than an hour, I have a few first impressions.

It’s easy to get started

The first tutorial takes just over an hour to complete. At that point you’ve created the minimal definition of a 3d game. It would probably have taken me a week to do all of that from scratch, hand writing OpenGL calls.

It’s also got a very quick debug cycle. You code something, test it, make a tweak, test it again. It’s literally as simple as hitting play on the scene. Additionally, much of the details are accessible as GUI controls. This is especially cool when it’s your own custom scripts. All public variables on your scripts become editable. You can even drag and drop, if the variable is a game object. For example, for the camera controller we drag and drop the player object.

image

It seems really well polished

I don’t know if there is any one thing I can point to, but overall a couple of things stick out:

  • The UI seems fairly easy to navigate.
  • There are a ton of features regarding components or physics.
  • I can see right away how I could use the power of C# instead of being limited.
  • It makes adding behavior to an object super simple. Just a few lines of code and your object is controllable.

It just seems like a quality piece of software. I’ll be interested to see how it looks after 100 hours isntead of just 1.

It’s different than what I’m used to

Unity does things very differently than I have in the past. Using components over inheritance is new to me. I can see how it makes it really easy to add behavior or functionality to entities.

Another thing is there seems to be a heavy focus on encapsulation and separation of concerns. Components have functions for the event cycle: start, update, fixedUpdate, lateUpdate, onDestroy, etc. The components know only as much as they need to, and you have to work to go outside of that. I’m used to one giant loop of logic and processing behavior manually.

My way or the highway

One of the downsides of using a framework or engine is that there is usually a “right” way to do things. The downside of having guard rails is when you want to go out of them. Working with Unity, I definitely get a vibe that there is a “Unity way” of doing things. Not in any way that is a problem at first. But I immediately have a few questions in my mind:

  • How do you determine which entities get processed first in an event? Do you have any control?
  • How do you handle mass interactions between entities?
  • What if you want to use a different physics engine?
  • What if I don’t want to use scenes?
  • What if my whole game is procedurally generated?

It’ll be interesting to see if it presents a problem or not.

Final thoughts

Overall, I’m very excited to be learning Unity and see where it takes me. It’s used by tons of indies and has a lot of potential.