Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Unity 3D Game Development by Example Beginner's Guide
Unity 3D Game Development by Example Beginner's Guide

Unity 3D Game Development by Example Beginner's Guide: A seat-of-your-pants manual for building fun, groovy little games quickly

Arrow left icon
Profile Icon Ryan Henson Creighton
Arrow right icon
Can$46.79 Can$51.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (31 Ratings)
eBook Sep 2010 384 pages 1st Edition
eBook
Can$46.79 Can$51.99
Paperback
Can$64.99
eBook + Subscription
Free Trial
Arrow left icon
Profile Icon Ryan Henson Creighton
Arrow right icon
Can$46.79 Can$51.99
Full star icon Full star icon Full star icon Full star icon Empty star icon 4 (31 Ratings)
eBook Sep 2010 384 pages 1st Edition
eBook
Can$46.79 Can$51.99
Paperback
Can$64.99
eBook + Subscription
Free Trial
eBook
Can$46.79 Can$51.99
Paperback
Can$64.99
eBook + Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Unity 3D Game Development by Example Beginner's Guide

Chapter 1. That's One Fancy Hammer!

Technology is a tool. It helps us accomplish amazing things, hopefully more quickly and more easily and more amazingly than if we hadn't used the tool. Before we had newfangled steam-powered hammering machines, we had hammers. And before we had hammers, we had the painful process of smacking a nail into a board with our bare hands. Technology is all about making our lives better and easier. And less painful.

Introducing Unity 3D

Unity 3D is a new piece of technology that strives to make life better and easier for game developers. Unity is a game engine or a game authoring tool that enables creative folks like you to build video games.

By using Unity, you can build video games more quickly and easily than ever before. In the past, building games required an enormous stack of punch cards, a computer that filled a whole room, and a burnt sacrificial offering to an ancient god named Fortran. Today, instead of spanking nails into boards with your palm, you have Unity. Consider it your hammer a new piece of technology for your creative tool belt.

Unity takes over the world

Throughout this book, we'll be distilling our game development dreams down to small, bite-sized nuggets instead of launching into any sweepingly epic open-world games. The idea here is to focus on something you can actually finish instead of getting bogged down in an impossibly ambitious opus. This book will teach you to build four games, each of which focus on a small, simple gameplay mechanic. You'll learn how to build discrete pieces of functionality that you can apply to each project, filling the games out to make them complete experiences. When you're finished, you can publish these games on the Web, Mac, or PC.

The team behind Unity 3D is constantly working on packages and export options for other platforms. At the time of this writing, Unity could additionally create games that can be played on the iPhone, iPod, iPad, Android devices, Xbox Live Arcade, PS3, and Nintendo's WiiWare service. Each of these tools is an add-on functionality to the core Unity package, and comes at an additional cost. As we're focusing on what we can do without breaking the bank, we'll stick to the core Unity 3D program for the remainder of this book.

With the initial skills that you learn in this book, you'll be able to expand on your knowledge to start building more and more complex projects. The key is to start with something you can finish, and then for each new project that you build, to add small pieces of functionality that challenge you and expand your knowledge. Any successful plan for world domination begins by drawing a territorial border in your backyard; consider this book your backyard.

Browser-based 3D? Welcome to the future

Unity's primary and most astonishing selling point is that it can deliver a full 3D game experience right inside your web browser. It does this with the Unity Web Player a free plugin that embeds and runs Unity content on the Web.

Time for action - install the Unity Web Player

Before you dive into the world of Unity games, download the Unity Web Player. Much the same way the Flash player runs Flash-created content, the Unity Web Player is a plugin that runs Unity-created content in your web browser.

  1. Go to http://unity3D.com.
  2. Click on the install now! button to install the Unity Web Player.
    Time for action - install the Unity Web Player
  3. Click on Download Now!.
  4. Follow all of the on-screen prompts until the Web Player has finished installing.
Time for action - install the Unity Web Player

Welcome to Unity 3D!

Now that you've installed the Web Player, you can view the content created with the Unity 3D authoring tool in your browser.

What can I build with Unity?

In order to fully appreciate how fancy this new hammer is, let's take a look at some projects that other people have created with Unity. While these games may be completely out of our reach at the moment, let's find out how game developers have pushed this amazing tool to its very limits.

FusionFall

The first stop on our whirlwind Unity tour is FusionFall a Massively Multiplayer Online Role-Playing Game (MMORPG). You can find it at fusionfall.com. You may need to register to play, but it's definitely worth the extra effort!

FusionFall

