Why Gradle? in the Beginning, the Only Build Tool Available for Java Projects Was Make
Total Page:16
File Type:pdf, Size:1020Kb
Free Sample Mastering LibGDX Game Development Mastering LibGDX Game Development LibGDX is a Java-based framework developed with a heavy emphasis on performance, which includes cross-platform What you will learn from this book support out of the box (Windows, OS X, Linux, iOS, Android, and HTML5) as well as providing all the low-level Develop characters with stat attributes, functionality so that you can focus on developing your game player movement, animation, physics, and not battling the platform. and collision detection This book will start with explaining the entire development Create interactive NPC characters with speech windows and build immersion via dialog trees process of creating an RPG video game using LibGDX. Build inventory management system UIs with First, this book will introduce you to the features drag-and-drop items to sell, buy, and equip specifi c to RPG games, as well as an overview of game architecture. Then, you will create map locations, develop Design a quest system to expand the content character movement, add animation, integrate collision of your game detection, and develop a portal system. Next, you will learn and develop a HUD and other UI components, as well as an Form interesting enemies with battle Community Experience Distilled inventory management system. Finally, you will add the fi nal mechanics and spawn points polish with sound, music, and lighting effects. Devise scripted cutscenes to add an element of story and drama Who this book is written for Develop save and load game profi les If you are an intermediate-level game developer who wants Mastering LibGDX to create an RPG video game, but fi nds the creation process Create special effects to give the game overwhelming, either through the lack of tutorials or by extra "juiciness" and polish, and help build getting lost in a sea of game-related technologies, engines, the atmosphere or frameworks, then this book is for you. Patrick Hoey Game Development $ 49.99 US £ 31.99 UK Leverage the power of LibGDX to create a fully functional, customizable RPG game for your own commercial title Prices do not include community experience distilled local sales tax or VAT PUBLISHING where applicable Visit www.PacktPub.com for books, eBooks, code, downloads, and PacktLib. Patrick Hoey In this package, you will find: The author biography A preview chapter from the book, Chapter 1 'As the Prophecy Foretold, a Hero is Born' A synopsis of the book’s content More information on Mastering LibGDX Game Development About the Author Patrick Hoey is a software engineer with over 15 years of professional experience, contributing to the success of organizations from Fortune 500 companies to startups. While working full time, he completed his master's degree in computer science and then went on to graduate from law school, passed the bar exam, and became a licensed attorney. He has also donated his services as a director at a non-profi t company. Patrick started developing video games from the age of 12. The fi rst video game that he created was a crude hangman game for the Atari 800 home computer written in Atari BASIC. He has developed demo programs throughout the years that demonstrate certain features or exercise certain APIs of interest at the time, such as OpenGL, DirectX, SDL, Allegro, Cocos2d-x, and recently LibGDX. For entrepreneurial endeavors, Patrick ported video games to mobile phone platforms. His latest adventure with LibGDX started in 2013, creating a game that he always wanted to play called CityPunk: A Hacker's Story. Patrick's research interests include game development, graphics programming, intellectual property case law, data visualization, microcontrollers for embedded devices, and machine learning. Patrick loves photography, hiking, traveling, and creating short fi lms. Find out more about Patrick on his personal blog at http://www.patrickhoey.com. Preface "It is pitch black. You are likely to be eaten by a grue." - Zork Some of my fondest video game memories belong to text-based adventure games. Zork was my gateway game into the realm of role-playing games on the computer. RPGs offered excitement and challenges of adventuring into unknown lands ripe with unknown dangers, and helped fuel my imagination. This book is a testament to that imagination, one which refused to be extinguished by age or experience. My hope is that your RPG will keep the burning fl ames of imagination alive and provide an experience with memories that will last for a lifetime. The theory, implementation, and lessons taught within these pages should help guide you through the development process of creating your own RPG game. There are many moving parts that add to the complexity of developing a video game, especially RPGs, but the intent of this book is to provide you with a step- by-step guide to the development process. I developed BludBourne, the reference implementation game for this book, at the same time I was writing this book. If there were any issues that I came across during development, or if I found a nice design pattern that solved a problem, I made sure to document the experience in this book so that you would not have to deal with the same pitfalls. You may have heard about various engines and frameworks, and even tried them, but instead of creating a complete commercial game, you ended up in disappointment, lost in a sea of technologies. Maybe you always wanted to create an RPG, but found the creation process overwhelming. Maybe you would visit forums and post questions, but all you ever got were common replies of derision, such as "Just create your game in RPG Maker." This book simplifi es this approach by walking you through the process so that you can extend and customize BludBourne for your own commercial release. The framework that will allow us to bridge the gap from conception of an idea to an actual playable game is LibGDX. Preface LibGDX is a Java-based framework developed with a heavy emphasis on performance, and it includes cross-platform support out of the box (Windows, OS X, Linux, iOS, Android, and HTML5), and provides all the low-level functionality you need so that you can focus on developing your game instead of battling with the platform. LibGDX also has an engaged and responsive community, active maintenance, and is available for free without a prohibitive license. There are many beginner tutorials using LibGDX, but the aim of this book is to make use of LibGDX libraries for more advanced, complex features used in video games. By the end of this book, you will have a foundation in game development principles and a set of tools that will help you realize your dreams. What this book covers Chapter 1, As the Prophecy Foretold, a Hero is Born, introduces you to the fundamentals and specifi c features of RPG video games, and discusses how this book will help build foundational knowledge for a commercial RPG. This chapter will also walk you through the basics of video game architecture, with a high-level overview of the component layout and application lifecycle in LibGDX. Finally, after learning about setting up your development and build environment, you will run your fi rst demo application. Chapter 2, Welcome to the Land of BludBourne, initially discusses how to create maps for BludBourne with a tile editor and how to load them using asset management classes. You will then implement your main render loop with a camera for displaying your loaded maps. We will then discuss some features specifi c to maps, including spawn points and a portal system. Finally, you will learn about adding animation to your player sprite and implementing input handling so that your player can move around the game world. Chapter 3, It's Pretty Lonely in BludBourne…, discusses how to implement the Entity Component System design pattern for BludBourne. We will then cover scripting support using JSON to defi ne NPC properties. Finally, we will implement a physics component with collision detection and an input component for the NPCs' movement. Chapter 4, Where Do I Put My Stuff?, covers HUD layouts with skins. We will learn about integrating player stats into the UI. We will then apply this knowledge by implementing a drag and drop inventory system for your player. Finally, we will discuss how to persist player state with save and load game profi les. Preface Chapter 5, Time to Breathe Some Life into This Town, discusses the theory behind dialog trees and implements an interactive speech system for the NPC characters. Finally, we will develop shop store UIs for the player with item and money transactions. Chapter 6, So Many Quests, So Little Time…, discusses quest systems, including dependency graph theory and implementation. Finally, we will create a quest log UI, including the steps involved with creating scripts for quests. Chapter 7, Time to Show These Monsters Who's the Boss, discusses how to implement a battle system with a UI including enemy NPC battle mechanics. We will then look at how we can connect HUD updates to state changes in BludBourne. We will cover a few tricks for implementing the consumption of items from the player's inventory. Finally, we will develop a leveling system for the player. Chapter 8, Oh, No! Looks Like Drama!, discusses how to integrate sound and music into the world of BludBourne. We will also look at how to create cutscenes and integrate them into the game. Chapter 9, Time to Set the Mood, covers an assorted list of special effects that can give your RPG some nice polish. We will fi rst learn about creating transitions between screens.