Book Review: ‘Getting started with Unity’ (PacktPub) by Patrick Felicia

Book Review: ‘Getting started with Unity’ (PacktPub) by Patrick Felicia

The book

A big thanks to Packt Publishing for providing me with a review copy of Dr Patrick Felicia’s Getting started with Unity. Scroll to the bottom of the review for the link to the

Overview

Getting started with Unity is an easy-to-follow introduction to Unity written by Dr Patrick Felicia, a man whose youthful face belies the long list of accomplishments and publications on his blog http://3delearning.com/. His particular field of expertise is game-based learning (GBL), a topic dear to my heart as well. He also happens to be the editor-in-chief of the International Journal of Game-Based Learning (IJGBL) – the man doesn’t seem to mess around! How he finds time to write great books is beyond me – maybe his next title should be about time management?

In the words of the author,

Beginning with an introduction to the user interface, you will learn the necessary skills required to create a survival video game. Each section is a stepping-stone toward the completion of the final game. By the end of the book, you will have created an indoor level with enemies, AI, weapons, objects to collect, and all the logic to control the game.

The book follows an accessible tutorial style throughout and assumes no knowledge of Unity, programming, 3D modelling or any other advanced skill for that matter. It’s pitched to a fairly low common denominator, which is great for beginners but might turn off those of you who already have some prior knowledge of other game engines or a programming background. Felicia chose to only use JavaScript for its relative ease of use compared with C#, another thing to keep in mind if you have prior programming knowledge. The author’s language is clear and the tasks are well-laid-out and move ahead at a comfortable pace for a beginner. However, that is not to say that things move slowly! By the end of Chapter 2 (about 50 pages in), you can already explore a 3D maze level you built entirely from Unity cubes and some free textures downloaded from cgtextures.com – a great motivator for newcomers like me. Indeed, the greatest strength of Getting Started with Unity is how quickly and easily beginners can create a fairly impressive-looking game level from scratch with simple free assets, all the while learning how to use Unity without any prior knowledge. By the end of chapter 5, I was out of my element with scripting AI and setting up Mecanim animation transitions, so there’s something for most people here.

Let’s get into the nitty-gritty.

It took me just under two weeks and was pretty easy - you can do it too :)

The game

A brief chapter overview

