Unity3D Case Study: Rochard

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. Read my full articles of “Introduction to Unity3D” and “Tutorial Series: Unity3D & C#“.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

There is incredible momentum in the Unity3D product and its community. Here is a look at the successful game ‘Rochard’ which developers Recoil Games, Ltd created using Unity3D.

Rochard

From the IGN review of the game we learn that Rochard puts you in the role of John Rochard, an astro-miner who works for a megalithic company known as Skyrig. The game’s look works extremely well. Rochard is a comedic game at its core, and its character design, environments, enemies, sound effects and other sonic touches certainly lend to it moving in that direction.

Figure 1. Game Logo
Figure 1. Game Logo

 

QA With Developers

The site VideoGameWriters presented a terrific interview with Samuli Viikinen (Lead Level Designer), Juhana Virtanen (Lead Designer) and Sampsa Lehtonen (Programmer) detailing Rochard‘s use of Unity3D.

What was Unity’s appeal to your team?

The beauty of Unity is that the game can be published on any of the supported platforms with relative ease. Unity is also really fast and easy to use, making prototyping and implementing new features a breeze.

Often when any of our designers had new tech requirements, a programmer just sat next to the designer and implemented the new feature right there on spot together with the designer.

Figure 2. Gameplay
Figure 2. Gameplay

Did certain features change from the original design during development?

Yes, much. The gameplay itself was done iteratively. Unity did not impose any strict limitations to us, quite the contrary actually.

For instance, originally we didn’t have such a strong physics-based gameplay, but after seeing what Unity was capable of and learning what was possible with its physics engine we gradually implemented a more and more elaborate physics system for the game.

What are Unity’s advantages?

The strong point of Unity is the speed of the iteration cycle when developing the game. Some of the previous engines required us to shutdown the editor for compiling scripts, but in Unity the changes are immediately applied to the engine. This keeps the flow of development going instead of interrupting your work. Extending the editor was also really easy, and we ended up doing quite a lot of tools and small scripts to get rid of some of the laborious repetitive work.

Another feature is the use of so-called prefabs, which stands for “prefabricated game objects”. This allows you to build a palette of game objects that can be easily maintained and placed in the game world. This feature was found in the previous engines too, but they were far more clunky and error-prone.

Figure 3. Cut-Scene
Figure 3. Cut-Scene

What are Unity’s disadvantages?

Unity is not packed with rendering and animation features out-of-the-box. You can always go under the hood and implement things the way you want – that’s the whole purpose. For the games that we are making, it’s just perfect.

How has the Unity engine used by artists, programmers, level designers?

Unity is an all-around engine, and it caters to everybody in the team. Because it’s so expandable, you can improve the work flow for any discipline if such need should arise. For example, we ended up doing our custom prefab browser for the editor as our requirements for levels in our game were quite specific. We were originally using the industry standard Perforce for version control, but the built-in Asset Server in Unity had better integration to the engine so we ended up using that instead even though it was not as feature-complete as Perforce is.

Critics’ Review

IGN game the game very positive reviews. You can see gameplay footage on Youtube too.

Figure 1. Rochard's review from IGN
Figure 4. Rochard’s review from IGN

 

Your Thoughts On Unity?

Are you considering using Unity for your next commercial project? Comment thoughts below.

Already completed a game? Complete this poll and add a link to your project too.

[polldaddy poll=7138686]

Unity3D Top 5 News Announcements

Learn Unity 3D & C# – From Basics to Advanced

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

There is incredible momentum in the Unity3D product and its community. Here is a look at key announcements.

Top Unity3D Announcements

  • 1. November 2007 – The Unity3D.com Blog section launches (link)
  • 2. January 2009 -Unity targets iOS/Android – Develop for iOS ($400 upgrade) and Android ($400 upgrade) (link) and in 2013 many app award winners prove to be created in Unity (link)
  • 3. October 2009 – Pricing Update – Unity offers a free ‘Indie’ License to target desktop games (link)
  • 4. 2012 – Unity adds support for Adobe’s Flash Player – Develop for the browser with the popular Flash plugin  (link) and support for  Nintendo WiiU & Xbox360  – Develop for consoles (link) and adds support for Sony Platforms – Develop for Sony’s PS3 (and now PS4, PS-Vita, and PlaystationMobile too) (link)
  • 5. November 2012 – Unity 4.0 Launches – With many new features and a slick UI update (link)

