You are previewing Marmalade SDK Mobile Game Development Essentials.
O'Reilly logo
Marmalade SDK Mobile Game Development Essentials

Book Description

Get to the grips with the Marmalade SDK to develop games for a wide range of mobile devices, including iOS and Android and more

  • Easy to follow with lots of tips, examples and diagrams, including a full game project that grows with each chapter

  • Build video games for all popular mobile platforms, from a single codebase, using your existing C++ coding knowledge

  • Master 2D and 3D graphics techniques, including animation of 3D models, to make great looking games

In Detail

Modern mobile devices are capable of supporting video games of amazing quality but there are so many different devices and platforms how can you support them all? The answer is to use the Marmalade SDK to write your code once and deploy it to all popular mobile platforms at the touch of a button.

Marmalade SDK Mobile Game Development Essentials will provide you with everything you need to know to transfer your existing C++ videogame programming knowledge to mobile devices. From graphics and sound to input methods and actual deployment to device, this book covers the lot.Learn how to make use of keys, touch screen and accelerometer inputs for controlling your game.Take the pain ssout of supporting a varied range of target devices, both across multiple platforms and multiple specifications.

Step by step from “Hello World” to a complete game, this book will show how to use the Marmalade SDK to develop games for mobile devices.

Learn how to make dazzling 2D and 3D games complete with fully animated characters, music and sound effects that can be deployed to all the leading mobile platforms, whilst ensuring it can run on a wide range of possible devices, from low specification to high end.

If you want to join the exciting world of mobile videogames then Learning Mobile Game Development with Marmalade will show you how to do so, fast!