FusionFall was commissioned by the Cartoon Network television franchise, and takes place in a re-imagined, anime-style world where popular Cartoon Network characters are all grown up. Darker, more sophisticated versions of the Powerpuff Girls, Dexter, Foster and his imaginary friends, and the kids from Codename: Kids Next Door run around battling a slimy green alien menace.

Completely hammered

FusionFall is a very big and very expensive high-profile game that helped draw a lot of attention to the then-unknown Unity game engine when the game was released. As a tech demo, it's one of the very best showcases of what your new technological hammer can really do! FusionFall has real-time multiplayer networking, chat, quests, combat, inventory, NPCs (non-player characters), basic AI (artificial intelligence), name generation, avatar creation, and costumes. And that's just a highlight of the game's feature set. This game packs a lot of depth.

Should we try to build FusionFall?

At this point, you might be thinking to yourself, "Heck YES! FusionFall is exactly the kind of game I want to create with Unity, and this book is going to show me how!"

Unfortunately, a step-by-step guide to creating a game the size and scope of FusionFall would likely require its own flatbed truck to transport, and you'd need a few friends to help you turn each enormous page. It would take you the rest of your life to read, and on your deathbed, you'd finally realize the grave error that you had made in ordering it online in the first place, despite having qualified for free shipping.

Here's why: check out the game credits link on the FusionFall website: http://www.fusionfall.com/game/credits.php.

This page lists all of the people involved in bringing the game to life. Cartoon Network enlisted the help of an experienced Korean MMO developer called Grigon Entertainment. There are over 80 names on that credits list! Clearly, only two courses of action are available to you:

  • Build a cloning machine and make 79 copies of yourself. Send each of those copies to school to study various disciplines, including marketing, server programming, and 3D animation. Then spend a year building the game with your clones. Keep track of who's who by using a sophisticated armband system.
  • Give up now because you'll never make the game of your dreams.

Another option

Before you do something rash and abandon game development for farming, let's take another look at this. FusionFall is very impressive, and it might look a lot like the game that you've always dreamed of making. This book is not about crushing your dreams. It's about dialing down your expectations, putting those dreams in an airtight jar, and taking baby steps. Confucius said: "A journey of a thousand miles begins with a single step." I don't know much about the man's hobbies, but if he was into video games, he might have said something similar about them creating a game with a thousand awesome features begins by creating a single, less feature-rich game.

So, let's put the FusionFall dream in an airtight jar and come back to it when we're ready. We'll take a look at some smaller Unity 3D game examples and talk about what it took to build them.

Off-Road Velociraptor Safari

No tour of Unity 3D games would be complete without a trip to Blurst.com the game portal owned and operated by indie game developer Flashbang Studios. In addition to hosting games by other indie game developers, Flashbang has packed Blurst with its own slate of kooky content, including Off-Road Velociraptor Safari. (Note: Flashbang Studios is constantly toying around with ways to distribute and sell its games. At the time of this writing, Off-Road Velociraptor Safari could be played for free only as a Facebook game. If you don't have a Facebook account, try playing another one of the team's creations, like Minotaur China Shop or Time Donkey).

Off-Road Velociraptor Safari

In Off-Road Velociraptor Safari, you play a dinosaur in a pith helmet and a monocle driving a jeep equipped with a deadly spiked ball on a chain (just like in the archaeology textbooks). Your goal is to spin around in your jeep doing tricks and murdering your fellow dinosaurs (obviously).

For many indie game developers and reviewers, Off-Road Velociraptor Safari was their first introduction to Unity. Some reviewers said that they were stunned that a fully 3D game could play in the browser. Other reviewers were a little bummed that the game was sluggish on slower computers. We'll talk about optimization a little later, but it's not too early to keep performance in mind as you start out.

Fewer features, more promise

If you play Off-Road Velociraptor Safari and some of the other games on the Blurst site, you'll get a better sense of what you can do with Unity without a team of experienced Korean MMO developers. The game has 3D models, physics (code that controls how things move around somewhat realistically), collisions (code that detects when things hit each other), music, and sound effects. Just like FusionFall, the game can be played in the browser with the Unity Web Player plugin. Flashbang Studios also sells downloadable versions of its games, demonstrating that Unity can produce standalone executable game files too.

Maybe we should build Off-Road Velociraptor Safari?

