O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a 3D Game with LibGDX

Book Description

Learn how to build an exciting 3D game with LibGDX from scratch

About This Book

  • Implement an exhaustive list of features that LibGDX unleashes to build your 3D game.
  • Write, test, and debug your application on your desktop and deploy them on multiple platforms.
  • Gain a clear understanding of the physics behind LibGDX and libraries like OpenGL and WebGL that make up LibGDX.

Who This Book Is For

If you are a game developer or enthusiasts who want to build 3D games with LibGDX, then this book is for you. A basic knowledge of LibGDX and Java programming is appreciated.

What You Will Learn

  • Learn the potential of LibGDX in game development
  • Understand the LibGDX architecture and explore platform limitation and variations
  • Explore the various approaches for game development using LibGDX
  • Learn about the common mistakes and possible solutions of development
  • Discover the 3D workflow with Blender and how it works with LibGDX
  • Implement 3D models along with textures and animations into your games
  • Familiarize yourself with Scene2D and its potential to boost your game’s design

In Detail

LibGDX is a hugely popular open source, cross-platform, Java-based game development framework built for the demands of cross-platform game development. This book will teach readers how the LibGDX framework uses its 3D rendering API with the OpenGL wrapper, in combination with Bullet Physics, 3D Particles, and Shaders to develop and deploy a game application to different platforms

You will start off with the basic Intellij environment, workflow and set up a LibGDX project with necessary APIs for 3D development. You will then go through LibGDX’s 3D rendering API main features and talk about the camera used for 3D.

Our next step is to put everything together to build a basic 3D game with Shapes, including basic gameplay mechanics and basic UI. Next you will go through modeling, rigging, and animation in Blender. We will then talk about refining mechanics, new input implementations, implementing enemy 3D models, mechanics, and gameplay balancing.

The later part of this title will help you to manage secondary resources like audio, music and add 3D particles in the game to make the game more realistic. You will finally test and deploy the app on a multitude of different platforms, ready to start developing your own titles how you want!

Style and approach

A step by step guide on building a 3D game with LibGDX and implementing an exhaustive list of features that you would wish to incorporate into your 3D game

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Building a 3D Game with LibGDX
    1. Building a 3D Game with LibGDX
    2. Credits
    3. About the Author
    4. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    5. 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
    6. 1. Setting Up Your Development Environment
      1. LibGDX 3D API overview
      2. Downloading IntelliJ IDEA Community Edition
      3. LibGDX project setup
      4. Basic use of IntelliJ IDEA with LibGDX
        1. Running the Android app
        2. Running the desktop app
      5. Summary
    7. 2. An Extra Dimension
      1. Camera techniques
        1. Drawing a cube
        2. Translation
        3. Rotation
      2. Scaling
      3. Summary
    8. 3. Working toward a Prototype
      1. Creating our world
        1. Creating our structure
        2. Game screen
        3. A simple playground
        4. Game world
        5. Adding visuals
      2. Introduction to Ashley
        1. Components
        2. Model component
        3. Systems and Ashley's engine
        4. Render system
      3. Adding physics and collisions
        1. Bullet Physics and Bullet system
        2. Creating a scene
        3. Movable characters
        4. Player component
        5. Player system
        6. Adding enemies
        7. Enemy component
        8. Status component
        9. Enemy system
        10. Enemy collision
        11. Making our player able to shoot
      4. Scene2D
        1. Default skin for Scene2D
        2. Health bar
        3. Crosshair
        4. Displaying scores
        5. Pausing the game
        6. Game over widget
      5. Screens
        1. Main menu screen
        2. Leaderboards screen and the Settings class
      6. Summary
    9. 4. Preparing Visuals
      1. Setting up Blender
        1. Downloading and installing Blender
        2. Blender's (very) basics
        3. Move gizmo
        4. Scale gizmo
        5. Rotation gizmo
      2. Sketching
        1. Game asset pipeline in Blender
      3. Modeling
        1. UV mapping
        2. Texturing
        3. First steps to animation - rigging
        4. Animation
        5. Exporting
      4. Summary
    10. 5. Starting to Look Like an Actual Game
      1. Models usable and ready to deploy with LibGDX
        1. Downloading Fbx-Conv
        2. Command-line usage
        3. Options/flags:
      2. Adding our own gun model
        1. Converting our gun model file
      3. Importing the model, finally!
        1. Adding our own static arena
        2. Creating our model
        3. Importing to our game and getting the collision bounds
      4. Enemy models!
        1. Getting models from the Internet
        2. Preparing for more than one animation
        3. Run animation
        4. Death animation and system
        5. Improving the spawn function
      5. Adding a SkyDome
        1. Getting the model
        2. Implementing
        3. Shadows and lights
        4. Adding a directional shadow with a light
      6. Summary
    11. 6. Spicing Up the Game
      1. 3D particles and LibGDX 3D particle editor
        1. Particle effect types
        2. Emitter properties
        3. Saving and importing
        4. Adding the particle effect and a material attribute
      2. Mobile performance
      3. Testing on Android
      4. Performance improvements on the enemy model
      5. Performance improvements and frustum culling
      6. UI tweening
      7. Online leaderboards and the .NET API
      8. Analog sticks on mobile and platform recognition
      9. Summary
    12. 7. Final Words
      1. Deploying to platforms
        1. Running and deploying on desktop
        2. Running and deploying on Android
      2. Troubleshooting common problems
        1. Gradle
        2. Antivirus
        3. IntelliJ
      3. What's missing from our game?
        1. More platforms
        2. Loading screen and loading feature
        3. About section
        4. Splash screen
        5. UI customization and screen transitions
        6. Game design
        7. Attack system
        8. Shaders and shadows across all platforms
        9. Shooting lasers
        10. Positional audio
        11. Publishing
        12. Ads
        13. Social networks
      4. Summary