Table of Contents

  1. Marmalade SDK Mobile Game Development Essentials
    1. Table of Contents
    2. Marmalade SDK Mobile Game Development Essentials
    3. Credits
    4. About the Author
    5. About the Reviewers
      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
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started with Marmalade
      1. Installing the Marmalade SDK
        1. Installing a development environment
        2. Choosing your Marmalade license type
        3. Downloading and installing Marmalade
        4. Using the Marmalade Configuration Utility
        5. Managing your Marmalade account and licenses
          1. Viewing an overview of your account
          2. Updating your profile information
          3. Managing your licenses
          4. Managing your user list
      2. Creating a Marmalade project
        1. Creating the "Hello World" project
          1. The MKB file for the "Hello World" project
          2. The source file for the "Hello World" project
        2. Building the "Hello World" project
          1. The build directory
          2. The data directory
            1. The app.config.txt file
            2. The app.icf file
        3. Building and running in the Windows simulator
      3. Deploying a Marmalade project
        1. Compiling the "Hello World" project for the ARM CPU
        2. Deploying the "Hello World" project
          1. Installing on Android devices

          2. Installing on iOS devices
          3. Installing on BlackBerry QNX devices
          4. Installing on Bada devices
      4. Summary
    9. 2. Resource Management and 2D Graphics Rendering
      1. The Marmalade ITX file format
        1. The CIwManaged class
          1. Instantiating a class with the class factory
          2. Parsing a class
          3. Serializing a class
          4. Resolving a class
      2. The Marmalade resource manager
        1. Adding IwResManager to a project
        2. Specifying resources with a GROUP file
        3. Loading groups and accessing resources
        4. The CIwResource class
        5. GROUP file serialization
        6. Resource handlers
      3. Graphics APIs provided by the Marmalade SDK
        1. The s3eSurface API
        2. The IwGL API and OpenGL ES
        3. The Iw2D API
        4. The IwGx API
      4. Using IwGx to render 2D graphics
        1. IwGx initialization and termination
        2. Rendering a polygon
          1. Materials and textures
            1. Creating materials in code
            2. Creating materials using an MTL file
          2. Vertex streams
          3. Color streams
          4. UV streams
          5. Drawing a polygon
          6. Displaying the rendered image
      5. Example code
        1. The ITX project
        2. The Graphics2D project
        3. The Skiing project
          1. The GameObject class
          2. The ModeManager and Mode classes
      6. Summary
    10. 3. User Input
      1. Detecting key input
        1. Initialization and update of key information
        2. Detecting key state
          1. Detecting key state changes using polling
          2. Detecting key state changes using callbacks
        3. Detecting character code input
          1. Detecting character code input using polling
          2. Detecting character code input using callbacks
        4. Inputting strings
      2. Detecting touch screen and pointer input
        1. Determining available pointer functionality
          1. Determining the type of pointer input
          2. Determining the type of stylus input
        2. Updating current pointer input status
        3. Detecting single touch input
          1. Detecting single touch input using polling
          2. Detecting single touch input using callbacks
        4. Detecting multi-touch input
          1. Detecting multi-touch input using polling
          2. Multi-touch input using callbacks
        5. Recognizing gesture inputs
          1. Detecting a swipe gesture
          2. Detecting a pinch gesture
      3. Detecting accelerometer input
        1. Starting and stopping accelerometer input
        2. Reading accelerometer input
        3. Smoothing accelerometer input
        4. Testing accelerometer input on the Windows simulator
      4. Example code
        1. The Gesture project
        2. The Slide project
        3. The Skiing project
          1. Player rotation
          2. The ModeTitle and ModeGameOver classes
          3. The Camera class
          4. The Input Manager classes
          5. The SkierController class
      5. Summary
    11. 4. 3D Graphics Rendering
      1. A quick 3D graphics primer
        1. Describing a 3D model
          1. Specifying a model's vertex stream
          2. Specifying a model's index stream
          3. Specifying a model's color, UV, and normal streams
        2. Performing 3D to 2D projection
          1. Understanding matrices for 3D graphics
          2. Converting between coordinate systems
          3. Clipping planes
        3. Lighting
          1. Emissive lighting
          2. Ambient lighting
          3. Diffuse lighting
          4. Specular lighting
      2. Using IwGx to render 3D graphics
        1. Preparing IwGx for 3D rendering
        2. Setting lighting information
        3. Model data for the cube
        4. The view matrix
        5. The model matrix
        6. Rendering the model
      3. Using a 3D modeling package to create model data
        1. The Marmalade 3D exporter plugins
          1. Installing the plugins
          2. Exporting a model
        2. The Blender plugin
          1. Installing Blender and the exporter plugin
          2. Exporting a model
      4. The Marmalade 3D model datafile formats
        1. The GROUP file
        2. The MTL file
        3. The GEO file
      5. Loading and rendering an exported 3D model
        1. Adding the IwGraphics API to a project
        2. Loading and accessing an exported 3D model
        3. Rendering an exported 3D model
        4. Releasing 3D model data
      6. Example code
        1. The Cube project
        2. The Cube2 project
        3. The Skiing project
          1. Migration to 3D
          2. Addition of a collision detection system
      7. Summary
    12. 5. Animating 3D Graphics
      1. A quick 3D animation primer
        1. Animating with model matrices
          1. Animating by translation
          2. Animating by rotation
            1. Rotation using Euler angles
            2. Rotation using axis-angle pairs
            3. Rotation using quaternions
          3. Animating by scaling
        2. 3D model animation
          1. Using morph targets
          2. Using boned animations
      2. Using a 3D modeling package to create animation data
        1. Exporting animations using the Marmalade 3D exporter plugins
        2. Exporting animations using the Blender plugin
      3. The Marmalade 3D animation file formats
        1. The SKEL file
        2. The SKIN file
        3. The ANIM file
      4. Loading and rendering an exported 3D animation
        1. Adding the IwAnim API to a project
        2. Loading and accessing a 3D animation
        3. Playing back a 3D animation
        4. Rendering a 3D animation
      5. Exploring 3D animation further
        1. Playing an animation backwards
        2. Blending between animations
        3. Detecting animation playback events
        4. Optimizing animation playback
        5. Playing sub-animations
        6. Offset animations
        7. Obtaining bone positions and rotations
      6. Example code
        1. The Flag project
        2. The Skiing project
          1. New gameplay features
          2. Animations added
      7. Summary
    13. 6. Implementing Fonts, User Interfaces, and Localization
      1. Implementing fonts
        1. Adding the IwGxFont API to a project
        2. Creating a font resource
        3. The GXFONT file format
        4. Loading and accessing font resources
        5. Drawing text using a font resource
          1. Drawing text on screen
          2. Text wrapping and justification
          3. Changing font size at runtime
          4. Optimizing drawing by preparing text
      2. Implementing user interfaces
        1. The IwUI API
        2. The IwNUI API
        3. Implementing our own user interface solution
          1. Using a generic approach
          2. Making good use of class inheritance
          3. Implementing a data-driven system
          4. Responding to user input events
          5. Screen resolution and orientation
          6. Adding template functionality
      3. Localizing your project
        1. Creating a text spreadsheet
        2. Getting the text into the game
          1. Comma-separated values files
          2. Processing using a Python script
          3. Selecting the correct language to use at runtime
      4. Example code
        1. The Font project
        2. The UI project
        3. The Skiing project
      5. Summary
    14. 7. Adding Sound and Video
      1. Multimedia support in Marmalade
      2. The s3eAudio API
        1. Starting audio playback
        2. Pausing, resuming, and stopping playback
        3. Changing volume
        4. Other audio queries
        5. End of track notification
      3. The s3eSound API
        1. Starting sound playback
        2. Pausing, resuming, and stopping playback
        3. Global sound settings
        4. Sound notifications
      4. The SoundEngine module
        1. Adding the SoundEngine module to a project
        2. Loading and accessing sound resources
        3. Playing, stopping, and altering sound parameters
      5. The s3eVideo API
        1. Starting video playback
        2. Determining video codec support
        3. Pausing, resuming, and stopping video playback
        4. End of video notification
        5. Other video queries
      6. Example code
        1. The Sound project
        2. The Video project
        3. The Skiing project
      7. Summary
    15. 8. Supporting a Wide Range of Devices
      1. Accommodating a wide range of device types
        1. Dealing with different screen resolutions
        2. Using different resources for different screen resolutions
        3. Checking device capabilities
      2. Configuring your game using ICF file settings
        1. Built-in ICF settings
        2. Defining new ICF settings
        3. Accessing ICF settings in code
        4. Limiting ICF settings by platform and device
      3. Creating multiple resource sets
        1. Using build styles
          1. Adding extra resource directories
          2. Supported build style platforms
          3. Specifying which build style to use
        2. Using resource templates
          1. Defining material templates
          2. Defining image templates
          3. Defining model templates
          4. Defining animation templates
          5. Defining GROUP file templates
        3. Producing binary versions of resources
      4. Compressing resources using the Derbh archiver
        1. Creating a Derbh archive
        2. Using a Derbh archive in code
        3. The automatic Derbh method
      5. Creating different deployment types
        1. Specifying icons, application names, and other details
        2. Specifying asset lists
        3. Creating and using deployment types
      6. Example code
        1. The build styles project
        2. The Skiing project
      7. Summary
    16. 9. Adding Social Media and Other Online Services
      1. Launching a web page in the device browser
      2. Integrating with social media
        1. Using Facebook
          1. Creating a Facebook app
          2. Creating a Facebook test user
          3. Adding the s3eFacebook API to a Marmalade project
          4. Checking for s3eFacebook support
          5. Initialization and termination
          6. Logging in and out of Facebook
          7. Posting a message to a user's wall
          8. Further s3eFacebook features
        2. Using Twitter
      3. Connecting to other types of online services
        1. Supporting social gaming networks
          1. Using Apple's Game Center
          2. Using Scoreloop
        2. Supporting in-app purchases
          1. Adding in-app purchasing for iOS devices
          2. Adding in-app purchasing for Android devices
        3. Using advertising
          1. Implementing iAd support for iOS devices
          2. Using other advertising solutions
      4. Example code
        1. The Facebook project
        2. The Skiing project
      5. Summary
    17. 10. Extending Marmalade with the Extensions Development Kit (EDK)
      1. Why is the EDK necessary?
      2. Creating an extension for gyroscope input
        1. Declaring the extension API
        2. Making an extension for Windows
          1. Creating a Windows extension
          2. Implementing a Windows extension
          3. Building a Windows extension
        3. Making an Android extension
          1. Installing the required software for Android development
          2. Creating an Android extension
          3. Implementing an Android extension
          4. Building an Android extension
        4. Making an iOS extension
          1. Installing the required software for iOS development
          2. Creating an iOS extension
          3. Implementing an iOS extension
          4. Building an iOS extension
      3. Using the Gyroscope extension
      4. Example code
        1. The Gyroscope project
        2. The GyroTest project
        3. The Skiing project
      5. Summary
    18. Index