Right then! We can't create FusionFall just yet, but we can surely create a tiny game like Off-Road Velociraptor Safari, right? Well... no. Again, this book isn't about crushing your game development dreams. But the fact remains that Off-Road Velociraptor Safari took five supremely talented and experienced guys eight weeks to build on full-time hours, and they've been tweaking and improving it ever since. Even a game like this, which may seem quite small in comparison to full-blown MMO like FusionFall, is a daunting challenge for a solo developer. Put it in a jar up on the shelf, and let's take a look at something you'll have more success with.

I bent my Wooglie

Wooglie.com is a Unity game portal hosted by M2H Game Studio in the Netherlands. One glance at the front page will tell you that it's a far different portal than Blurst.com. Many of the Wooglie games are rough around the edges, and lack the sophistication and the slick professional sheen of the games on Blurst. But here is where we'll make our start with Unity. This is exactly where you need to begin as a new game developer, or as someone approaching a new piece of technology like Unity.

Play through a selection of games on Wooglie. I'll highlight a few of them for your interest:

Big Fun Racing

Big Fun Racing is a simple but effective game where you zip around collecting coins in a toy truck. It features a number of different levels and unlockable vehicles. The game designer sunk a few months into the game in his off-hours, with a little help from outsource artists to create the vehicle models.

Big Fun Racing

Diceworks

Diceworks is a very simple, well-polished game designed for the iPhone in Unity 3D. We won't be covering any iPhone development, but it's good to know that your Unity content can be deployed to a number of other devices and platforms, including the Apple iPhone or iPod touch, and the Nintendo Wii. The iPhone and Wii versions of the software cost an additional fee, but you can deploy your games to the Web, to the Mac, and to the PC for free using the indie version of Unity.

Diceworks

Diceworks was created by one artist and one programmer working together as a team. It's rare to find a single person who possesses both programming and artistic talent simultaneously; scientists say that these disciplines are split between two different lobes in our brains, and we tend to favor one or the other. The artist-programmer pairing that produced Diceworks is a common setup in game development. What's your own brain telling you? Are you more comfy with visuals or logic? Art or programming? Once you discover the answer, it's not a bad plan to find someone to make up the other half of your brain so that your game handles both areas competently.

At any event, with Diceworks we're definitely getting closer to the scope and scale that you can manage on your own as you start out with Unity.

It's also interesting to note that Diceworks is a 2D game created in a 3D engine. The third "D" is largely missing, and all of the game elements appear to exist on a flat plane. Nixing that extra dimension when you're just starting out isn't a half bad idea. Adding depth to your game brings a whole new dimension of difficulty to your designs, and it will be easier to get up and running with Unity by focusing on the X and Y axes, and leaving the Z-axis in one of those dream jars. With a few sturdy working game examples under your belt, it won't be long before you can take that Z-jar down off the shelf and pop it open. The games that we'll be building in this book will stick to a two-dimensional plane, using three-dimensional models. Even so, certain games have taken this concept and ran with it: New Super Mario Bros. Wii locked its 3D characters to a 2D plane and wound up an extremely complex and satisfying platformer.

Walk before you can run (or double jump)

A common mistake that new game developers make is biting off more than they can chew. Even experienced game developers make this mistake when they get really excited about a project, or when they approach a new technology and expect to be immediately proficient at using it. The real danger here is that you'll sit down and try to create your dream let's say it's a sword and sorcery RPG epic that combines all the best parts of Diablo, ChuChu Rocket!, and Microsoft Excel. When you've sunk days and weeks and months into it and it still looks nothing like the game you envisioned, you give up. You figure that since you failed at creating your dream game, you were never really cut out to be a game developer to begin with.

You owe it to yourself to start small! Rome wasn't built in a day, and neither was your dream kart racing game starring famous figures from Roman history. By taking smaller steps, you can experience success with a number of smaller games. Then you can take what you learn and add to it, slowly building your expertise until you're in a position to take that dream game jar off the shelf.

For now, let's keep our dream shelf fully stocked, and turn our attention to something small and achievable. By the end of this book, you'll have a collection of working games that started out simply, and grew more and more complex as you got smarter. My hope is that once you finish the book, you'll be well-equipped to dream up new incremental features for your games, and to hunt down the resources you need to fill the gaps in your new-found knowledge.

In Chapter 2, we'll go into detail about where you should start when you're deciding what kind of game to create. We'll also see some real-world examples of games that began as simple, effective ideas and later grew into enormously complex and feature-rich titles. From small acorns, mighty multiplayer oak tree games grow.

There's no such thing as "finished"

We'll be learning a lot about iteration throughout this book. Some game developers who produce content for fixed media like game disks and cartridges are used to producing a gold master the final build of the game and calling it a day. One of the joys of deploying games to the Web is that they're never truly finished. You can continue tweaking your web games and modifying them until you end up with a far more fun and polished game than you started with.