Top Unity3D Announcements of 2013

  • 6. 2013 – Unity targets Ouya – Develop for the new Android based Ouya console (link)
  • 7. April 2013 – Unity removes support for Adobe’s Flash Player – Unity will no longer support to target to Flash Player (link)
  • 8. May. 2013 – Pricing Update – Unity offers a free ‘Indie’ License to target iOS & Android games (link)
  • 9. May. 2013 – Pricing Update – Unity offers a free ‘Pro’ License for 75$ per month (link)
  • 10. Jul. 2013 – IDE Popularity – Unity’s IDE reaches 2 million users (link)
  • 11. Jul. 2013 – IDE Version Update – Unity IDE 4.2 Released (RMC Link)
  • 12. Aug. 2013 – Unity Blog Announces – Unity IDE 4.3 Will Feature Native 2D (link)
  • 13. Aug. 2013 – Unite 2013 Conference Keynote – All The Highlights Are Here (link)

What Is Next?

  • Site Features – I’m incredibly impressed with Unity3d.com’s training section. The scope of coverage is large and the price (free), quality, and consistency of the material is unparalleled from any game development platform I’ve seen. Obviously more content will be rolled out over time.
  • Product Features – Unity is currently at a very stable and capable version 4.x. What new features could be announced next?
  • Targets – Unity is agressive in its strategy to offer developers the most compelling platforms on which to publish content. While XBox One will likely be announced, others targets may surprise us.
  • Pricing – Unity has shifted wildly (and favorably) in its pricing structure. While the current options seem pretty complete, history shows us that more changes are very likely.

Want More Video Tutorials?

We are currently creating tons of new training content for Unity3D.

[polldaddy poll=7125741]

Tutorial Series: Unity3D / C#

Learn Unity 3D & C# – From Basics to Advanced

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. Read the full “Introduction to Unity3D” article and watch the videos below.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Got Comments?

Please add a comment below on this post and include the video number. (e.g. “2.1 – I have a question about…”)

Table Of Contents

The videos and source-code are available below this table of contents for all topics marked with [Complete!].  Check back regularly for more videos.

1. Intro

  • 1.1 Series Overview: Welcome  [Complete!]
  • 1.2 IDE – Unity Editor: Learn the basics of project creation, setup, editing, and publishing.   [Complete!]
  • 1.3 IDE – MonoDevelop Part 1: Explore this editor; create classes, code, debug, & compile.  [Complete!]
  • 1.4 Demo Source Code: Where to download the source code & a quick overview of the demo project.  [Complete!]
  • 1.5 IDE – MonoDevelop Part 2: Learn advanced IDE techniques and “What’s New In MonoDevelop 4.0”.

2. C# With Cocktails – Basic Programing

  • 2.1 Programming – C# Primitives –  (e.g. int, float, string)  [Complete!]
  • 2.2 Programming – C# OOP – Object Oriented Programming  [Complete!]
  • 2.3 Programming – C# UnityEngine API Part 1 – Component-based thinking & communicating with GameObject & MonoBehavior. Bonus: Create a cube, texture it, and play a sound via Inspector window.  [Complete!]
  • 2.4 Programming – C# UnityEngine Physics – – Colliders, Rigid Bodies, OnCollisionEnter  [Complete!]
  • 2.5 Programming – C# UnityEngine 2D Part 1 –  Using Unity3D for 2D, Camera Setup, Draw calls  [Complete!]
  • 2.6 Programming – C# UnityEngine API Part 2 – GUIText via C#, Sound via C#, Mouse/Key Input Via C#, Prefabs, 2nd Camera  [Complete!]
  • 2.7 Programming – C# UnityEngine 2D Part 2 –  Learn advanced 2D techniques and “Intro To New Native 2D In Unity 4.3″.
  • 2.8 Debugging – Debugging Basics Part 1 –  Overview of Finding and Fixing Errors in C#
  • 2.9 Debugging – Unity Test Tools Part 1 –  Learn Unit Testing Via nUnit  [Complete!]
  • 3.0 Debugging – Unity Test Tools Part 2 –  Advanced Topics

