Skip to main content

2011 | Buch

Beginning 3D Game Development with Unity

The World’s Most Widely Used Multi-platform Game Engine

insite
SUCHEN

Über dieses Buch

Beginning 3D Game Development with Unity is perfect for those who would like to come to grips with programming Unity. You may be an artist who has learned 3D tools such as 3ds Max, Maya, or Cinema 4D, or you may come from 2D tools such as Photoshop and Illustrator. On the other hand, you may just want to familiarize yourself with programming games and the latest ideas in game production.

This book introduces key game production concepts in an artist-friendly way, and rapidly teaches the basic scripting skills you'll need with Unity. It goes on to show how you, as an independent game artist, can create casual interactive adventure games in the style of Telltale's Tales of Monkey Island, while also giving you a firm foundation in game logic and design.

The first part of the book explains the logic involved in game interaction, and soon has you creating game assets through simple examples that you can build upon and gradually expand. In the second part, you'll build the foundations of a point-and-click style first-person adventure game—including reusable state management scripts, load/save functionality, a robust inventory system, and a bonus feature: a dynamically configured maze and mini-map. With the help of the provided 2D and 3D content, you'll learn to evaluate and deal with challenges in bite-sized pieces as the project progresses, gaining valuable problem-solving skills in interactive design. By the end of the book, you will be able to actively use the Unity 3D game engine, having learned the necessary workflows to utilize your own assets. You will also have an assortment of reusable scripts and art assets with which to build future games.

Inhaltsverzeichnis