If you follow Flashbang Studios on Twitter or if you read the studio's blog, you'll see that it's constantly modifying and improving its games, even years after they were "finished". At the time of this writing, Off-Road Velociraptor Safari was two years old, and the studio's Twitter stream revealed that it's still actively tweaking the game.

Likewise, we'll be creating some games that are really raw and unfinished at first. But as we learn more about how to program the crucial bits and pieces common to many games, we'll keep revisiting our rough, early games to add those pieces and improve them.

Stop! Hammer time

Now that you've seen some of what Unity can do, it's time to download the program and kick the tires! Unity indie version is available for the low price of free (at the time of this writing) from the Unity 3D website.

  1. Go to http://unity3D.com.
  2. Click on the Download Now button.
  3. Download the latest version of the Unity 3D authoring tool for your platform Mac or PC. If you are given the option, make sure to download the sample project along with the program.
  4. Follow all the on-screen prompts until the Unity authoring tool has finished installing.
  5. Launch Unity!

Explore Demo island

When Unity first opens, you should see a splash screen referring you to different tutorial resources and language guides. How helpful! Now close it. (Don't worry, it'll be there next time, unless you uncheck the Show at Startup box).

Because you chose to download the sample project, it should automatically load the first time you run Unity. Navigate to Window | Layouts | 2 by 3 to see the different panels that we're about to tour.

Explore Demo island

To try out the demo, click on the Play button at the top-center of the screen.

Explore Demo island

You can walk around the Island Demo using the WASD keys on your keyboard. Jump by pressing the Space bar. When you're finished exploring, click on the Play button again to end the demo.

Explore Demo island

The wonders of technology!

Unity contains all of the tools that you need to create an island similar to the one you see in this demo. It has terrain tools that let you model your level right inside the software. It contains a ready-made First Person Controller Prefab object you can plunk into the world with automatic WASD keyboard controls that will allow you to explore the terrain. Unity automatically takes care of the rendering (drawing), collisions, physics, and sound effects. That's one fancy hammer!

Tip

Wide-open worlds with Will

If you'd like to learn how to sculpt your own terrain in Unity, and to add 3D models, sounds, and interactivity to create a simple but functional 3D open-world game, check out, "Unity Game Development Essentials", Will Goldstone, Packt Publishing.

Much of what you see in the Island Demo can be built directly in Unity using the engine's terrain sculpting tools. The demo contains special models, like the bridge, which were imported from 3D software packages, including 3D Studio Max, Maya, or Blender. Certain elements, like the birds, have scripts attached to them that teach them how to fly. Scripts are lists of instructions that tell the items in the game world how to behave. Throughout the book, we'll learn how to import 3D models and to write scripts to control them. We won't be exploring the terrain tools, but you'll be such a Unity adventurer by the end of the last chapter that you'll be able to tackle them with gusto.

Let's take a quick look around the Unity interface and note a few points of interest.

The Scene window

The Scene window is where you can position your Game Objects and move things around. This window has various controls to change its level of detail. Use these controls to toggle lighting on and off, and to display the window contents with textures, wireframes, or a combination of both. You can use the colorful gizmo in the top-right corner to constrain the window to the X, Y, and Z axes to view the top and sides of your scene. Click on the white box in the middle to return to perspective view. This is what the Scene window looks like when you start a new project or create a new Scene. You can think of scenes as levels or stages in your game.

The Scene window

The Game window

The Game window shows you what your players will see. When you click on the Play button to test your game (as you just did with the Island Demo), the results of your efforts play out in this window. Toggle the Maximize on Play button to test your game in full-screen mode.

The Game window

The Hierarchy

The Hierarchy panel lists all of the Game Objects in your Scene. Game Objects cameras, lights, models, and prefabs are the things that make up your game. They can be "tangible" things like the birds and the bridge in the Island Demo. They can also include intangible things, which only you as the game developer get to see and play with, such as the cameras, the lights, and colliders, which are special invisible shapes that tell the game engine when two Game Objects are touching.

The Island Demo Hierarchy contains Game Objects for the birds, the sea foam, the terrain, and the sun, to name a few. It also lists something called the First Person Controller Prefab, which has one of those invisible Colliders with a camera stuck to it. That's how the player can see the island. The demo lists something called Performance an empty Game Object with a special script attached to it that helps the demo run more quickly depending on the player's computer specs. So, Game Objects can include touchy-feely "physical" objects like birds and bridges, as well as behind-the-scenes intangible things like lights, cameras, and actions (scripts).