3. C# With Cocktails – Advanced Programming

  • 3.1 Programming – C# Advanced Part 1 – Classes, Struct, Partial Classes, Singleton, Interface, Casting, Ref/Out, Conditionals, Loops, Collections  [Complete!]
  • 3.2 Programming – C# Advanced Part 2 – Generics, Delegates/Actions/Predicates/Lamda, Threads, Extension Methods, Operator Overloading, Attributes, Preprocessor Directives  [Complete!]
  • 3.3 Programming – C# UnityEngine API Part 3 (e.g. Custom Inspector, Custom Editor, Custom EditorWindow)
  • 3.4 Architectures – C# Architectures Part 1 – MVC
  • 3.5 Architectures – C# Architectures Part 2 – The StrangeIoC Framework 1  [Complete!]
  • 3.6 Architectures – C# Architectures Part 3 – The StrangeIoC 2 : PropertyChangeSignal  [Complete!]
  • 3.7 Architectures – C# Architectures Part 4 – Creating an ‘EventDispatcher’ Framework
  • 3.8 Graphics –  Shaders – Creating custom shaders using ShaderLab

4. Asset Store Packages

  • 4.1 Buy vs Build Theory – When is it best to buy a 3rd party plugin?
  • 4.2 Package: iTween (Free) – Easily animate with code
  • 4.3 Package: NGUI (Premium) – Create 2D & 3D UI interface elements and UI components
  • 4.4 Package: PlayMaker (Premium) – Visual Scripting (Especially for Finite State Machines)

5. Complete Projects

  • 5.1 Build Simple Game #1 – TBD 3D Action
  • 5.2 Build Simple Game #1 With a Custom Game Manager – TBD 3D Action

Free Video Resources

Enjoy a few videos of free content! Sign-up to view the full video series in ‘Member Resources’ below and to access the complete source-code. Membership is free!

[tubepress mode=”vimeoAlbum” vimeoAlbumValue=”2490343″ orderBy=”title”]

Member Video Resources

[private_Free member]Enjoy this members-only content!

Source Code

  • All videos Use This Project (link)

Videos

[tubepress mode=”vimeoAlbum” vimeoAlbumValue=”2490342″ orderBy=”title”]

[/private_Free member]

Want More Video Tutorials?

[polldaddy poll=7125741]

Intro to Loom Game Engine

Seasoned game & game-engine developer Ben Garney has a new game development engine called Loom.

Ben demonstrates competency in a long series of projects. He worked on the Torque Game Engine with GarageGames at www.garagegames.com (Site No Longer Live), the PushButton Game Engine for Flash with PushButton Labs at www.pushbuttonlabs.com (Site No Longer Live). Support from PushButton (including its website, updates to its source code and forums) abruptly ended in 2012. PBE’s spiritual successor launched in 2012 as Smash Game Framework at www.smash.io (Project apparently dead after no updates since more than ‘a year ago’).

Now he and his team have Loom, The Loom Game Engine at www.theengine.co. The word ‘loom’ is used for a device used for weaving textile projects and Loom is also a popular 80’s computer game, both spiritually aligned with game development. However, I wish it had a more unique name to facilitate online searches.

Pros of Loom (Paraphrased from theengine.co);

  • Pragmatic Development – Loom features a lean and fast workflow without strict development rules or required frameworks.
  • Freedom Of Choice – Access and edit C++ core source code, access and edit LoomScript core source code, or simply add your own custom LoomScript. LoomScript sits atop C++ and can access any C++ library.
  • LoomScript – LoomScript is an easy to use, new language modeled after AS3 with features inspired by C#. LoomScript is based on Lua which is concise, robust, proven, and supported by tools, debuggers, and community.
  • Useful Libraries – CSS Styling, UI Markup, Tweening, Dependency injection, JSON/XML and more…
  • Loom Architecture – Three parts; Call LoomCLI from your command line to create ‘new’ projects and ‘run’. The LoomSDK is precompiled LoomScript with powerful libraries. The NativeSDK is the raw C++.
  • Built For Teams – Three tiers; Artists can create & integrate assets into the latest build without bothering others. Scripters use LoomScript for the bulk of development. Need extra power? Extra features? Coders can access the C++ layer.
Pros of using one code-base for multiple platforms

When and where it is manageable, I am a huge fan of using  and reusing the same project for multiple platforms. Loom 1.x currently exports to TV (Ouya), Desktop (Mac & Windows), and Mobile (iOS & Android). Future support for other platforms is in discussion on the loom forums.

  • Save Time – Develop, iterate, QA simultaneously cross-platform
  • Focus Marketing dollars – Instead of marketing the game on two platforms separately, we can do it at the same time
  • Momentum – Word of mouth dictates that downloads on one platform will possibly translate into downloads on the other
  • Maintenance – We’d rather be working on the next game, than debugging separate platforms

