Mastering LibGDX Game Development

Book description

Leverage the power of LibGDX to create a fully functional, customizable RPG game for your own commercial title

About This Book

  • Learn game architecture and design patterns with concrete examples using proper software engineering principles
  • Save time and money with this handy reference guide for future game development with LibGDX
  • Design and develop a fully functional RPG video game from scratch with a hands on, step-by-step approach using LibGDX

Who This Book Is For

If you are an intermediate-level game developer who wants to create an RPG video game but found the creation process overwhelming, either by lack of tutorials or by getting lost in a sea of game-related technologies, engines, or frameworks, then this book is for you. This book assumes familiarity with Java and some basic knowledge of LibGDX.

What You Will Learn

  • Develop characters with stat attributes, player movement, animation, physics, and collision detection
  • Create interactive NPC characters with speech windows and build immersion via dialog trees
  • Build inventory management system UIs with drag and drop items to sell, buy, and equip
  • Design a quest system to expand out the content of your game
  • Form interesting enemies with battle mechanics and spawn points
  • Devise scripted cutscenes to add an element of story and drama
  • Develop save and load game profiles
  • Create special effects to give the game extra ?juiciness? and polish, and help build the atmosphere

In Detail

LibGDX is a Java-based framework developed with a heavy emphasis on performance, and includes cross-platform support out of the box (Windows, OS X, Linux, iOS, Android, and HTML5) as well as providing all the low-level functionality so that you can focus on developing your game and not battling with the platform. LibGDX also has an engaged and responsive community, active maintenance, and is available for free without a prohibitive license.

Starting from the beginning, this book will take you through the entire development process of creating an RPG video game using LibGDX.

First, this book will introduce you to the features specific to RPG games, as well as an overview of game architecture. Then, you will create map locations, develop character movement, add animation, integrate collision detection, and develop a portal system. Next, you will learn and develop a HUD and other UI components, as well as an inventory management system. You will then develop NPC interactions including dialog trees, shopkeepers, and quest givers. After this, you will design and create battle features for fighting enemies, as well as event triggers for world events. Finally, you will add the final polish with sound, music, and lighting effects.

By the end of this book, you will have learned and applied core components from the LibGDX framework, as well as have a finished game to use as a springboard for customization and story development for your own commercial video game.

Style and approach

This book walks you through the concepts and implementation of developing a complete RPG game, unfolding chapter by chapter and building upon previous concepts. Each chapter can be used as an individual reference with diagrams to explain core concepts with concrete example code explained in detail.