The Hierarchy

Click on a Game Object in the Hierarchy panel, and then hover your mouse over the Scene window. Press the F key on your keyboard, and the Scene window will automatically pan and zoom directly to that object. Alternatively, you can go to Edit | Frame Selected, which can be more reliable than using the keyboard shortcut. (I like to think of the F as standing for Focus to help me remember what this shortcut does).

The Project panel

The Project panel lists all of the elements that you'll use to create Game Objects in your project. For example, the Island Demo seagull Game Object is made up of a mesh that represents the seagull's shape, a material to depict its "skin" or coloring, and a script that controls its flight behavior. The seagull material itself could include a texture (image) file. All of these goodies are listed in the Project panel.

Tip

You got a lot of gull

The actual seagulls in the Island Demo are actually more complex than the ones in our simple example. To see what went into creating them, click on the gray arrow next to Birds in the Project panel. Then click on the arrow next to Seagull. Don't worry if you don't understand what you're seeing the key here is to understand that the Project panel contains many of the elements, or ingredients, that go into making our Game Objects.

The Project panel displays the contents of a special folder called Assets. Unity automatically creates the Assets folder for you when you create a new project. If you drag a compatible file, like a 3D model, a sound effect, or an image into the Project panel, Unity copies it to the Assets folder behind the scenes, and displays it in the Project panel.

The Project panel

Tip

Don't mess with the Assets folder!

Unity stores metadata about the folder, and by moving stuff around or deleting things through your operating system, you may break your project. If you need to make changes, make them right inside Unity in the Project panel.

The Inspector

The Inspector is a context-sensitive panel, which means that it changes depending on what you select elsewhere in Unity. This is where you can adjust the position, rotation, and scale of Game Objects listed in the Hierarchy panel. The Inspector can also display controls to configure components that add functionality to Game Objects. Between the three main panels in Unity (Hierarchy, Project, and Inspector), the Inspector is where you'll likely spend most of your time because that's where you'll be tweaking and fiddling with every aspect of the elements that comprise your game projects.

The Inspector

This screenshot of the Inspector shows the components attached to the First Person Controller Prefab in the Island Demo: two scripts (FPSWalker and Mouse Look) and a Character Controller component. To see the same content on your computer, click to select the First Person Controller Prefab in the Hierarchy panel.

Invade Island Demo as a paratrooper

Let's use the Inspector panel to make a quick change to the start position of the player character. We'll begin the demo with the player 400 feet in midair, giving the player a beautiful bird's eye view of the action as he parachutes into the island.

The First Person Controller Prefab that you just clicked on represents the player in the game. It has a camera embedded in it that the player looks through, and a pill-shaped Character collider that tells the game engine when the player is touching other things in the Scene. The Character collider is what keeps the player from falling through the ground.

We can use the Inspector panel to change the start position of the player. In the Scene view, you should see the First Person Controller Prefab it looks like a green pill with what looks like a speaker icon on top of it (this is blocking the Camera icon). If you don't see it, follow these steps:

  1. Click to select the First Person Controller Prefab in the Hierarchy panel.
  2. Navigate to Edit | Frame Selected to focus on the Game Object. Alternatively, you can hover your mouse over the Scene view and press the F key on your keyboard. The First Person Controller Prefab should swing into view.
  3. Click on the Move button, which looks like four connected arrows.
    Invade Island Demo as a paratrooper
    • A tripod of three arrows appears at the center of the Game Object. The blue Z- axis runs through where the player's belly button would be. The red X-axis runs perpendicular to the X-axis. And the green Y-axis runs straight up and down through the player as if the player was hanging by a piece of string tied to the top of her head. The Y-axis is the up or down axis that we want to adjust.
    Invade Island Demo as a paratrooper
  4. You can click-and-drag the green Y-axis arrow to move the player up into the sky, but a better method is to change the Y-axis position in the Inspector panel. Expand the gray arrow next to Transform in the Inspector panel if it's not already open, and change the Y value under Position to 400.
    Invade Island Demo as a paratrooper
  5. Now, when you press Play to test the game, your character will start way up in the sky, floating down to the island before making a soft, quiet landing. It's a good thing that the Unity people didn't write a fall damage script, otherwise we might have some crumpled legs to contend with!

Layers and layout dropdowns

Above the Inspector panel, you'll see the Layers and Layout dropdowns. Game Objects can be grouped into layers, much like in Photoshop or Flash. Unity stores a few commonly used layouts in the Layout dropdown. You can also save and load your own custom layouts.

