You are previewing Unity iOS Essentials.
O'Reilly logo
Unity iOS Essentials

Book Description

Develop high performance, fun iOS games using Unity 3D

  • 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.

  • 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.

    Table of Contents

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