Table of contents

  1. Mastering LibGDX Game Development
    1. Table of Contents
    2. Mastering LibGDX Game Development
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    8. 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
    9. 1. As the Prophecy Foretold, a Hero is Born
      1. Understanding the fundamentals of role-playing games
        1. History
        2. RPG features
      2. Technologies used when developing a role-playing game
        1. Commercial game versus technology demo
        2. Target platforms
        3. Game framework versus game engine
        4. Budget
      3. Understanding the basics of a game architecture
        1. The high-level game loop of Adventure
        2. The high-level event-based loop
        3. The high-level game loop for a graphic-based video game
      4. Understanding the high-level component layout of LibGDX
        1. LibGDX backend modules
        2. LibGDX core modules
      5. Understanding the application lifecycle of LibGDX
      6. Setting up your development environment
        1. Prerequisite tool installation
        2. Running the LibGDX setup tool
      7. Understanding the build environment and project structure
        1. Why Gradle?
        2. Benefits of Gradle
        3. Project structure
        4. Version control systems
      8. Running the default demo project
      9. See also
      10. Summary
    10. 2. Welcome to the Land of BludBourne
      1. Creating and editing tile-based maps
      2. Implementing the starter classes for BludBourne
        1. DesktopLauncher
        2. BludBourne
      3. Implementing asset management with loading textures and tile-based maps
        1. Utility
      4. Implementing the camera and displaying a map in the render loop
        1. MainGameScreen
      5. Implementing map management with spawn points and a portal system
        1. MapManager
      6. Implementing your player character with animation
        1. Entity
      7. Implementing input handling for player character movement
        1. PlayerController
      8. Summary
    11. 3. It's Pretty Lonely in BludBourne…
      1. The Entity Component System design pattern
        1. Using JSON scripts for NPC properties
        2. Entity
        3. Component interface
        4. PhysicsComponent
        5. GraphicsComponent
        6. InputComponent
        7. Entity selection
      2. Map design
      3. Summary
    12. 4. Where Do I Put My Stuff?
      1. Inventory and HUD layouts with skins
        1. PlayerHUD with Scene2D
        2. Developing UIs with LibGDX
            1. Widget styles
            2. Texture atlas
            3. 9-patch
            4. Skins
            5. Developing UI summary
        3. StatusUI
        4. Drag and drop
            1. InventorySlot
            2. InventoryItem
            3. InventorySlotSource
            4. InventorySlotTarget
        5. InventoryUI
        6. Drag and drop usage
        7. Tooltip usage
        8. Menu screens
      2. Save and load game profiles
        1. Observer pattern
        2. Observer pattern usage example
      3. Summary
    13. 5. Time to Breathe Some Life into This Town
      1. Speech windows with dialog trees
        1. Theory behind conversation trees
        2. An overview of class hierarchy
          1. Conversation
          2. ConversationChoice
          3. ConversationGraphSubject and ConversationGraphObserver
          4. ConversationGraph
        3. UI structure
        4. Script support for conversations
        5. Triggering events
      2. Shop store UI with items and money transactions
      3. Summary
    14. 6. So Many Quests, So Little Time…
      1. The theory of dependency graphs
      2. The dependency graph implementation
        1. QuestTask
        2. QuestTaskDependency
        3. QuestGraph
      3. QuestUI
      4. The steps involved in creating a quest
      5. Summary
    15. 7. Time to Show These Monsters Who's the Boss
      1. The battle system implementation
      2. BattleState
        1. BattleSubject
        2. BattleObserver
        3. InventorySubject
          1. Consuming items
        4. MonsterFactory
          1. Monster entity
        5. MonsterZone
      3. BattleUI
        1. AnimatedImage
      4. LevelTable
      5. GameOverScreen
      6. Summary
    16. 8. Oh, No! Looks Like Drama!
      1. Class diagram overview
      2. Sound and music
        1. AudioObserver
        2. AudioSubject
        3. AudioManager
      3. Creating cutscenes
        1. Action
        2. CutSceneScreen
      4. Summary
    17. 9. Time to Set the Mood
      1. Screen transitions
        1. The ScreenTransitionActor class
        2. The ScreenTransitionAction class
        3. The PlayerHUD class
        4. The MainGameScreen class
      2. Camera shake
      3. Static lighting
        1. Lightmap creation
        2. The Map class
        3. The MapManager class
        4. The MainGameScreen class
      4. Day-to-night cycle
        1. The ClockActor class
        2. The MapManager class
      5. Particle effects
        1. Particle Editor
        2. The ParticleEffectFactory class
        3. The BattleUI class
      6. Summary
    18. 10. Prophecy Fulfilled, Our Hero Awaits the Next Adventure
      1. Digital distribution platforms
      2. Obfuscating the save game profiles
        1. Logging levels
      3. Creating an executable JAR
        1. Gradle
        2. IntelliJ IDEA
      4. Native launchers
        1. Packr
      5. Obfuscating the packaged JAR
        1. The proguard.cfg file
      6. Debugging tips
        1. The command line
        2. Attach to the running process
      7. Testing builds before release
        1. A smoke test
          1. BludBourne start and main menu
          2. Cutscene
          3. New game
          4. Inventory
          5. Town NPCs
          6. Conversation
          7. Quest
          8. Item purchase
          9. Battle
          10. Game over
          11. Consuming items
          12. Wand attack
          13. Lightmaps and day-to-night cycle
          14. Save game profiles
        2. The burn-in test
      8. Summary
    19. Index

Product information

  • Title: Mastering LibGDX Game Development
  • Author(s): Patrick Hoey
  • Release date: November 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781785289361