Layers and layout dropdowns

Playback controls

These three buttons help you test your game and control playback. As you've seen, the Play button starts and stops your game. The Pause button works as expected it pauses your game so that you can make changes to it on the fly. The third button is a Step-Through control; use it to advance frame-by-frame through your game so that you can more tightly control what's going on.

Playback controls

Tip

Changes you make while testing don't stick!

One of the more surprising features of Unity is that you can make changes to Game Objects and variables on the fly while you're testing your game. But it's important to know that the changes you make during testing will not "stick". Once you stop testing your game, the changes that you made during testing will revert to the state they were in before you clicked on the Play button. It's disheartening to make a number of changes to your game, only to realize that the Play button was on the entire time, and your changes will be lost. One way to avoid this problem is to toggle the Maximize on Play button in the Game window so that you'll be more aware of when you're testing and when you're not.

Scene controls

At the top-left of your screen, you'll see four controls that help you move around your Scene, and position Game Objects within it. These controls are mapped to the Q, W, E, and R keys on your keyboard. From left to right, they are:

Scene controls
  • The Hand tool (Q): Use it to click-and-drag around your scene. Hold down the Alt key on your keyboard to rotate the view. Hold down the Ctrl key (Windows) or the Command key (Apple) to zoom in and out. Your mouse wheel will also zoom the scene. Hold down the Shift key to pan, zoom, and rotate in larger increments to speed things up. This is a way for you to navigate around the game world. It doesn't actually impact the way the player sees the game. To modify the Game view, you need to use the Move or Rotate tools to modify the Camera position.
  • The Move tool (W): This tool lets you move the Game Objects around your scene. You can either drag the object(s) around by the X, or Y, or Z-axis handles, or by the square in the center for freeform movement. Holding down the Ctrl key will snap movement to set grid increments. We saw this tool when we were positioning the First Person Controller Prefab in the middle of the sky.
  • Rotate tool (E): Use it to spin your objects around using a neat spherical gizmo. The red, green, and blue lines map to the X, Y, and Z axes.
  • Scale tool (R): This tool works much the same as the Move and Rotate tools. Use it to make your Game Objects larger or smaller. Dragging an X, Y, or Z handle will non-uniformly scale (squash and stretch) the object, while dragging the gray cube in the center will uniformly scale it.

Don't stop there live a little!

We've glanced briefly at the key elements of the Unity interface, but there's no need to stop poking around. Far beyond the scope of this book, there is a wealth of menu options, buttons, and controls that we haven't covered. Why not explore those menus or start randomly clicking on things that you don't yet understand? Now is the time to safely break stuff. You didn't work hard to create the Island Demo, so why not mess around with it a little bit?

Here are some things to try:

  • Select some of the Game Objects in the Hierarchy panel and move them around in the Scene window using the Scene controls. What happens when you put the bridge in the middle of the sky? Can you make one of the birds fly into a tree? What happens when you walk way out into the ocean while testing the game?
  • Randomly right-click in the three different panels and read through the context menu options to see what you're getting yourself into.
  • Poke around in the GameObject | Create Other menu. There's a whole list of interesting things that you can add to this scene without even touching the 3D modeling program.
  • What happens when you delete the lights from the scene? Or the camera? Can you add another camera? More lights? How does that affect the Scene?
  • Can you move the First Person Controller Prefab to another part of the island to change your starting position? How about starting on top of those two gigantic rocks on the beach?
  • Can you replace the audio files to make the seagulls sound like car horns?
  • Download a picture of kittens from the Internet and see if you can wrap it around the boulder model. Kittens rock! You can pull the kitties into your project using the Assets | Import New Asset option in the menu.

Tip

A tuner's paradise

The Unity 3D interface is designed to be customized. Not only can you define your own custom window layouts, but you can even write custom scripts to make certain buttons and panels appear inside Unity to speed up your workflow. That kind of thing is well beyond the scope of this book, but if you're the kind of person who really likes to get under the hood, you'll be happy to know that you can tweak Unity 3D to your heart's content maybe add a few racing stripes and install an enormous pair of subwoofers in the back?

Summary

Chapter 1 was all about getting a feel for what Unity can do and for what the program interface had to offer. Here's what we found out:

  • Massive 80 person teams, all the way down to tiny one- or two-person teams are using Unity to create fun games.
  • By thinking small, we'll have more success in learning Unity and producing fully functional games instead of huge but half-baked abandoned projects.
  • Different flavors of Unity help us deploy our games to different platforms. By using the free indie version, we can deploy to the Web, and the Mac and PC platforms.
  • The Unity interface has controls and panels that let us visually compose our game assets, and test games on the fly right inside the program!