What is Loom?

With cheap, powerful tools and massive exposure to new game players, there has never been a better time for indie game developers. – Me

There are many available tools for indie game development. Loom is a powerful 2D game engine with live reloading of code and assets, a friendly scripting language, and an efficient command-line workflow.

Loom’s competitors include 2D-capable gpu-accelerated cross-platform mobile game development platforms such as Adobe AIR, Corona & Unity3D as well as the newcomer Stencyl. The approach each platform takes is diverse. Where-as Stencyl is the a complete IDE for project setup, art & development which requires no coding, Loom is a raw platform without even a GUI.

Checkout the screenshots of Loom’s Workflow;

  1. Create a new project via command line.
  2. Create your raster assets using your favorite creative programs.
  3. Create your LoomScript code using any text editor. While a Loom IDE is a top feature request which is in active discussion, SublimeText is the current free, recommendation.
  4. Compile (run) the project via command line.
1. Project
2. Assets
3. LoomScript
4. Compile

Development Philosophy

We believe that fast iteration times across multiple devices simultaneously lead to better, faster, cheaper game development. – Loom Documentation

Loom‘s design goal is to keep you on the fast development path as much as possible, while still preserving access to slower, more difficult, but still essential development paths. This gives a substantial benefit to development teams without blocking them.

The Loom GameFramework

Loom offers a powerful (optional) Loom GameFramework (LGF). A game framework is a system to organize your code specific for game projects.

LGF is made of three general types of classes. There may be many of each type in each game project:

  • Manager – Managers are the brains of the operation — each one has a unique task; for instance one focuses on the spatial area of the screen and the objects within it and one on graphics rendering of visible objects. Depending on its role in the game, a manager may or may not relate to entities and components directly.
  • Entity – Each visual element in your game is represented by an entity. This could be anything; your player, the enemies, collectible items, etc…. Entities can be non-visual too.
  • Component — Each entity contains components. This is where the bulk of your game code lies. Each components handle a specific responsibility. For instance perhaps one component handles rendering the entity in which it resides.

Developers can extend existing managers and create new managers too. LGF ships with managers for our most common needs. Here is a partial list of the managers packaged with the core Loom.GameFramework package:

  • TimeManager – Manages all time related functionality in the engine. It provides mechanisms for performing actions every frame, every tick, or at a specific time in the future. A tick happens at a set interval defined by the TICKS_PER_SECOND constant. Using ticks for various tasks that need to happen repeatedly instead of performing those tasks every frame results in much more consistent output. However, for animation related tasks, frame events should be used so the display remains smooth. You can pause/play your game easily here too.
  • ConsoleCommandManager – Process and dispatch commands issued via the asset agent.
  • PropertyManager – Properties are like public variables; set/get manually or bind automatically.

Entities are essentially empty shells. As a developer you fill them with the core components &custom components needed. Each component has access to any Loom API desired and responds to custom events as well as the following built-in Loom events:

  • onFrame – Best used for graphics rendering-routines; this occurs once per frame-rate (e.g. 60 times per second for 60 FPS). Included for AnimatedComponent
  • onTick – Ticks are guaranteed to happen at a fixed interval. If the frame-rate slows down due to some number-crunching or heavy rendering, Loom will attempt to ‘catch up’ by calling more ticks. It balances the run-time experience well. Included for TickedComponent.
  • onThink – Based on an arbitrary, per-use timer. This is ideal for AI code which can be processed slowly (e.g. every 1–5 seconds). Included for QueuedComponent.

Getting Started

If you have setup a programming environment before (Flash, Java, HTML5), then you should find Loom easy to setup and use.

Here are the links and tips;

  1. Download Loom (CLI & SDK Together) – Visit the Loom downloads page.
  2. Download examples – See the list of examples or download and view the source-code from the Loom downloads page.
  3. Learn to run code with the examples and create new projects – Visit Loom getting started page and the Loom documentation page. Curiously, the class-by-class documentation is not available online, but is indeed downloadable.

Creating My ‘FlyerGame’

To learn Loom, I followed my own ‘Getting Started’ steps above and then created my own complete game. I used assets and game logic from “FlyerGame”, a game that I have recoded many, many times using game frameworks. The HD Video Screencast and source assets are available (See ‘Member Resources’ below).

