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

Guns, Lasers and Powerups – Project Spikes 24/11/13 Update

I swear the game will have a proper name soon enough, but more importantly there’s a new update, and it has lasers in it!

Image

The laser gun, shown above, is used to burn obstacles in front of you, such as these cubes. They will then shrink until you’ve burned them into nothingness and they disappear, with loads of particle effects, and of course a vibrant blue laser! There’s also the new Destruction Gun, which is a one-shot device that will instantly kill the cubes and vapourise them. Even better, these two guns can be used against turrets to destroy them. There are icons for each gun to sit at the bottom of the screen when you’ve found them too. To switch between them, you can use the number keys 1-3, and later I will add scroll-wheel support too. The destruction gun costs 2 gravits per hit, the laser gun 1 gravit per half-second, and the force gun still guzzles 1 gravit every hit.

Image

I’ve also been working on optimisation, taking out as many unnecessary parts of the game as possible so the game should run as fast as it can, even at high graphics settings, which is why I’ve changed the geometry of the levels by switching most of the level from 3D cubes made of 6 sides to 2D squares with only two sides. That still allows me to texture the level in pretty much the same way, but reduces the number of draw calls by about two thirds, so it’s a massive optimisation which will have minimal effect on the actual gameplay.

Image

There are also new powerups, which will be placed in levels so that the player can use their unique abilities to solve new puzzles. This one, for example, gives the player an ‘antigravity jump’ which causes gravity to be reduced greatly, another speeds up time so the whole level moves quicker. They’re all pretty cool effects, which you can try out in a new level, the Testing Area, which you can access through the Start Menu. Talking of the start menu…

Image

…it’s also had a bit of a makeover. It looks a damn sight better than the boring old screen, but does pretty much the same thing. All the information signs in the game have been changed so they are unlit, which means they won’t appear too dark, after feedback I received. Additionally, the field of view changes when the player is running, and a set of crosshairs appears under the player when airborne to show where you’ll land, two more features suggested to me. Also, in the options menu, there are a few more graphical options that disable shadows, in case your computer is extremely slow. You can play this new update by clicking this link.

Have fun playing, I hope you all have some good feedback for me 🙂

Oh yeah, and it’s probably best to avoid World 1 Level 5, it’s not been fixed yet. Just a heads-up.

-Daniel

Fun With Physics – Project Spikes 26/10/13 Update

Play it here!

This update is pretty sweet, it improves greatly on some previous levels, particularly World 1 Level 4, which has been redesigned and textured, and now features a new game mechanic: the Force Gun!

spikes-25This gun can apply forces to certain objects, such as the cubes in the background of this picture, or the spiky death balls introduced in Level 4, when the mouse is clicked. If you left click, it’ll blast the object away from you, and if you right-click, it’ll pull it towards you, both accompanied by a particle effect, an animation and a sound. This paves the way for new puzzles which require moving around crates and other objects, and enables you to shoot away incoming hazards.

spikes-26As part of World 1 Level 4’s revamp, I’ve re-textured the entire level to fit the world’s light blue theme, such as the walls and spike balls. The main new addition in this update really comes into play in this level, as you must use the Force Gun to move wooden crates and enable you to jump over a wall. The small yellow thing is a new pickup that fills the force meter, the yellow bar under the health bar which shows how much power the Force Gun has left. They’re called gravits, after the force of gravity, showcasing how bad I am at naming things, part of the reason I can’t think of a name for the game yet. They have pickup sounds too, a bit like a retro coin pickup sound.

spikes-27

Each world will now have a level that acts as a hub: these levels have a practice area to get to grips with new features, and a cube to transport you to each level in that world. In the future, you will only be able to access the next world after beating all 5 levels, but right now you can simply challenge level 5 in the first world and finish that to advance straight to World 2. The practice area in World 1 gives the player the Force Gun and a few cubes to practice firing them around the place and get used to the gun. In addition, the black cubes at the beginning of each level will return you to the hub, rather than to the previous level.

spikes-28The tutorial screen has been improved too, adding textures, more boards to show you the controls, and a button to take you straight to the newest level in the game (also present on the start screen) – currently, this is World 1 Level 4, and in the future will be used for easier testing of the levels and to simplify getting feedback from people.

spikes-29

Another noteworthy update is the addition of a model and particles for checkpoints, making their presence a little more obvious.

There are even more features listed below. Here is the link to the game, and as always I hope you have fun playing!

NEW FEATURES:
-Redesigned World 4 Level 1, adding the Force Gun and textures.
-Force Gun, left click to blast away objects, right click to pull them in.
-Force meter to show the remaining Force Gun power.
-'Gravits': new pickups to fill the Force meter.
-Sounds added for pickups, menu selections and the Force Gun.
-Hub levels for each world, World 1 Hub has Force Gun practice room.
-Black cubes return player to hub.
-Much better checkpoints - model and particles.
-Textures and test button added to Tutorial screen.
-Spawners that spawn objects in the level - present in World 1 Hub.

Project Spikes: 14/09/13 Update

Play it here!

This update has quite a few new features, so give the game a try –  any feedback is appreciated! Firstly, I added a few coloured skyboxes (a skybox is a textured cube that will appear really far in the distance in your game and surround the game world, like a background), with all of World 1’s levels having a light blue skybox.

spikes-6

This is much better than the really horrible basic blue skybox from before. I’ve also done a bit with the GUI, adding some crosshairs and a lives bar at the top with 5 icons representing one life each. If you collect the secret in the level, another icon will appear in the corner, but I will change this in the future.

spikes-7The crosshairs were added to help players sense the direction they’re facing; I will also be adding a shadow for the player to help in the future. One of the green rectangles turn red when you lose a life. I’ve been doing some optimisation of scripts and some modifying of the levels –  they should be more interesting now. One new addition is platforms that will trigger an event when stood on, for example standing on certain platforms will cause it to be influenced by gravity and will fall until it hits something. This may be used in the future as an obstacle for the player. Along with this I’ve added a button that will also trigger certain events when pressed, such as initiating the movement of platforms.

spikes-8

The playable version this time around has fewer levels than before, but they will be added back in later on. This is because I wanted to improve the levels I already had and thought it would be easier to start from scratch. Plus, every level now has a collectible secret in it. I will also be working on more game mechanics to add in future worlds. Also, if you didn’t click the link at the top, here it is again: play the game!

23/05/13 Update- Improving the title screen and health

Alpha 0.1.3b Update

I’ve been working on the title screen even more today, as I’m trying to upgrade the title screen GUI from the built-in Unity GUI stuff to another way of implementing a GUI which incorporates 3D text placed within the game world. Currently, only some of the buttons are present, but I hope to overhaul the entire title GUI to the new system by next update. unity_platformer_29

The player is now on a planet rather than a flat-ish terrain, which looks better. The planet rotates like the ones in the background, too, and the skybox of the title screen is the same, but the camera is positioned differently so the view is of another portion of the skybox. I’ve also been working on the health system, and so far I have added fire, which takes off 3 health. unity_platformer_30This mechanic works well, and I will add more hazards for the next update, each of which will damage the player different amounts. There have been some smaller changes, and to see those, you can watch this video or play the game.

You can download the playable version from here, and you can watch this video straight from my YouTube channel here.

Thanks for reading and watching, have fun playing!

-Daniel