I hope you've taken some time to thoroughly vandalize the Island Demo. Save the file by clicking on File | Save Project in case you want to come back and wreak more havoc a little later.

Big ambition, tiny games

Now that we've trashed this joint, let's take a quick trip through some game design theory. In the next chapter, we'll figure out the scope and scale of a game that a solo, beginner developer should actually tackle. Crack your knuckles and put on your favorite hat because you're about to dip yourself in awesome sauce.

Left arrow icon Right arrow icon

Key benefits

  • Build fun games using the free Unity 3D game engine even if you've never coded before
  • Learn how to "skin" projects to make totally different games from the same file – more games, less effort!
  • Deploy your games to the Internet so that your friends and family can play them
  • Packed with ideas, inspiration, and advice for your own game design and development
  • Stay engaged with fresh, fun writing that keeps you awake as you learn

Description

Beginner game developers are wonderfully optimistic, passionate, and ambitious. But that ambition is often dangerous! Too often, budding indie developers and hobbyists bite off more than they can chew. Some of the most popular games in recent memory – Doodle Jump, Paper Toss, and Canabalt, to name a few – have been fun, simple games that have delighted players and delivered big profits to their creators. This is the perfect climate for new game developers to succeed by creating simple games with Unity 3D, starting today.This book starts you off on the right foot, emphasizing small, simple game ideas and playable projects that you can actually finish. The complexity of the games increases gradually as we progress through the chapters. The chosen examples help you learn a wide variety of game development techniques. With this understanding of Unity 3D and bite-sized bits of programming, you can make your own mark on the game industry by finishing fun, simple games.This book shows you how to build crucial game elements that you can reuse and re-skin in many different games, using the phenomenal (and free!) Unity 3D game engine. It initiates you into indie game culture by teaching you how to make your own small, simple games using Unity3D and some gentle, easy-to-understand code. It will help you turn a rudimentary keep-up game into a madcap race through hospital hallways to rush a still-beating heart to the transplant ward, program a complete 2D game using Unity's User Interface controls, put a dramatic love story spin on a simple catch game, and turn that around into a classic space shooter with spectacular explosions and "pew" sounds! By the time you're finished, you'll have learned to develop a number of important pieces to create your own games that focus in on that small, singular piece of joy that makes games fun.

Who is this book for?

If you've ever wanted to develop games, but have never felt "smart" enough to deal with complex programming, this book is for you. It's also a great kick-start for developers coming from other tools like Flash, Unreal Engine, and Game Maker Pro.

What you will learn

  • Find out how people are using the amazing new Unity 3D game engine
  • Develop and customize four fun game projects, including a frantic race through hospital hallways with a still-beating human heart and a catch game with a jilted lover that morphs into a space shooter!
  • Create both 2D and 3D games using free software and supplied artwork
  • Add motion, gravity, collisions, and animation to your game objects using Unity 3D s built-in systems
  • Learn how to use code to control your game objects
  • Create particle systems like shattering glass, sparks, and explosions
  • Add sound effects to make your games more exciting
  • Create static and animated backdrops using multiple cameras
  • Build crucial elements you ll use again and again, like timers, status bars, title screens, win/lose conditions, and buttons to link game screens together
  • Deploy your games to the Web to share them with friends, family, and adoring fans
  • Discover the difference between game skins and mechanics, to earn more money from your games

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 24, 2010
Length: 384 pages
Edition : 1st
Language : English
ISBN-13 : 9781849690553
Vendor :
Unity Technologies
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 24, 2010
Length: 384 pages
Edition : 1st
Language : English
ISBN-13 : 9781849690553
Vendor :
Unity Technologies
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 212.97
Learning C# by Developing Games with Unity 3D Beginner's Guide
Can$73.99
Unity 3.x Game Development Essentials
Can$73.99
Unity 3D Game Development by Example Beginner's Guide
Can$64.99
Total Can$ 212.97 Stars icon

Table of Contents

