Game Development Software: Unity Free

I’ve decided to do more in-depth reviews of the software I use. I’ll start by detailing the various features in one of my favourite pieces of software I’ve used so far, Unity 4 Free.

unity-logo

What is Unity?

I’d be surprised if you haven’t heard of this already – just a quick Google search for “free game engine” will return it as the top result. Unity is a 3D game engine that’s designed to speed up and streamline the development process, while providing all the powerful features you’ll find in similar products. While some features are restricted to Pro (such as realtime lighting and post-processing effects, I’ll be talking about these later), the free package contains most of the features you’ll need. So don’t be put off by the fact that a Pro licence costs $1500 in one payment or $75 a month, just go download the free version to see if you like it.

The Unity Editor

unity-editor

The Unity editor, your window to making the games of your dreams.

The editor itself was designed with customisation and workflow in mind. You can see a load of windows in this screenshot, each of which can be freely docked on any side of the screen, or even pulled into a separate window if need be. Each window has a specific function:

-On the left is the hierarchy pane, which lists all the GameObjects (this is what Unity calls any old object you lob into the level, which are called scenes). GameObjects can be stacked (or ‘parented’) onto other GameObjects, in a hierarchical manner, hence the name of this window.

-On the right is the Inspector view, which frees up all of the variables and components attached to the active GameObject so they can be changed easily without having to delve into the source code and change variables directly.

-On the bottom is the Project pane, which lists all the assets available for your game, which can be dragged and dropped straight into the level.

-Most importantly, in the centre is the Scene view, where all the action happens – this is where you’ll be moving around all the GameObjects in the scene to build up your level. Here you can see the currently selected object, my player, and the gizmos that represent some of the components on the player, for example the blue sphere is an audio component, and the white cone is the main camera’s field of view. Once you’ve finished building the level the way you want, you’ll want to test the level –  in Unity, this is a breeze, as all you have to do is click the play button at the top-middle of the screen, no waiting screens, no lengthy compiling required, just an instant transition from the Scene view to Game view, where you’ll play the game as if it were a proper build of your game.

Scripting with Unity

Unity provides the functionality to program with your choice of three programming languages, C#, Javascript and Boo, and a script in one of these languages can communicate seamlessly with a script written in either of the other two. A plethora of classes are available for manipulation from the start, giving you complete control over any GameObject and all the components attached to it, the physics engine, the inputs used in your game, everything. Unity provides comprehensive documentation on all aspects of scripting with Unity, just take a look at the Unity manual and look at all the classes along the left-hand side to see just how much of the engine is under your control. And if you’re completely stumped at how to start programming with Unity, there’s a whole playlist of tutorials on Unity’s official YouTube channel, plus Unity provides Live Training on its website every so often, the archive of which can be found on their YouTube page too. Unity ships with MonoDevelop, an IDE (Integrated Development Environment), which is very handy as it’ll error-check and auto-fill everything that’s specific to development with Unity. Also, it’s important to note that the Javascript used in Unity is a slightly modified version called Unityscript, although it functions much the same as conventional Javascript.

unity-mono-develop

This is MonoDevelop, the IDE that’s provided with Unity.

If you don’t like MonoDevelop, or just prefer another IDE, then you can set another default program by going to Edit->Preferences->External Tools, then change the external scripting editor by browsing for its location on your computer.

The Asset Store

Having trouble modelling a character? Need a few more ambient sounds for a dark alley in your level? Completely stuck and need a completed level to use as a starting point? Then someone’s bound to have done it already on the Asset Store, an online marketplace foe everything you’ll ever need in Unity. From editor extensions to particle effects, models, animations, textures and even complete projects available on the store, you’ll be hard-pressed to find something that’s not on here.

unity-asset-store

The Asset Store will be your go-to place if you’re looking for something to use with Unity.

There’s plenty of stuff that’s completely free, plus there’s occasional sales, giving you a lot for a reasonable price. If you’re going to be developing with Unity, then a good free package to start with is the Sample Assets package provided by Unity Technologies themselves, which gives you a fully rigged and animated character controller called Ethan, multiple vehicles, and many other assets to help you out at the start.

In-game lighting and lightmapping with Beast