Optimizations

I have limited experience with Loom, but from reading the Loom forums and reviewing the Loom example code I understand that optimizing a project – especially rendering with a constant frame-rate on a variety of devices takes time.

Conclusion

I like what Loom does well; LoomScript is light and powerful, the workflow is VERY fast. I haven’t tapped into the full strengths of device-specific CSS (e.g. to size a button uniquely on iPad vs iPhone) yet, but it looks really compelling.

Library of Libraries

Loom is based in great part to Cocos2d, a free community-based library for 2D gaming. Some people love and some people hate Cocos2D. A consciousness I see throughout the Loom forums is for ‘Loom’ itself to provide minimal functionality and instead depend on 3rd party libraries to provide developers with needed functionality. Some libraries will be folded into the Loom API and for others developers can mix and match libraries as they like. This ‘borrow vs build’ approach is not new. It is what provides huge functionality within the Javascript gaming world too. However, as a developer having a big bag of separate APIs (separate syntax, separate terminology, inconsistent value ranges…0 to 1 vs 0 to 100 vs 0 to 256) is not intuitive and severely hurts the learning curve. Furthermore such separation makes it hard in my opinion for Loom to compete in an all-too-crowded world of cross platform mobile game development tools.

Maturity

The product is both at “1.0” and costs money which to me means The Engine Co is positioning it as a finished product. However a look at the feature requests from the community and bug reports/omission from the forums, which include countless bare essentials (e.g. complete code documentation & incomplete method override support) is a sign it is not yet ready to stand against full realized competitive cross-platform mobile engine.

The engine also misses many device-specific features and most every OS-specific integration features (e.g. in-app purchase, social network integration, ad monetizations) which the forum promises are coming soon.

