Learning Libgdx Game Development


Learning Libgdx Game Development
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Create a libGDX multi-platform game from start to finish
  • Learn about the key features of libGDX that will ease and speed up your development cycles
  • Write your game code once and run it on a multitude of platforms using libGDX
  • An easy-to-follow guide that will help you develop games in libGDX successfully

Book Details

Language : English
Paperback : 388 pages [ 235mm x 191mm ]
Release Date : September 2013
ISBN : 1782166041
ISBN 13 : 9781782166047
Author(s) : Andreas Oehlke
Topics and Technologies : All Books, Game Development, Open Source

Table of Contents

Preface
Chapter 1: Introduction to Libgdx and Project Setup
Chapter 2: Cross-platform Development – Build Once, Deploy Anywhere
Chapter 3: Configuring the Game
Chapter 4: Gathering Resources
Chapter 5: Making a Scene
Chapter 6: Adding the Actors
Chapter 7: Menus and Options
Chapter 8: Special Effects
Chapter 9: Screen Transitions
Chapter 10: Managing Music and Sound Effects
Chapter 11: Advanced Programming Techniques
Chapter 12: Animations
Index
  • Chapter 1: Introduction to Libgdx and Project Setup
    • Diving into Libgdx
    • Features of Libgdx 0.97
      • Graphics
      • Audio
      • Input handling
      • File I/O
      • Math and Physics
      • Utilities
      • Tools
    • Getting in touch with the community
    • Prerequisites for installing and configuring
      • Java Development Kit (JDK)
      • Eclipse – Integrated Development Environment (IDE)
      • Downloading Libgdx
      • Installing Android SDK
      • Running Eclipse and installing plugins
    • Creating a new application
    • Kicking your game to life
    • Key to success lies in planning
    • Game project – Canyon Bunny
      • Description of the game
    • Summary
    • Chapter 2: Cross-platform Development – Build Once, Deploy Anywhere
      • The demo application – how the projects work together
      • Backends
        • LWJGL (Lightweight Java Game Library)
        • Android
        • WebGL
      • Modules
        • The application module
          • Logging
          • Shutting down gracefully
          • Persisting data
          • Querying the Android API Level
          • Querying the platform type
          • Querying memory usage
        • Graphics module
          • Querying delta time
          • Querying display size
          • Querying the FPS (frames per second) counter
        • Audio module
          • Sound playback
          • Music streaming
        • Input module
          • Reading the keyboard/touch/mouse input
          • Reading the accelerometer
          • Starting and canceling vibrator
          • Catching Android soft keys
        • The files module
          • Getting an internal file handle
          • Getting an external file handle
        • The network module
          • HTTP GET and HTTP POST
          • Client/server sockets
          • Opening a URI in a web browser
      • Libgdx's Application Life Cycle and Interface
      • Starter Classes
        • Running the demo application on a desktop
        • Running the demo application on Android
        • Running the demo application in a WebGL-capable web browser
      • The demo application – time for code
        • Inspecting an example code of the demo application
          • The create() method
          • The render() method
          • The dispose() method
        • Having fun with the debugger and Code Hot Swapping
      • Summary
      • Chapter 3: Configuring the Game
        • Setting up the Canyon Bunny project
        • Using a class diagram for Canyon Bunny
        • Laying foundations
          • Implementing Constants
          • Implementing CanyonBunnyMain
          • Implementing WorldController
          • Implementing WorldRenderer
        • Putting it all together
          • Building the game loop
          • Adding test sprites
          • Adding game world's debug controls
          • Adding CameraHelper
          • Adding camera debug controls using CameraHelper
        • Summary
        • Chapter 4: Gathering Resources
          • Setting a custom Android application icon
          • Creating texture atlases
          • Loading and tracking assets
          • Organizing assets
          • Testing assets
          • Handling level data
          • Summary
          • Chapter 5: Making a Scene
            • Creating game objects
              • The rock object
              • The mountains object
              • The water overlay object
              • The clouds object
            • Implementing the level loader
            • Assembling the game world
            • Implementing the game GUI
              • The GUI score
              • The GUI extra lives
              • The GUI FPS counter
              • Rendering the GUI
            • Summary
            • Chapter 6: Adding the Actors
              • Implementing the actor game objects
                • Creating the gold coin object
                • Creating the feather object
                • Creating the bunny head object
                • Updating the rock object
              • Completing the level loader
              • Adding the game logic
                • Adding collision detection
                • Losing lives, game over, and fixing the camera
                • Adding the game over text and the feather icon to the GUI
              • Summary
              • Chapter 7: Menus and Options
                • Managing multiple screens
                • Exploring Scene2D (UI), TableLayout, and skins
                • Using Libgdx's scene graph for the menu UI
                • Building the scene for the menu screen
                  • Adding the background layer
                  • Adding the objects layer
                  • Adding the logos layer
                  • Adding the controls layer
                  • Adding the Options window layer
                • Building the Options window
                  • Using the game settings
                • Summary
                • Chapter 8: Special Effects
                  • Creating complex effects with particle systems
                  • Adding a dust particle effect to the player character
                  • Moving the clouds
                  • Smoothing with Linear interpolation (Lerp)
                    • Letting the rocks float on the water
                  • Adding parallax scrolling to the mountains in the background
                  • Enhancing the game screen's GUI
                    • Event – player lost a life
                    • Event – score increased
                  • Summary
                  • Chapter 9: Screen Transitions
                    • Adding the screen transition capability
                      • Implementing transition effects
                      • Knowing about interpolation algorithms
                      • Creating a fade transition effect
                      • Creating a slide transition effect
                      • Creating a slice transition effect
                    • Summary
                    • Chapter 10: Managing Music and Sound Effects
                      • Playing back music and sound effects
                        • Exploring the Sound interface
                        • Exploring the Music interface
                      • Accessing the audio device directly
                        • Exploring the AudioDevice interface
                        • Exploring the AudioRecorder interface
                      • Using sound generators
                        • About the sfxr generator
                        • About the cfxr generator
                        • About the bfxr generator
                      • Adding music and sounds to Canyon Bunny
                      • Summary
                      • Chapter 11: Advanced Programming Techniques
                        • Simulating physics with Box2D
                          • Exploring the concepts of Box2D
                            • Understanding rigid bodies
                            • Choosing body types
                            • Using shapes
                            • Using fixtures
                            • Simulating physics in the world
                          • Physics body editor
                          • Preparing Canyon Bunny for raining carrots
                            • Adding the new assets
                            • Adding the carrot game object
                            • Adding the goal game object
                            • Extending the level
                          • Letting it rain carrots
                        • Working with shaders in Libgdx
                          • Creating a monochrome filter shader program
                          • Using the monochrome filter shader program in Canyon Bunny
                        • Adding alternative input controls
                        • Summary
                        • Chapter 12: Animations
                          • Manipulating actors through actions
                            • Actions for manipulating actors
                            • Controlling the order and time of execution
                          • Animating the menu screen
                            • Animating the gold coins and bunny head actors
                            • Animating the menu buttons and options window
                          • Using sequences of images for animations
                            • Packing animations using the texture packer
                            • Choosing between animation play modes
                          • Animating the game screen
                            • Defining and preparing new animations
                            • Animating the gold coin game object
                            • Animating the bunny head game object
                          • Summary

                          Andreas Oehlke

                          Andreas Oehlke is a professional software engineer and a computer scientist who feels very much at home on any Linux/Unix machine. He holds a Bachelor's degree in Computer Science and loves to assemble and disassemble software and hardware alike. An exorbitant affinity for electronics and computers has always been his trademark. His hobbies include game and web development, programming in general (software design and new languages), programming embedded systems with microcontrollers, playing sports, and making music. He currently works full-time as a software engineer for a German financial institution. Furthermore, he has worked as a consultant and a game developer in San Francisco, CA. In his spare time, he provides his expertise to a German startup called Gamerald (http://www.gamerald.com/).

                          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

                          - 9 submitted: last submission 26 May 2014

                          Errata type: Code | Page number: 163

                          As mentioned on page number 163 (Chapter 5):

                          float x = cameraGUI.viewportWidth – 50 - Constants.LIVES_START * 50;
                          The first "minus" is NOT a minus sign, but a special hyphen character.
                          The second "minus" is missing.

                          Here is the corrected line:
                          float x = cameraGUI.viewportWidth - 50 - Constants.LIVES_START * 50;

                          Errata type: Code | Page number: 86

                          The sentence in the book:

                           

                          Next, go to the Project Explorerwindow in Eclipse and open the file strings.xml

                          under CanyonBunny-android/res/strings.xml.

                           

                          Should be:

                           

                          Next, go to the Project Explorerwindow in Eclipse and open the file strings.xml

                           

                          under CanyonBunny-android/res/values/strings.xml.

                          Errata type: Code | Page number: 313

                          The code in the book is:

                          position.x + = velocity.x * deltaTime;
                          position.y + = velocity.y * deltaTime;

                          Should be:

                          position.x += velocity.x * deltaTime;  (The extra space between + and = to be removed)
                          position.y += velocity.y * deltaTime; 

                           

                          Errata type: Code | Page number: 313

                          The code in the book is:

                          if (b2world ! = null) b2world.dispose();  

                          Should be:

                          if (b2world != null) b2world.dispose();  

                          Errata type: Code | Page number: 320

                          The code in the book is:

                          if (goalReached) {

                          Should be:

                          if (!goalReached) {  

                          Errata type: Code | Page number: 320

                          The following code in the book should be highlighted:

                          TextureAtlas atlas =
                          assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS);

                          Errata type: Technical | Page no: 105

                          In the Adding game world's debug controls section, every mention of InputListener should be replaced by InputProcessor (and accordingly, every mention of "the listener" when it refers to that interface should probably be replaced by "the processor"). 


                           

                          Errata type: Layouts | Page no: 130

                          In the code, the TextureAtlas atlas = assetManager.get(Constants.TEXTURE_ATLAS_OBJECTS); statement is highlighted and should be in bold.

                          Errata type: Technical | Page No: 119

                          The line: Next, add the following two lines of code

                          Should be: Next, edit Main.java and add the following two lines of code

                           

                          In the code snippet, the private static boolean rebuildAtlas = true; statement is highlighted and should be in bold.

                           

                          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

                          Learning Libgdx Game Development +    Node.js Blueprints =
                          50% Off
                          the second eBook
                          Price for both: $41.55

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

                          What you will learn from this book

                          • Learn about libGDX and prepare your system for multi-platform game development
                          • Speed up your overall productivity with the awesome JVM Code Hot Swapping feature
                          • Create a project setup and test the base code required for game building
                          • Use Scene2D to create and organize complex menu structures
                          • Use the texture packer to automate the creation of texture atlases
                          • Replace the default launcher icon with your own app icon
                          • Manage and play audio files and add special effects to a game to improve its look and feel
                          • Create and use texture atlases for optimized sprite rendering

                          In Detail

                          Game development is a field of interdisciplinary skills, which also makes it a very complex topic in many respects. One decision that usually needs to be made at the beginning of a game development processis to define the kind of computer system or platform the game will be developed for. This does not pose any problems in general but as soon as the game should also be able to run on multiple platforms it will become a developer’s nightmare to maintain several distinct copies of the same game. This is where the libGDX multi-platform game development framework comes to the rescue!

                          "Learning Libgdx Game Development" is a practical, hands-on guide that provides you with all the information you need to know about the libGDX framework as well as game development in general so you can start developing your own games for multiple platforms. You will gradually acquire deeper knowledge of both, libGDX and game development while you work through twelve easy-to-follow chapters.

                          "Learning Libgdx Game Development" will walk you through a complete game development cycle by creating an example game that is extended with new features over several chapters. These chapters handle specific topics such as organizing resources, managing game scenes and transitions, actors, a menu system, using an advanced physics engine and many more. The chapters are filled with screenshots and/or diagrams to facilitate comprehension.

                          "Learning Libgdx Game Development" is the book for you if you want to learn how to write your game code once and run it on a multitude of platforms using libGDX.

                          Approach

                          A clear and practical guide to building games in libGDX.

                          Who this book is for

                          This book is great for Indie and existing game developers, as well as those who want to get started with game development using libGDX. Java game knowledge of game development basics is recommended.

                          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