14 Chapters
1. That's One Fancy Hammer! Chevron down icon Chevron up icon
2. Let's Start with the Sky Chevron down icon Chevron up icon
3. Game #1: Ticker Taker Chevron down icon Chevron up icon
4. Code Comfort Chevron down icon Chevron up icon
5. Game #2: Robot Repair Chevron down icon Chevron up icon
6. Game #2: Robot Repair Part 2 Chevron down icon Chevron up icon
7. Don't Be a Clock Blocker Chevron down icon Chevron up icon
8. Ticker Taker Chevron down icon Chevron up icon
9. Game #3: The Break-Up Chevron down icon Chevron up icon
10. Game #3: The Break-Up Part 2 Chevron down icon Chevron up icon
11. Game #4: Shoot the Moon Chevron down icon Chevron up icon
12. Action! Chevron down icon Chevron up icon
A. References Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(31 Ratings)
5 star 58.1%
4 star 9.7%
3 star 12.9%
2 star 9.7%
1 star 9.7%
Filter icon Filter
Top Reviews

Filter reviews by




jennifer Dec 08, 2010
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book was sent promptly and it was double wrapped with brown paper and then had stiff cardboard around it. the sender took extra time for packing and I am sure it was more expensive to mail but it was so well worth it! I appreciate the extra care!!
Amazon Verified review Amazon
Bill Lundgren Apr 03, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've purchased seven books relating to learning the Unity 3D game engine (since it's free and very powerful), with Ryan Henson Creighton's book being one.I've spent 100's of hours viewing and plowing through tutorials. I often have a problem with the approach many tutorials take - a long, convoluted list of menu, dialog box, and control actions, with little to no explanation of WHY I'm doing this. This is the main reason I enjoyed Unity 3D Game Development by Example Beginner's Guide. Ryan takes great pains to describe the goal, how we'll get there, and then explain "What Just Happened?". This approach fits my personal learning style very well.Ryan's sense of humor is sometimes worth a groan, sometimes a laugh out load; regardless his humor helps drive key points home. I took away a huge amount of usable knowledge that I can put into practice immediately. The variety of projects helps round out the knowledge and make deeper connections.I would highly recommend this book to anyone starting up the Unity 3D learning curve.
Amazon Verified review Amazon
L. Figueroa Jul 23, 2011
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I found this book easy to read and follow to learn how Unity works and what it can do. The author is entertaining and the instructions are clear - and more importantly things actually worked. I did find myself following instructions without knowing what some terms meant and what the flags were doing but I felt it is not a bad way to get to learn how to use the tool. I found other books difficult to read when I had to read every detail about every feature...and still found myself saying - "Huh?" This book is a perfect way to get acquainted with Unity and move on to a book such as Menards (a graphics artist point of view).This book will be harder for someone who does not know programming to learn programming at the same time. There are many concepts being thrown at the beginning programmer (classes, arrays and loops all in one chapter). The programming newbie will find themselves following the instructions as I followed some of the instructions related to graphics engine choices - I did not know why it worked but it did. I trust after this book and delving into others that I will understand. Even if you don't know programming, if you follow the instructions you should have a working programs and that will be enough to whet your appetite to learn more about the details.The title is true to the intention and value of the book. It guides you through examples to get acquainted with the power of purpose of Unity. Another valuable tool taught by the author for those interested in learning more is how to use the online manuals and reference material online to look something up. The author guides you step by step all the way and explains every detail and the resulting cool little games you construct and build on your own is a nice bonus.
Amazon Verified review Amazon
TJ Jan 19, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm very pleased with the book. I have not made it all the way through, but I'm far enough in to write a review. The author does an excellent job of explaining the basics of using Unity. Don't expect to become an expert. That's not what this book is about. This book is about helping you obtain a basic level of understanding and competency with Unity. You can then take these newly developed skills and tackle a more complex book or have the proficiency necessary to learn from an online tutorial rather than simply mimic the tutorial.The author frequently tells you to dial down your expectations. I noticed another review criticizing the author for this. I disagree. The author is trying to help you maintain realistic expectations. If you need a beginner book, you're not ready to develop the next WoW. The author is trying to encourage you to complete a simple game. Then complete a slightly more complex game. The idea is to gradually build your skills until you are able to tackle a bigger project.I've seen some complaints about the depth of coverage for java script. I found it to be adequate, but I have about 10 years of development experience under my belt. If you're new to programming, you might want to spend a little time learning the basics first.I enjoy the author's style. He uses a lot of humor, and it makes for a more enjoyable read. He even takes the time to teach things unrelated to game development. For instance, I had no idea a game of Volleyball ends when an angry puma bursts onto the court and starts chewing on the star player.
Amazon Verified review Amazon
Torez Strader Nov 26, 2010
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great practical introduction to Unity. To bad its not Unity 3.0. But you can get around that easy enough.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.

Modal Close icon
Modal Close icon