Chapter 1 is available for free on Packt’s website under ‘Sample Chapter’, albeit in B&W, like the print book. The eBook uses colour screenshots though, which made a big difference actually, so if you’re thinking of getting this book, I recommend getting the eBook – either by itself or bundled with the printed version. The title of the chapter also contains one of the small bugbears that I just can’t ignore – although Unity is often referred to as Unity3D (especially preceded by a hashtag on Twitter, as in #unity3d), the name of the software is not Unity3D, but the author (like mnay others) keeps calling it that throughout the book. Yes, its website is unity3d.com and the Twitter handle is Unity3D but that’s only because Unity, the engine’s actual name, was already taken (at least that’s my guess). Anyways…chapters!

Chapter 1 is a straightforward introduction to Unity’s interface – how to get around the GUI, transform primitive shapes like cubes and planes – the basics. We also get to make a quick ‘level’: At the end of the first chapter, you’ll have run around on a plane with both a first and a third-person controller, navigating around two cubes, each with its own texture applied, so if you’ve never played with a game engine before, this is pretty cool.

The most impressive progress, though, is the maze you build from cubes in Chapter 2. Within a matter of maybe half an hour, you’ve built a simple level, which your first-person controller can run around in. The textures look quite good, though we don’t go into bump and normal maps in this book– it’s all a fairly flat-looking affair. Nevertheless, if you’ve never used a game engine before, you might be surprised how quickly and easily a level is built if you have the dimensions and positions of the required cubes given to you.

Chapter 3 adds interactivity to the level through scripts. As mentioned above, the book makes do with UnityScript (Unity’s version of JavaScript) without getting into C#.  It’s not an introduction to JavaScript. While the author does explain what each bit of code does, he does not go into details of JS syntax apart from a small note on watching case sensitivity and naming conventions.

Tip: If you don’t know JavaScript or are a programming noob in general, take a look at CodeAcademy’s JavaScript course to get a good overview of variables, functions and how they work within your game.

In this chapter, we learn how to add a timer and a basic inventory system to our GUI, add collectible objects like med packs, make them rotate in the air and take a look at Unity’s tagging system and how it is used with colliders. We also add some basic audio to our objects as well as a basic door animation – all of which adds to the feel and makes your level look more like an actual game. The collectibles and inventory look very basic but do the trick. Essentially, they act as placeholders and could be replaced with something prettier down the line.

Chapter 4 walks you through the process of adding a simple health bar, crosshair to your GUI and delves into using another camera to display a mini-map of your level, both of which are pretty much essential for a FPS-style game. The mini-map also introduces the concept of layers and culling masks in Unity and how they can be used to just show specific objects in your map – very handy! No FPS would be complete with bullets, so our crosshairs get a gun capable of automatic firing (albeit an invisible one), complete with sparks, courtesy of the inbuilt particle system.

A gun would be pretty useless without anything to shoot at, so in Chapter 5 and 6 we take a look at Unity’s new Mecanim system for character animation. We import Mixamo’s free Zombie Character Pack and rig it up in the Animator and define the transitions between five different animations. These don’t all go as smoothly as I’d hoped (zombies walk through each other and walls…sometimes they end up a foot above the ground and can’t be shot) but it’s a good start. The zombies also get some basic AI that is later on refined with the use of breadcrumbs on both the idle and patrolling zombies as well as the player, not unlike a scent that the zombies can pick up on. The patrolling zombies follow waypoints around the level and turn on the player upon sight.

It’s pretty cool, but the last two chapters were above my skill level and although most of the code is briefly explained, I was still a bit lost. Granted, I only had a limited amount of time for this review and will take another look later on

Chapter 6 is all about polishing up the game with creating instantiating prefabs with code rather than dropping them into the scene like I generally do. A health/lives system is built and tied to the health bar, gun and the zombies’ attack animation and a splash screen and menu help tie it all together.

The splash screen to the game you build in the book

The splash screen to the game you build in the book

Bottom Line

Getting started with Unity is a solid title – in as little as 170 pages, you get to build a level from scratch with free assets, a menu, animated zombies governed by some basic AI, create a GUI complete with inventory and health bar and take a good look at the new animation system in Unity…quite a feat.

I read the whole book, followed along all the tutorials and wrote this review all in under two weeks (after working a 9-5 job), so it’s pretty light. The final product is not very polished or extensive but it’s enough to get you started – all the elements are there and that’s the important bit. It also leaves you with a few pages of links on where to go from here.

If you already have working knowledge of Unity, this may not be the best title for you. It’s unabashedly aimed at beginners, and that’s OK. Also, if you’re a C# programmer and don’t want to dip your toes in UnityScript, look elsewhere. But if you just want to see what Unity is all about and create a zombie game from scratch, this book is a great way to get you started – as its title promises.

I’ve found about a dozen game-breaking typos in the book which I’ll be forwarding to Packt this week, almost all of which are related to case-sensitivity in the example code, but thanks to the debugger in the Unity console, these were (mostly) quickly rectified.

My final wish for this book would be the finished scripts. While the scripts of each chapter have been made available, they are generally changed in the next chapter, which means that all the important scripts are different from the ones we can download from the Packt website. Please make the finished scripts available for beginners to cross-check – it would be greatly appreciated!

Here is a link to the playable game, warts’n’all:

http://indiegameschool.com.au/outbreak/outbreak.html

I didn’t refine the game at all and tried to stay as true to what is described in the book as best I could. I added the C64 font for the instructions splash screen and make the mini-map camera orthographic – apart from that, it’s all bog-standard. All music by Kevin MacLeod of incompetech.com and textures are from cgtextures.com.

Thanks again to Packt Publishing for providing me with a review copy of the book. Here’s a link again:

http://www.packtpub.com/getting-started-with-unity/book

If this review was helpful for you, please let us know in the comments.

Cheers,

Guido

1 Comment

Leave a Reply