Mastering Android Game Development
eBook - ePub

Mastering Android Game Development

Raul Portales

Buch teilen
  1. 372 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Mastering Android Game Development

Raul Portales

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Mastering Android Game Development als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Mastering Android Game Development von Raul Portales im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatica & Intelligenza artificiale (IA) e semantica. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Mastering Android Game Development


Table of Contents

Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Setting Up the Project
The right tool for the right game
Do you want to use 3D?
Do you want to use physics?
Do you want to use Java?
Pros of building games with the Android SDK
Cons of building games with the Android SDK
I want the Android SDK!
The project – YASS (Yet Another Space Shooter)
Activities and Fragments
Project setup
Creating the stub project
Cleaning up
Choosing an orientation
Dealing with aspect ratios
Game architecture
GameEngine and GameObjects
Starting a game
Stopping a game
Managing game objects
UpdateThread
DrawThread
User input
Putting everything together
Moving forward with the example
Handling the back key
Honoring the lifecycle
Using as much screen as we can
Before Android 4.4 – almost fullscreen
Android 4.4 and beyond – immersive mode
Putting fullscreen together
Good practices for game developers
Object pools
Avoiding enhanced loop syntax in lists
Precreating objects
Accessing variables directly
Being careful with floating points
Performance myths – avoid interfaces
Summary
2. Managing User Input
The InputController base class
The Player object
Displaying a spaceship
Firing bullets
The Bullet game object
The most basic virtual keypad
Limitations and problems
Creating a virtual joystick
General considerations and improvements
Physical controllers
Handling MotionEvents
Handling KeyEvents
Detecting gamepads
Sensors and InputControllers
Selecting control modes
Summary
3. Into the Draw Thread
Using GameView
The GameView interface
StandardGameView
SurfaceGameView
Updating GameEngine
Updating the game layout
Improving DrawThread
Sprites
Updating the spaceship and bullets
Adding a frames-per-second (fps) counter
Spawning enemies – the GameController
Procedural/random
Deterministic/static
Hybrid approach
Our approach
The asteroids
More on the transformation matrix
Occlusion culling
Parallax backgrounds
Multiple backgrounds
Layers
Summary
4. Collision Detection
Detecting collisions
Who can collide?
Updating GameEngine
Handling collisions
Rectangular bodies
Adding visual feedback
Pros and cons
Circular bodies
Adding visual feedback
Pros and cons
Mixed collision detection
Adding visual feedback
Other options for shapes
Optimization
Spatial partitioning and QuadTree
Duplicated collisions
Summary
5. Particle Systems
General concepts
Particles
ParticleSystem
Initializers
Modifiers
Composite GameObjects and GameEngine
Making good particle systems
One shot
Asteroid explosions
Spaceship explosions
Emitters
Asteroid trails
The spaceship's engine
Summary
6. Sound FX and Music
SoundManager
Sound FX
How to create sound FXs
GameEvents
Using SoundPool
Playing music
Obtaining music
MediaPlayer
Music and Activity life cycle
Enabling and disabling music and sound FX
Updating MainMenuFragment
Updating SoundManager
Disabling system sounds
Summary
7. Menus and Dialogs
Custom fonts
Working with backgrounds
The power of XML drawables
State list drawables
State lists colors
Shape drawables
The GameFragment
Adding a score
Adding lives
Custom dialogs
BaseCustomDialog
Quit dialog
Pause dialog
Game Over dialog
Other dialogs
Designing for multiple screen sizes
Summary
8. The Animation Framework
Updating BaseFragment
AnimationDrawable
Animated sprites
Animating views
XML versus code
Interpolators
View animation
Animating dialogs
Delaying the action in the dialogs to onDismissed
Pulsating buttons
Property animation
ViewPropertyAnimator
Moving a spaceship around
Animating the main menu
Summary
9. Integrating Google Play Services
Setting up the developer console
Setting up the code
Achievements
Architecture
Unlocking achievements
Leaderboards
Opening the Play Games UI
Other features of Google Play services
Events
Quests
Gifts
Saved games
Multiplayer games
Summary
10. To the Big Screen
Project configuration
Testing for Android TV
Declaring a TV Activity
Providing a home screen banner
Declaring it as a game
Declaring Leanback support
Declaring touchscreen capability as not required
Reviewing the manifest
Showing controller instructions
Dealing with overscan
Controller-based navigation
Dialogs and controllers
Beyond this book
Summary
A. API Levels for Android Versions
Index

Mastering Android Game Development

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: June 2015
Production reference: 1250615
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78355-177-4
www.packtpub.com

Credits

Author
Raul Portales
Reviewers
Sergio Viudes Carbonell
Antonio Hernández Niñirola
Commissioning Editor
Nadeem N. Bagban
Acquisition Editor
Harsha Bharwani
Content Development Editor
Arun Nadar
Technical Editor
Ruchi Desai
Copy Editors
Stephen Copestake
Akshata Lobo
Project Coordinator
Nikhil Nair
Proofreader
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Abhinash Sahu
Production Coordinator
Conidon Miranda
Cover Work
Conidon Miranda

About the Author

Raul Portales is a software engineer who works as a contract consultant with Platty Soft. He cofounded the game studio The Pill Tree, which ran for a year and produced several titles that were featured by Google Play, including Chalk Ball and SpaceCat.
He has been a Google Developer Expert for Android since the start of 2015, and he loves public speaking. He has presented at several DroidCons and Game Developers conferences, talking about how to survive as an indie game developer.
At the moment, Raul lives in Dublin and you can easily find him collaborating with the local commu...

Inhaltsverzeichnis