Unity iOS Essentials


Unity iOS Essentials
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Learn key strategies and follow practical guidelines for creating Unity 3D games for iOS devices.
  • Learn how to plan your game levels to optimize performance on iOS devices using advanced game concepts.
  • Full of tips, scripts, shaders, and complete Unity 3D projects to guide you through game creation on iOS from start to finish.

Images

Book Details

Language : English
Paperback : 358 pages [ 235mm x 191mm ]
Release Date : December 2011
ISBN : 1849691827
ISBN 13 : 9781849691826
Author(s) : Robert Wiebe
Topics and Technologies : All Books, Mobile Application Development, Unity, iOS, Mobile, Games

Table of Contents

Preface
Chapter 1: Planning Ahead for a Unity3D iOS Game
Chapter 2: iOS Performance Guide
Chapter 3: Advanced Game Concepts
Chapter 4: Flyby Background
Chapter 5: Scalable Sliding GUIs
Chapter 6: Preferences and Game State
Chapter 7: The Need for Speed
Chapter 8: Making it real
Chapter 9: Putting it all together
Index
  • Chapter 1: Planning Ahead for a Unity3D iOS Game
    • iOS device differences
    • Unity support for multiple iOS devices
      • Terrain and trees
      • Cut scenes
      • Audio
      • Lighting
      • Shadows
      • Modeling and Animation
      • Cloth
      • Code stripping
      • The iPhone classes and global enumerations
    • Understanding iOS SDKs and target platforms
    • Set up an iOS App for multiple target building
    • Planning efficient levels
      • Well then, let's get started!
        • First consideration: Is my game 2D or 3D?
        • Second consideration: How will I structure my levels?
        • Third consideration: How can I make scenes realistic?
        • Fourth consideration: Embellishment
        • Fifth consideration: Teleportation
        • To summarize:
      • Culling is important
        • Near Clip
        • Far clip
      • Distance culling
      • Occlusion culling
    • Summary
    • Chapter 2: iOS Performance Guide
      • Choose the right game
        • Stay grounded
        • Choose first person
        • Avoiding third person
        • Things to avoid
          • Open planes
          • Speed
          • Flight
          • Artificial Intelligence (AI)
        • Things to include
          • Skybox
          • Rolling our own terrain
          • Mountainous terrain
          • Using urban terrain
          • Adding life
          • Using suburban terrain
          • Using platform terrain
        • Mobile game genres
          • Platformer basics
          • First Person Shooter basics
          • Puzzle basics
          • Arcade basics
      • Unified graphic architecture
        • Shared memory
        • Shared processing
        • Vertex Processing Unit (VPU)
        • Advanced RISC Machine (ARM) Thumb
      • Dos and Don'ts
        • Programming the main loop
          • Model View Controller (MVC)
          • Springboard of death
          • Cache it: Awake() and Start()
          • Coroutines, not Update()
          • Time
          • Make it static, why instantiate?
          • Use hashtables
          • Triggers and collisions
          • OnBecameVisible()/OnBecameInvisible()
          • ApplicationWillTerminate() or ApplicationWillSuspend()
          • Strict compilation
          • Compilation order
        • Design to load additively
        • Artwork
          • Vertex count
          • Skinned meshes
          • Alpha testing
          • Lights
          • Post processing
        • Physics
          • FixedUpdate()
          • Collision detection
          • Deployment
      • Culling is important
        • Frustum culling
          • Camera clipping planes
        • Camera layer culling
        • Occlusion culling
      • Summary
      • Chapter 3: Advanced Game Concepts
        • Engaging menus
          • Mouse over
          • Mouse click
          • Screen size
          • Shake
          • Think outside of the computer
        • Dealing with device screen resolutions
          • Convert to pixels in scripts
          • Scale bitmaps in scripts
        • Testing iOS games in the editor
          • Simulating the accelerometer
        • Using shaders to solve real-world problems
          • Shading/Lighting models
            • Phong
            • Constrained (Blinn-Phong)
            • Flat (Gouraud)
          • Applying shaders to solve problems
            • Z-Fighting
            • Back face rendering
        • Organizing game objects for easy asset sharing
        • Summary
        • Chapter 4: Flyby Background
          • Set up a background scene
          • Set up the camera path
          • Set up the main menu
          • Testing the scene in the editor
            • Enable the Stats option
            • Choose Graphics Emulation
            • Click the Play button and repeat
          • Setup for multiple iOS device deployment
            • Build Settings
            • Select iOS
            • Cross-Platform Settings
            • Resolution and Presentation
            • The Icon
            • The Splash Image (Pro feature)
            • Other Settings
              • Rendering
              • Identification
              • Configuration
              • Optimization
          • Deploy the App to multiple devices
          • Task: create the background scene
          • Task: create a path to follow
          • Task: putting it all together with the menu
          • Challenge: flipping the iOS device
          • Summary
          • Chapter 5: Scalable Sliding GUIs
            • Think about resolution not pixels
            • Separating dialogs from contents
              • The buttons
              • The hook
            • Dialog location, animation, and speed
              • Dialog location
              • Dialog sliding
              • Dialog fade
              • Dialog speed
            • Task: script a scalable dialog
              • Set up the OptionsDialog
              • Set up the OptionsDialogContent and OptionsDialogControl
              • Set up the messages
            • Task: script some dialog contents
            • Challenge: making things flexible in the editor
            • Challenge: creating custom GUI elements
            • Summary
            • Chapter 6: Preferences and Game State
              • Introducing .NET
                • System.Environment
                • System.Collections
                • System.IO
                • System.xml
              • Understanding property lists
              • Handling different game players
              • Deciding where to put files
              • Task: load and save the players' preferences
                • Using the Globals.js script
                • Creating the defaultoptions.plist file
                • Provide a GUI dialog for the options
              • Task: create a GUI to get the players' names
                • Add the player name variable to Globals.js
                • Create the new GUI Dialog game objects
                • Add the GUI dialog scripts
              • Challenge: load and save the player's game state
              • Summary
              • Chapter 7: The Need for Speed
                • Adding a four-wheeled vehicle
                  • Unity3D Car Tutorial
                  • JCar
                    • A JCar vehicle model
                    • Enabling JCar steering
                    • Connecting a Joystick to JCar
                • Managing physics
                  • Large objects
                  • Mid-sized objects
                • Realistic and fast foliage
                  • A typical tree
                  • Foliage for iOS devices
                    • Foliage that does not use transparency
                    • Foliage that uses a single plane with transparency
                    • Foliage that uses multiple planes with transparency
                  • Foliage colliders
                • Culling made easy
                  • Distance culling
                  • Occlusion culling
                • Task: build your track
                • Task: create a death zone
                • Challenge: eliminate Z-Fighting
                • Summary
                • Chapter 8: Making it real
                  • Lighting and lightmapping the track
                    • Preparing for lightmapping
                      • Lightmap UVs
                      • Static objects only
                      • Triangulate objects before import
                      • Adjust ambient light
                    • Lighting the track
                    • Lightmapping the track
                  • Particles that pop
                    • Renderer
                      • Trail
                      • Line
                      • Particle
                    • iOS recommendations
                    • Creating particles in your particle system
                    • Animating particles
                      • Emission velocity versus added force
                      • Color
                      • Growth
                      • Autodestruct
                    • Particle example: Weather
                  • Shaders in the game world
                    • Anatomy of shaders
                      • Geometry and its properties
                      • Other passed values
                      • Shading approximation
                      • Depth
                      • Platform capability and subshaders
                      • Begin the pass
                      • Alpha testing
                      • To the screen (BLIT and Rasterization)
                      • Fallback
                    • Fun examples
                      • Gems
                      • Simple metal
                  • Water that works
                  • Task: The final track
                  • Task: Create a rich and engaging scene
                  • Summary
                  • Chapter 9: Putting it all together
                    • Ending or suspending the game under multitasking
                      • OnApplicationPause
                      • OnApplicationQuit
                    • Top scores board
                      • Setting up the database
                        • Create a MySQL database
                        • Create player and game achievement tables
                      • Writing the server PHP scripts
                        • Add a new player
                        • Update the player's score
                        • Retrieve the top score
                    • Task: Publish results online
                    • Task: Build and deploy the finished game to multiple iOS devices
                    • Summary

                    Robert Wiebe

                    Robert Wiebe was born in 1961. He has more than 30 years experience designing, implementing, and testing software. He wrote his first App in 1979, as a high school student, using 6502 assembler code on an Ohio Scientific C2-4P computer with 8k RAM. More recently, he has focused on developing games and utilities for Mac OS X. His interests include a vintage computer collection which includes many pre-IBM PC era microcomputers; Apple Macintosh computers starting with the SE/30 running Mac OS 7 through to the Macbook Pro running Mac OS X that he uses today. He has developed many popular Mac OS X Apps including ShredIt X, NetShred X, Music Man, iVCD, and many more. He has experience developing software in a number of industries, including mining, finance, and communications. He has worked for a number of employers including Motorola as a Senior Systems Architect developing two-way wireless data systems and Infowave Software as the Software Development Manager for their Imaging Division. After working for other people's companies, he founded his own companies, Mireth Technology and Burningthumb Software, which are his primary interests today. He is also the author of Unity iOS Essential book (ISBN 978-1-849691-82-6).
                    Sorry, we don't have any reviews for this title yet.

                    Code Downloads

                    Download the code and support files for this book.


                    Submit Errata

                    Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                    Errata

                    - 23 submitted: last submission 10 Dec 2012

                    Errata type: text Page no: 11

                    Replace the following sentence :
                    If we plan to use transparency then we need to add 0.5 (which is the rating in the previous table)
                    With the following:
                    If we plan to use transparency then we need to add 0.5 to the rating in the previous table.

                    Errata type:Text Page no:16

                    Replace the following:
                    • Directional: This is a type of lighting that is indefinitely far away and affects everything in the scene, such as sunlight
                    • Point: This is a type of lighting that affects everything within range of its position in the scene
                    • Spot: This is a type of lighting that affects everything in a cone shape, defined by its angle and range from its position in the scene
                    With the following:
                    • Directional: This type of lighting is indefinitely far away and can be used for effects, such as sunlight, because it affects everything in the scene.
                    • Point: This type of lighting is defined by its origin and its radius to create a sphere. Any mesh intersecting with this sphere will be lit.
                    • Spot: This type of lighting affects everything in a cone shape defined by its angle and range from its position in the scene.

                    Errata type:Text Page no:17

                    Replace the following sentence:
                    Rather than using dynamic lighting, lightmapping should be used, when possible, to render much higher quality effects with less bandwidth.
                    With the following:
                    Rather than using dynamic lighting, lightmapping should be used , when possible, to render much higher quality effects with less bandwidth. It should be noted that in single lightmap mode (which is the only mode supported by iOS devices), real time lights will not affect lightmapped meshes.

                    Errata type:Text Page no:17

                    Replace the following sentence:
                    On desktop platforms, shadows would also be an important consideration, but on mobile platforms, dynamic shadows are supported.
                    With the following:
                    On desktop platforms, shadows would also appear to be an important consideration, but on mobile platforms, dynamic shadows are not supported.

                    Errata type:Text Page no:20

                    Replace the following sentence:
                    If only one skinned mesh is used, Unity3D has optimizations related to visibility culling and bounding volume updating.
                    With the following:
                    If only one skinned mesh is used per character rig, Unity3D has optimizations related to visibility culling and bounding volume updating.

                    Errata type:Text Page no:24

                    Replace the following sentence:
                    But that is not what Apple want us to do, and really, its not what we want to do either.
                    With the following:
                    But that is not what Apple wants us to do, and really, its not what we want to do either.

                    Errata type:Text Page no:31

                    Replace the following 3rd heading:
                    Fog: Not such a great idea
                    With the following:
                    Fog: Not a bad idea

                    Also, replace the following sentence under the above heading:
                    Another factor that has led us to use fog as an embellishment device is that fog adds ambience.
                    With the following:
                    Another factor that has led us to use fog, is that it can be used as an embellishment device to add ambience.

                    Errata type:Text Page no:37

                    Replace the following sentence:
                    The far clip plane refers to the maximum distance away from the camera an object can be, before it will be clipped (not rendered).
                    With the following:
                    The far clip plane refers to the maximum distance away from the camera an object can be, before it will be sliced, resulting in a mesh that may be partially rendered or totally not rendered.

                    Errata type:Text Page no:37

                    Replace the following sentence:
                    Arguably, there is no reason to have a far clip plane because distance culling should take care of it - but because distance culling does not have to apply to every object in a scene, the far clip plane is the default.
                    With the following:
                    Arguably, there is no reason to have a far clip plane, because distance culling should take care of it—but because Unity3D needs to know the absolute maximum distance at which an object must be rendered, the far clip must still be defined even when using distance culling.

                    Errata type:Text Page no:40

                    Replace the following sentence:
                    While iOS devices have built-in dedicated vertex computation, hardware occlusion culling can still be beneficial because Unity3D can avoid passing invisible geometry to said hardware.
                    With the following:
                    While iOS devices have built-in dedicated vertex computation hardware, occlusion culling can still be beneficial because Unity3D can avoid passing invisible geometry to said hardware.

                    Errata type:Text Page no:41

                    Replace the following sentence:
                    Occlusion culling is achieved by pre-computing PVS (Potential Visible Set), an array of bounds that cache the geometry, which should be rendered when a camera is facing a certain direction.
                    With the following:
                    Occlusion culling is achieved by pre-computing the Potential Visible Set (PVS), an array of bounds that cache the geometry which should be rendered, when a camera is facing a certain direction.

                    Errata type:Text Page no:44, 2nd paragraph, 6th line

                    Replace the following sentence:
                    This is not meant to imply that the Y-axis is never ignored, but rather to clarify that the Beast Occlusion culling engine will need to do more calculations, when the player is not grounded (assuming additional cells are stacked).
                    With the following:
                    This is not meant to imply that the Y-axis is never ignored but rather to clarify that the UMBRA Occlusion culling engine will need to do more calculations for when the player is not grounded (assuming additional cells are stacked).

                    Errata type:Text Page no:54

                    Replace the following sentence, which is the 1st point inside the table under the column Description:
                    It may be required to complete a level 100 percent or it may have monetary value.
                    With the following:
                    It is required to keep the player armed for the duration of the game.

                    Errata type:Text Page no:55

                    Replace the following sentence, which the 3rd ponint inside the table under the column Description:
                    Science fiction genre shooters usually contain enemy aircrafts.
                    With the following:
                    Science fiction genre shooters usually contain alien aircraft.

                    Errata type:Text Page no:56

                    Replace the following sentence under the heading Arcade basics:
                    These days, we can ask for another 25 cents every time someone runs out of lives, but we can still manage to sell something highly addictive.
                    With the following:
                    These days, we can’t ask for another 25 cents every time someone runs out of lives, but we can still manage to sell something highly addictive.

                    Errata type:Text Page no:57

                    Replace the following sentence, which is the 2nd point inside the table under the column Description:
                    However, if we were sneaky, we might get away with selling them credits via an app purchase. The usual work around for this inconvenience is to penalize the player by subtracting a large number of points, if they choose to continue.
                    With the following:
                    The usual work around for this inconvenience is to penalize the player by subtracting a large number of points, if they choose to continue. However, if we were sneaky, we might get away with selling them credits via In-App purchase.

                    Errata type:Text Page no:61

                    Replace the following sentence:
                    The advantages of using Coroutines are given as follows:
                    With the following:
                    Some important things to know about Coroutines are as follows:

                    Replace the following sentence:
                    A generator behaves like functions, but preserves its state between invocations.
                    With the following:
                    A generator behaves like a function, but preserves its state between invocations.

                    Errata type:Text Page no:66-67

                    Replace the following paragraphs:
                    When an object collides in Unity3D the collision detection system will call a function on both objects. The function that is called depends on whether or not the collider is defined as a trigger. If the collider is not a trigger then the OnCollision variance of functions are called. If the collider is a trigger then the OnTrigger variance of the functions are called.

                    The fundamental difference between two collision detection mechanisms is that the information gets passed to the functions. OnCollision is expensive due to the calculations that need to be made to pass in the collision information, so it should only be used if you really need that information. If you just need to know that a collision occurred then either use triggers on the OnCollision functions without a parameter. There is a function called OnTriggerStay() that can be used to perform some actions when an object remains in a trigger area. While this may seem like a useful function, it is highly inefficient unless we need to check every frame.

                    Typically, we only need to perform this check periodically. GIven that there is no reason to use OnCollisonStay(). Instead, we can begin a coroutine OnCollisonEnter() and use a flag to terminate it in OnCollisonExit().

                    With the following paragraphs:
                    When an object collides in Unity3D the collision detection system will call a function on both objects. The function that is called depends on whether or not the collider is defined as a trigger. If the collider is not a trigger then the OnCollision functions are called. If the collider is a trigger then the OnTrigger functions are called.

                    The fundamental difference between two collisions detection mechanisms is that the information gets passed to the functions. OnCollisionEnter(collisionInfo : Collision) is expensive due to the calculations that need to be made to pass in the collision information, so it should only be used if you really need that information. If you just need to know that a collision occurred, then either use OnCollision functions without a parameter, or if the object does not actually need to physically collide use a trigger. There is also a function called OnTriggerStay() that can be used to perform some actions when an object remains in a trigger area. While this may seem like a useful function, it is highly inefficient, unless we need to check every FixedUpdate().

                    Typically, we only need to perform this check periodically. Given that, there is no reason to use OnCollisonStay(). Instead, we can begin a Coroutine OnCollisonEnter() and use a flag to terminate it in OnCollisonExit().

                    Errata type:Text Page no:69

                    Replace the following sentence under the heading Artwork:
                    The bottom line is simple– what works on other platforms does not work on iOS devices.
                    With the following:
                    The bottom line is simple– what works on more powerful platforms likely does not work on iOS devices.

                    Errata type:Text Page no:71

                    Replace the following sentence:
                    Making of an alpha map is discussed further in the foliage section of this book and in the Unity3D manual under the heading, Graphics Questions.
                    With the following:
                    Making an alpha map is discussed further in the Making it real section of this book (page number: 267) and in the Unity3D manual under the heading, Graphics Questions.

                    Replace the following sentence, which is the 1st bullet point under the heading Lights:
                    Ambient lights With the following point:
                    Ambient light

                    Errata type:Text Page no:78

                    Replace the following sentence, the 4th paragraph under the heading Occulusion culling:
                    Since target volumes are more computationally expensive( they are calculated at runtime), they should not be combined with view volumes.
                    With the following:
                    Since target volumes are more computationally expensive( they are calculated at runtime), they should not occupy a large amount of space like view volumes.

                    Errata type:Code Page no:259

                    Replace the following code line:
                    Ambient * RenderSettings +
                    With the following:
                    RenderSettings.Ambient +

                    Errata type:Text Page no:260

                    Add the following sentence at the beginning of this page:
                    In order to use lighting data in our shader we should declare a material block, specifying which lighting properties our shader will use as in the following example:

                    Sample chapters

                    You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                    Frequently bought together

                    Unity iOS Essentials +    Oracle Enterprise Manager Grid Control 11g R1: Business Service Management =
                    50% Off
                    the second eBook
                    Price for both: £29.05

                    Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                    What you will learn from this book

                    • Plan and organize game levels to work on the various iOS devices: iPhone, iPod Touch, and iPad.
                    • Important iOS performance considerations and how iOS platforms differ from desktop platforms.
                    • Develop games that work with multiple device screen resolutions and orientations.
                    • Manage sophisticated game state and user preferences.
                    • Essential .NET classes.
                    • Develop a four wheeled vehicle with realistic physics.
                    • Deal with the various methods of culling available in Unity 3D for iOS.
                    • Integrate Unity3D for iOS games with servers to store things like high scores and achievements.

                     

                    In Detail

                    Unity is the perfect tool for creating games for a number of platforms. Whether it’s for the iPhone, iPod Touch, iPad, or some combination of the three, this book takes a practical approach which maximizes performance while maintaining maximum compatibility across the entire mobile device line up.

                    Unity iOS Essentials takes you through all aspects of Unity 3D game development for iOS. Mobile game development means thinking about mobile performance, multiple device screen resolutions, deploying a single application to multiple devices, understanding .NET integration, taking advantage of advanced lighting and culling systems, and integrating a mobile game with a server back end. This comprehensive book on developing Unity 3D games for iOS covers it all and demonstrates the concepts using practical tips, scripts, shaders, and projects.

                    Learn how to plan for supporting multiple iOS devices before you start writing your first script. Consider performance and advanced game topics that will speed up your game development while solving real world problems. Add GUIs, use sophisticated .NET programming concepts, and examine scripts and shaders, interact with servers, and interact with projects that deal with real issues. Unity iOS Essentials provides you with a fully illustrated and fully commented guide for realising your game idea using advanced concepts that work on the iOS family of mobile devices.

                    Approach

                    You will start by considering the essential differences between mobile and desktop game development. You will then get straight into creating unity projects that will run on the entire spectrum of iOS devices.

                    Who this book is for

                    This book is for people who want to plan, develop, and deploy Unity 3D games on iOS mobile platforms, including iPhone, iPod Touch and iPad. Anyone who has experience with the free desktop version of Unity 3D can pick up this book and learn how to take the desktop skills and optimize them to work on the mobile iOS platforms. Some of the features in this book discuss the Pro features of Unity 3D for iOS so a Pro license is required to use some of the features (notably Occlusion Culling and Beast Light mapping).

                    Code Download and Errata
                    Packt Anytime, Anywhere
                    Register Books
                    Print Upgrades
                    eBook Downloads
                    Video Support
                    Contact Us
                    Awards Voting Nominations Previous Winners
                    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                    Resources
                    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software