Unity has built-in support for the Beast lightmapper, a powerful tool that will bake static shadows onto your level, cutting down on the realtime impact of calculating shadows every frame. You can set how detailed and how strong the shadows are, which lights will be casting shadows and which objects will receive these static shadows, then click bake and Beast will automatically create very detailed lightmaps for you in a relatively speedy process. Back in the editor, there are four different types of light – point lights are like light bulbs and provide light emanating from a point in space which falls off with distance, directional lights act like the Sun and provide uniform light in one direction across the whole level, spotlights are self-explanatory and provide a cone of light from a point which falls off with distance like the point light, and area lights which are Pro-only, so I have no idea how they work. One massive drawback to Unity Free is the lack of realtime shadows – only one directional light is allowed to produce realtime shadows in Free, but no point lights or spotlights will cast realtime shadows, a truly disappointing omission, but not one that’s so huge as to prevent you making a good game with Unity Free.

unity-lightmapping

This is the sort of result you’ll get after creating lightmaps. These are the plastered on top of your game geometry to simulate lighting.

Nvidia’s PhysX Physics Engine

Unity uses the PhysX physics engine developed by Nvidia. It’s a very comprehensively constructed engine, handling collisions between objects, applying forces and gravity to them, and moving objects realistically due to the acceleration produced by these forces, all while allowing complete realtime modification through scripting. I use this functionality a lot while developing with Unity, so having so many functions available is helpful. Not only can forces be applied to objects in one direction, but explosion forces can be applied from a point in space to all nearby rigidbodies (physics-affected objects have a Rigidbody component applied), object’s masses or drag can be modified directly to affect motion, and collisions can be used to initiate events in-game. The physics engine supports the use of joints too, such as hinges or springs, and it works in both 2D and 3D, with dedicated components and functions available for both.

unity-physics-explosions

Explosions, just one of the effects you can achieve with the physics engine. And yes, this is my game, which you should be following by now.

Shuriken Particle Systems

Particles are important for applying a final touch to a game. Whether the particle effects are just debris from a gunshot or something much larger like a collapsing bridge, they add a lot to any game. Unity uses its own particle system, Shuriken, to handle particle effects. This is completely customisable as with everything else in Unity, allowing you to modify the speed, direction, rotation and size of individual particles, and change these over time too. Then you can change the force applied over time, the colour, transparency and lifetime too, as well as the particle texture which can be a spritesheet as opposed to a single texture, allowing a lot of room for creating the effect you desire. The particle themselves can simply be billboard textures, so they always face the camera, or a mesh, so physical 3D objects are emitted by the system, and they can even handle collisions, with different levels of quality to preserve performance if needed and the option for collision callback messages to be sent to scripts, so you can make events occur when a particle hits a surface. If you don’t have the time or resources for this, there’s plenty of particle systems on the Asset Store.

unity-shuriken

These are some of the many variables you can choose from when making a particle system. The grey bars can be expanded to give even more variables and many can be disabled if not needed.

Terrains

Unity also has a terrain generation feature. A terrain is simply a large mesh that will make up the majority of the ground of your level, with a terrain collider attached to it and the ability to add multiple textures to the surface to represent realistic ground. To create a terrain, you can go to GameObject->Create other->Terrain, then you’ll need to select its size and height. If you select something a little too big then that’s not a problem, you’ll just have to improvise and construct your world so some areas are blocked off, but make sure it’s not too small or you’ll have problems, because it’s a bad idea to resize a terrain you’ve already shaped and textured (something I’ve found out the hard way multiple times in the past). Initially, you can carve out the shape of your terrain using the raise, lower and smooth terrain brushes, which have options for the opacity and size of the brush, then you can paint the terrain with multiple, blend-able textures. It’s an easy-to-use but powerful feature, and is highly optimised so it should even work well for mobile projects. You then have the ability to add static meshes to the environment, such as trees, rocks or grass, which will be ‘batched together’ for increased performance. If that wasn’t enough, Unity has a very detailed tree editor, allowing for the randomisation of trees so a variety of shapes and sizes will be distributed across the environment.

unity-terrain

This terrain is from an old, abandoned project of mine. The trees are very slightly different from one another to mimic natural deviations in tree shapes and sizes.

Speed of development