When the docs & wiki are complete and describe features which are implemented bug free the product can be recommended with more confidence. The team is working fast and communicates so frequently, that we may see that level of completeness very soon. A dedicated IDE (currently the #1 feature request) with auto-complete and more will help seal the deal.

The license pricing;

  • 1. Starter- Target desktop 0nly – Free!
  • 2. Indie – Target mobile too
  • 3. Pro – Includes support
  • 4. Enterprise – Includes more support

Developer Q&A

NOTE: Bonus Section!!!

Loom is very new and is changing rapidly. I reached out to Loom developers to get a reactions based on Loom CLI v#1.0.506 and Loom SDK v#sprint27.

PROs

  • Live Reloading – Greatly accelerates development
  • LoomScript – Easy to learn (especially from AS3) and powerful
  • Support – Loom dev team is open, responsive, and productive

I find the component-based architecture suggested in the Loom API to be powerful and a distinguishing feature among competitors.

CONs

  • Young platform – Has many bugs, missing basic implementations (“lots of loose ends”), and lacks must-have features of competitors
  • Lack of documentation, tutorials, & examples.
  • Rendering – The “CSS layout is pixel [dependent and] has little practical use”, and overall the “performance is not amazing”.
  • No full-featured IDE – Although a 3 code editors already provide partial support.

The lack of IDE is an obstacle for me. And the creator’s conscious choice to use existing 3rd party APIs to solve basic implementation needs is wise (provides functionality) but weakens the platform tremendously as it becomes a ‘bag of APIs’ which hurts the learning curve.

Gotchas & Advice

  • Read the docs
  • Download, read, and run the examples
  • Just “Dive into it!” and remake a basic game from scratch

“Is Loom ready for professional development?”

  • No, It is the “early days for the platform so there’s not so much”.
  • No, “standard mobile features like reading/writing to camera roll are not exposed yet (as far as I know)”.
  • Yes, I think its ready for professional deployment, If you can get over the bugs and [missing] features”.
  • No, we’d have to “spend a lot of time working on supplementing the engine, and less on making our games”.
  • And as one developer said – I am “not sure. I’d have to make a game with it!”

For me, Loom is absolutely ready for production in a vacuum. However there are many compelling alternatives to use which are more robust.

Next Steps

After ‘Getting Started’ and following my HD Video Tutorials, here are more resources to fuel your Loom savvy.

  • VIDEO: Welcome To Loom – Watch the HD Screencast Video Tutorial*
  • VIDEO: FlyerGame With Loom – Watch the HD Screencast Video Tutorial*
  • SOURCE CODE: FlyerGame With Loom – Download, view, and run the code.
  • Find common answers on the Loom forums page
  • Post your comments on Loom below on this blog page.

*See ‘Member Resources’ below.

NOTE: Source code is available, but videos are NOT yet available.

Member Resources

[private_Free member]Enjoy this members-only content!

NOTE: Source code is available, but videos are NOT yet available.

Source Code

HD Screencast Videos

  • None yet.

[/private_Free member]

Unity3D for Game Development

Unity3D (or simply ‘Unity’) is a fully integrated development engine that provides rich out-of-the-box functionality to create games and other interactive 3D content. You use Unity to assemble your art and assets into scenes and environments; add physics; simultaneously play test and edit your game, and when ready, publish to your chosen platforms, such as desktop computers, the Web, iOS, Android, Wii, PS3 and Xbox 360.

Unity’s complete toolset, intuitive workspace and rapid, productive workflows help users to drastically reduce the time, effort and cost of making games.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello

Unity’s Top News Announcements

Updated!

There is incredible momentum in the Unity3D product and its community. Here is a look at Top Unity News Announcements.

Features

Pros of Unity3D (Paraphrased from Unity3D.com); 

  • Multi-platform Development – Desktop (Mac OSX , Windows)
  • Multi-platform Deployment – Web Browsers (using the Unity WebPlayer), Desktop (Mac OSX w/ OpenGL, Windows w/ Direct3D), Mobile (iPhone, iPad, Android phones and tablets), and console (Wii, PS3 and Xbox 360). The Unity Editor emulates all your selected platforms too. The Unity3D Engine is gorgeous and performant. Unity even offers Union a way to license out your games to find an audience.
  • Powerful Coding – Unity makes it simple to keep your code working across many devices. Unity abstracts away the majority of platform differences. When precise control is needed, simply use #ifdef to specialize code per platform. Unity supports 3 languages that can be combined within the same project; C# (seems to be the most ‘professional’ option), JavaScript, and Boo programming languages.
  • Powerful Editor – Manage assets & code, drag and drop to build your scene (2D or 3D), the editor’s stage *IS* the Unity runtime (so you get high fidelity previews as you work), instant build times, see public script properties in the ID for easy viewing/editing.
  • Flexible Asset Workflow – Within the editor you don’t create assets per se, you import them (see docs & see supported formats) from other programs (all popular formats such as Photoshop and Maya) and manage them within your scenes.
Pros of using one code-base for multiple platforms

When and where it is manageable, I am a huge fan of using  and reusing the same project (including all source and code) for multiple deployment platforms. Unity supports this very well.

  • Marketing dollars – Instead of marketing the game on two platforms separately, we can do it at the same time
  • Momentum – Word of mouth dictates that downloads on one platform will possibly translate into downloads on the other
  • Maintenance – We’d rather be working on the next game, than debugging two separate platforms

What is Unity?

Unity is the combination of a project editor, a code editor, and the run-time player. The project editor allows for creation of new projects, manipulation of 3D objects within the 3D world*. Its the glue that brings together your assets, your code and its where you performs the project builds.

*Note: Another tool such as the premium Maya or the free Blender3D studio max is required to do any complex modeling and animation.

The Unity Player (used only for playback in desktop web browsers) is gaining popularity. So is the popularity of developers using the Unity Editor. See these images;

unityStats_v1
Figure 1. Unity3D Stats

 

It takes some time to appreciate the workflow of Unity. A developer will likely have several applications open at once while working.

Checkout the screenshots;

  1. Unity Editor: Create your project, edit the properties of your game objects, and build your game.
  2. Create your assets using external tools (Photoshop shown); 2D, 3D, sound, etc… and import them into the Unity Editor.
  3. Code Editor: Unity is compatible with any text editor and comes packaged with the very capable MonoDevelop code editing tools. MonoDevelop has formatting, syntax highlighting, intellisense, and autocomplete.
  4. Asset Store – Within the IDE itself you can shop online to find assets of any type (2D, 3D, sounds, etc…) as well as ‘packages’ which are groups of reusable code which enable new C# functionality as well as add completely new UI* and tools within the Unity Editor authoring environment too. The organization of the assets is great. I get the feeling (so far) that the best way to find packages is through the store (vs Googling, downloading, & importing – which is also possible). However the store is dreadfully slow and buggy, I assume because it is just a clunky webpage loaded through the Unity IDE.

Note: The extensibility within the Unity Editor itself is inspiring. No other game development environment has 3rd party free and premium tools which actually change how the IDE itself functions.

Figure 2. Overview of the User Interface (UI)
assets
Figure 3. Setup Game Sprites
Figure 4. Code Editor
Figure 5. Free & Premium Asset Store

Unity Design Philosophy

There is a hierarchy to everything in Unity; Project -> Scene -> GameObject -> Component -> Properties. Typically, when we talk about ‘things’ in our game we are talking about a specific ‘GameObject’ in a ‘Scene’. An empty game object contains just a ‘transform’ component (which is required). Using menu GameObject -> Create Empty you can make one and add it to the scene.

Two core, Unity-specific data types are;

  • GameObject:  The GameObject is the base class for all entities in Unity scenes. It is not necessarily visual, but commonly is (e.g. Cube, Sphere, Plane)
  • Component:  Created from MonoBehaviour, which is the base class every script derives from. Much of your code goes here.

The Transform Component

It is impossible to create a GameObject in Unity without a Transform Component. The Transform Component is one of the most important Components, since all of the GameObject’s Transform properties are enabled by its use of this Component. It defines the GameObject’s position, rotation, and scale in the game world/Scene View. If a GameObject did not have a Transform Component, it would be nothing more than some information in the computer’s memory. It effectively would not exist in the world.

The Transform Component also enables a concept called Parenting, which is utilized through the Unity Editor and is a critical part of working with GameObjects. To learn more about the Transform Component and Parenting, read the Transform Component Reference page.

You can see here (Figure 6.) how it is represented in the Scene Window, the Hierarchy Window, and the Inspector Window. You can see the Transform component which includes position and other properties. Also note the inviting ‘Add Component’ button. GameObjects exist so you can add components to them. The components do most of the work.

An empty GameObject
Figure 6. An empty GameObject

Other Components

The transform component is critical to all GameObjects, so each GameObject has one. Here (See Figure 7.) we see that GameObjects can contain other components (2-way purple arrow icons) too and components can refer to assets (cloud icon)

GameObject vs Component. From www.raywenderlich.com/
Figure 7. GameObject vs Component. From www.raywenderlich.com/

Component <-> Component Communication

Any class instance (of any type) can access one of the active GameObjects in the hierarchy via GameObject.FindObjectOfType( typeof ( MyGameObject ) ). For example your ScoreBoard class instance can access all the Enemy class instances to display a “Enemies: 5/10” display.

Within any one GameObject it is common that one or more Components will need to communicate. For example your keyboardInputComponent instance can call walkingComponent.walkRight(). Advanced developers may create their own solution to for need. However, for beginners, here are the popular techniques for Component <-> Component communication;

Properties

As mentioned each component contains properties. These are the granular values such as Mass, Drag, and Use Gravity (See Figure 8.) that affect how a component behaves. Not every variable within a component is editable, but all editable ones are exposed as properties through the inspector. At author-time and even at run-time you can edit these values. Very friendly for iterative development.

Figure 8. GameObject with 3D Physics
Figure 8. GameObject with 3D Physics

 

Editable Editor

One of the most shockingly cool features of Unity is that the Editor tool itself is completely scriptable.

  • Want a different icon to float over a particular GameObject in the Scene window? Script it!
  • Want a property editable in the Inspector window? Script it!
  • Want your custom components in main menu? Script it!
  • Want an entirely custom window (e.g. a home-made texture painting program)? Script it!

Everything scriptable about the Unity experience can be shared between your projects and with other developers (free or premium cost).

Gotchas

Unity’s complexity may have you scratching your head as you get started (and for years to come). It is a very deep and powerful tool. Here are some quick answers to some puzzling ‘gotchas’.

Only For The Third Dimension (3D)?

Unity3D, as its name suggests is a 3D-enabled IDE to create content in a 3D-enabled runtime. There is no option to NOT render your project in 3D. There are always x (width), y (height), and z (depth) to the positioning of every asset in your project. However, this does not mean you can’t create 2D gaming. By setting your camera’s perspective to Orthogonal, the camera will ‘render objects uniformly, with no sense of perspective’. Lock the z (depth) of every GameObject and WOW, now you have a 2D game running in a 3D engine. While this may sounds counter-intuitive or inefficient, it is not. This is the same way many 2D games are created on other platforms too.

Note: Any developers hoping to do 2D should strongly consider 3rd party Unity packages to assist the process. There is MUCH to learn and the tools are very helpful to both fill in the knowledge gaps and provide tools which make development much faster. One of the most popular recommendations for 2D in Unity is called 2DToolkit.

Editable Runtime

Probably the largest single source of confusion during your first day of unity is that you can EDIT your source while the project is PLAYING. There are 3 play controls in the IDE (and via the edit menu); play, pause, and step.

Click play to play and click pause to pause. The trick is that WHILE playing you can still use the IDE; you can drag things into and out of the live scene, you can move the camera, you can edit code, you can change assets, and more! This is very powerful, HOWEVER, once you click pause all of your changes are lost. So be sure you click PAUSE before you return to edit your scene. Obviously this feature is very powerful, you can tweak settings in your live scene without needing to pause/play again. Just be careful.

With the power of Unity there is A LOT to learn. Luckily the editor and the language features are intuitive and there are ample tutorials and sample projects to get started. Still, it is intimidating.

Prefabs

Prefabs are a collection of GameObjects (e.g. a 3D Mesh of your hero character)  & Components (e.g. one unit of code that helps accept keyboard input to move your hero character) that can be re-used in your scenes. Several identical objects can be created from a single Prefab, called instancing. Take trees for example. Creating a tree Prefab will allow you to instance several identical trees and place them in your scene. Because the trees are all linked to the Prefab, any changes that are made to the Prefab will automatically be applied to all tree instances. Assets may be created by you or your team or downloaded for free or for cost within the app store within the IDE.

Asset Store

Unity’s Asset Store is home to a growing library of free and commercial assets created both by Unity Technologies and also members of the community. A wide variety of assets is available, covering everything from textures, models and animations to whole project examples, tutorials and Editor extensions. The assets are accessed from a simple interface built into the Unity Editor and are downloaded and imported directly into your project.

Getting Started

With the power of Unity there is A LOT to learn. Luckily the editor and the language features are intuitive and there are ample tutorials and sample projects to get started. Still, it is intimidating.

Here are the links and tips;

  1. Download The IDEUnity3D and install it. Its free. There is also a pay version with many (non-essential) additional features.
  2. Watch My HD Screencast Video – Watch me talk you through as I create a complete game from start through finish. (See ‘Member Resources’ below)
  3. Review My Sample Project Code – (See Members Resources below).

Making ‘FlyerGame’

To learn Unity3D, I created several simple, but complete games. I include one here to help you learn too. I used assets and game logic from “FlyerGame”, a game that I have recoded many, many times using game frameworks. The HD Video Screencast and source assets are available (See ‘Member Resources’ below).

Conclusion

Coming from a 13 years of Flash Player game development as well as JavaScript game development Unity feels at times a huge polished step forward yet also a clunky gaming-with-training wheels step backward.

The C# language – is AMAZING. I’m constantly figuring out new language features and powerful new ways to solve old problems. The language speed is great. The MonoDevelop code editor is very strong.

The graphics – and sound-performance is stunning. The quality of the output of desktop games from Unity is incredible when compared to any casual-game development platforms yet obviously less-so when compared to professional-grade commercial gaming platforms such as Unreal Engine and CryEngine.

Ease of development – considering how much you can do with Unity (huge 3D worlds for desktop vs simple 2D mobile games) it is easy to use. The Unity Editor is also very strong. Every game requires 1 or more scenes. That makes sense. Each scene requires at least one object inside – typically many. I still feel more comfortable if I could just bind a script to the scene (with no objects) and completely script the experience. Perhaps with time I’ll change my mind on that.

Community – I strongly DISLIKE that Unity has a history of many programming languages. Three are in use  today. Perhaps for some there are benefits, but for me the obvious choice is C# and coming across tutorials, code samples, and projects in another languages (JavaScript or Boo) is a hassle.

Documentation – The Unity3D website, its documentation and its help section are all FANTASTIC. At the time of this article 5 of the 9 ‘learning modules’ have complete code and HD video. There is also one complete game project with 60-70% coverage so far with step-by-step tutorials. This is all new since Unity 4.x.

Next Steps

*See ‘Member Resources’ below.

NOTE: Source-code is already available for download. However, videos are NOT yet available.

Member Resources

[private_Free member]Enjoy this members-only content!

NOTE: Source-code is already available for download. However, videos are NOT yet available.

Source Code

HD Screencast Videos

  • None yet.

[/private_Free member]