Frontmatter
Chapter 1. Exploring the Genre
Abstract
As mentioned in the introduction, the classic point and click adventure genre provides not only a forgiving environment in which to create a game, but it also allows you to explore tips, tricks, and techniques often ignored in other beginning Unity game books.
Sue Blackman
Chapter 2. Unity UI Basics—Getting Started
Abstract
As you are probably pretty anxious to get started creating something in Unity, I’ll keep the introduction to Unity’s UI (user interface) rather brief. We will explore and investigate it more fully as the need arises, but for now let’s get a basic feel for the layout and concepts. If you’d like to delve further into the UI before moving on, there is a very good section on getting started in the Unity help files.
Sue Blackman
Chapter 3. Scripting: Getting Your Feet Wet
Abstract
The heart of interactivity is scripting. In Unity, everything needs to be scripted. Fortunately, there are ready-made scripts from a multitude of sources. Unity ships with a large collection of useful scripts to get you up and running. The Help section is full of examples and snippets of script; it also includes a full Scripting section. The Unity3D Wiki, Unity Forum, and Unity Answers are other good sources. Another useful place to find what you need is in the tutorials that you can download from the Unity web site. Most of the tutorial resources do a very good job of explaining what the code does. Note that while Unity scripts can be written in JavaScript, C#, and Boo, most official Unity tutorials and help examples are written in JavaScript, so I will follow suit in this book.
Sue Blackman
Chapter 4. Terrain Generation: Creating a Test Environment
Abstract
One thing common with many game engines is a terrain editor. Not only can you sculpt your idea into being, but you can populate it with foliage from grass to bushes to trees via paint textures.
Sue Blackman
Chapter 5. Navigation and Functionality
Abstract
So far we have explored the terrain in the Scene view with zoom, pan, orbit, and flythrough navigation. Every environment artist’s dream is to be able to experience her creation firsthand. And while “holodeck” technology is not quite here yet, being able to travel through your environment in firstperson mode for the first time is, for many of us, one of the best parts of making real-time games. To make your environment into an actual game environment, you will need to be able to travel around inside the world, responding to terrain topography and large objects during runtime. Only by doing this can you tell if scale, layout, color scheme and all the rest of the design have come together to create the mood you intend. Even though what you’re creating here is just a temporary test scene, the effect is the basis for every entertainment author’s goal-suspension of disbelief.
Sue Blackman
Chapter 6. Cursor Control
Abstract
In point and click games, cursors are a large part of the user experience. Besides showing the user where the cursor pick point is, they often give the user clues as to when they are over an action object and even the type of interaction expected. But when you are navigating about the scene, seeing the cursor flashing off and on tends to squelch the “suspension of disbelief.” As long as you know when the navigation is happening, you probably ought to take the opportunity to hide the cursor.
Sue Blackman
Chapter 7. Action Objects
Abstract
Having made a good start on the cursor, let’s move on to animating our action objects. Obviously, the handful of primitive objects available in Unity won’t go very far for creating games, so you’ll need to look into one of the more challenging aspects of game creation-importing assets built in other programs. As anyone familiar with creating games or other 3D content can tell you, every game engine or 3D application handles the import process differently. Some handle it more gracefully than others, but there are always going to be issues and gotchas. The idea is to try to understand the reasoning behind the implementation and develop guidelines for your own particular needs.
Sue Blackman
Chapter 8. Managing State
Abstract
In classic point and click adventure games, one of the most entertaining and challenging goals is to collect anything and everything that is not nailed down and then try to figure out where it needs to be used. To make things even more interesting, many games require you to combine inventory items before they will be able to perform the necessary task. It may be as mechanically logical as combining a hammer head with a wooden handle to make a usable tool, or as challenging as adding the correct ingredients to a brew. In the former, you might consider the combination object a totally new object that needs to be activated in the scene. In the latter, however, you might need to change its state each time an ingredient is added. Even something as simple as a door can have two states: open and closed. While some states, such as with the door, physically prevent access to a location or crucial object, others, such as a lock on the same door, have no physical manifestation. If the door’s state is locked, interaction with it might produce a rattle, but if its state is unlocked, it will open when picked, putting it into a third state, open. Once you consider adding save and restore functionality to the game, the need for a means to track state becomes even more important.
Sue Blackman
Chapter 9. Object Metadata
Abstract
In the previous chapter you set up the beginnings of your state management system. The ObjectLookup script, using the object’s current state and the cursor or other object that interacted with it, will tell you what state the object goes into and the states that any auxiliary objects go into as well. The bulk of the information, animations, audio clips, descriptions, etc. will be stored on the individual object as metadata in the Interactor script. Each action object will need to know all of the information associated with each of its possible states as well as its current state.
Sue Blackman
Chapter 10. Message Text
Abstract
In this chapter, you were introduced to the Unity GUI as a means of adding 2D text on screen to display mouseover and message text. You discovered the GUISkin, which provides a way of creating GUI elements with a consistent look and feel, and later, the GUIStyle, which is a means of overriding the skin in particular places. You experimented with the parameters for the GUI controls, and found you could make label controls look like box controls while still acting like labels. After you learned that the GUI elements exist only through scripting, you found that Rect parameters define the position and region a control will occupy.
Sue Blackman
Chapter 11. Inventory Logic
Abstract
In shooter-type games where the cursor is hidden during game play, when the user needs to access and interact with menus or other option information, it’s usually handled by stopping game play and loading in an entirely different level for that express purpose. This bypasses the need to suspend navigation, reinstate the cursor, and a number of other issues, many of which you have already solved in previous chapters.
Sue Blackman
Chapter 12. Managing the Inventory
Abstract
Having taken care of most of the preliminary setup for the inventory system, in this chapter you will move on to layout and overflow. The inventory will need to keep an array of all objects it currently contains. For that reason, it makes sense to put inventory-related scripts on the GameManager script.
Sue Blackman
Chapter 13. Finishing the Basic Functionality
Abstract
In this chapter, you will finish the basic functionality for action objects, whether they are 2D or 3D. Besides addressing visibility and the means of achieving it, you will be catching other bits of functionality as they crop up.
Sue Blackman
Chapter 14. Getting Down to Game
Abstract
In this chapter you will finish up the treasure chest sequence, revive the flower so you can get the jewel, import most of the rest of the necessary assets for your game, enhance the temple and make sure the magic happens, and tidy up a few more loose ends.
Sue Blackman
Chapter 15. A Maze and the Final Level
Abstract
The maze has always been a mainstay of adventure games. In the early days of text adventures as well as modern-day, restricted camera type navigation, the game was free to pop up exits or treasure trove areas according to any criteria. In first-person games, however, the maze needs to be based on a physical reality. Moreover, at the very least, it should change every time the game runs, or, better yet, change ingame when specific events are triggered.
Sue Blackman
Chapter 16. Menus and Levels
Abstract
So far you have been working on your game’s basic functionality and are now able to play through the entire game. Having gotten this far, it is time to start thinking about the graphical user interface (GUI) and menus for your game.
Sue Blackman
Chapter 17. Beyond the Basics
Abstract
This is the final chapter, and here you’ll take a look at the logical progressions for your game. There are always more features you could include to make it more interesting or more fun to play. You’re not actually going to add them, but let’s discuss possible means of doing so. You will also assess the changes you would need to implement to take your game from first person to third person format. Since a good portion of your first person functionality carries over into a third person format, it’s well worth discussing. Another topic of interest is porting to mobile platforms. As you may have guessed, there are a lot of technical restrictions as concessions must be made to be able to run everything on smaller devices. Finally, having made it through the process of creating a game utilizing several features beyond basic Unity functionality, you’ll have a go at putting your game into a simple design document.
Sue Blackman
Backmatter
Metadaten
Titel
Beginning 3D Game Development with Unity
verfasst von
Sue Blackman
Copyright-Jahr
2011
Verlag
Apress
Electronic ISBN
978-1-4302-3423-4
Print ISBN
978-1-4302-3422-7
DOI
https://doi.org/10.1007/978-1-4302-3423-4