Unity really shines when it comes down to speed. The instant playtesting feature is so useful when you’re prototyping and squashing bugs, or when you’re trying to find the best amount for, say, an enemy’s attack stat – just tweak the variable in the editor using the Inspector view, instantly play the game, then tweak it a bit more, even while the game is still running, so you can see the result straight away. Unity also has a genius Prefab system, whereby you can create one item for your game with a load of components and variables associated with it, or even child objects too, then you can turn this item into a prefab, which can then be dragged and dropped into the game as a perfect copy of the first item. Plus any changes to the source prefab will then affect any GameObject that’s associated with it, so it saves having to edit tens or hundreds of individual objects in your scene. This makes creating your game world easy and efficient.

Exporting to many platforms, plus your toaster

Unity supports publishing to so many platforms with little to no tweaks needed to your code it’s ridiculous – the same project cam be published to, hold your breath – PC, Mac, Linux, iOS, Android, Windows Phone 8, Blackberry 10, all major web browsers, and even Xbox 360, all recent PlayStation consoles and both Wii and Wii U. Of course, the consoles require licences from the respective companies, and publishing to iOS requires an add-on (which costs $1500, but a hit game on iOS is well worth the initial cost), but this is still a massive array of publishing options. The Unity Web Player itself is a fantastic platform, as you can deliver your game on all major web browsers with a few clicks, while the game itself will be so highly compressed that the user won’t need to download gigabytes of data to play it, allowing for instantaneous streaming of your game. The number of available platforms grows over time too, so you’ll never be short of a prospective audience.

unity-multiplatform

All. These. Platforms.

What’s missing in Unity Free?

A few major features are missing from Free but present in Pro. Firstly, as mentioned before, there’s only one realtime shadow in Free from one directional light, but in Pro you can have as many realtime shadows as you want, which can sometimes be the difference between an alright game and a fully immersive experience. Plus Pro gives you area lights, but I still have no idea what they are. Pro also utilises occlusion culling to increase performance, whereby objects that are obscured by another won’t be rendered at all. This isn’t to be confused with ambient occlusion. Think of a wall, with a small cube behind it. In both versions of Unity, the back face of the cube and wall, and perhaps some side faces depending on what angle you’re looking at them from, won’t be rendered as they’re facing the other way, but with Pro’s occlusion culling, the cube won’t be rendered at all because it’s obscured (or, occluded) by the wall. This saves your GPU lots of work with minimal CPU overhead.

Pro also gives you the ‘render to texture’ feature, which allows you to take a camera’s view and make it into a texture for use in, say, a TV screen, or to take screenshots. It can also be used for mirrors, or reflective water surfaces, so it’s a very powerful feature when put to good use. Pro also has a profiler bundles with it, which shows you where resources are being used in your game, for the detection of bottlenecks. It’s a helpful tool for increasing the performance of your game.

While Unity Free has a pathfinding tool built-in, Pro expands upon it massively, allowing more control over where characters using the pathfinder can move, and how they transition from area to area.

Another large feature missing from Free is post-processing effects. The ability to take a frame then add effects such as anti-aliasing, glow, bloom, motion blur and colour correction enhances your game graphically. This sort of feature is present in the free versions of other game engines, so it’s a feature I’d like to see in Unity Free. Also, games published with Unity Pro don’t have the Unity watermark when started up.

Summary

Unity Free is a very powerful, giving you a feature-set that will allow you to make very complex games. The sheer amount of help online from Unity is astounding, plus the comprehensive Unity manual, which can be viewed offline, explains every part of Unity very clearly. The community is extremely helpful too, with forums accessible for those with questions on any part of Unity, and for people to show off their work, completed or in-progress. The speed of development of games with Unity is above that of most other engines, and the sheer number of platforms you can export to means that your possible audience is as big as possible. There are many built-in features provided to aid you in making all genres of game, such as terrains, particles, physics, lighting and lightmapping, and even pathfinding. With Unity 5 just around the corner, now is an exciting time to be a game developer with Unity. However, the free version suffers from some missing features, such as realtime shadows, post-processing effects, the profiler tool and render-to-texture, some of which are found for free in similar game engines such as Unreal Development Kit or Source. If you’re an indie developer and you’re looking for a fast but powerful tool to fuel your game, then this is a brilliant place to start. Unity is a game engine you won’t regret downloading.

If you have any opinions on Unity, then I’d quite like to hear them. Maybe you also have some other great engines you’ve used that you’d like to suggest to people starting out with game development too? I hope you’ve had fun reading, and have fun with Unity if you choose to have a go at it!

Advertisements