Book Image

Mastering LibGDX Game Development

By : Patrick Hoey
Book Image

Mastering LibGDX Game Development

By: Patrick Hoey

Overview of this book

Table of Contents (18 chapters)
Mastering LibGDX Game Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding the fundamentals of role-playing games


A treatise on the history of role-playing games is beyond the scope of this book, but a short jaunt through the origins of role-playing games (RPGs) that led to the development of computer-based RPGs (CRPGs) over the years is necessary to fully explain the type of game that this book covers. This history is covered in much more detail in Neal Hallford's Swords & Circuitry: A Designer's Guide to Computer Role Playing Games.

History

In the early twentieth century, two unrelated parallel developments eventually converged into what we call RPGs today.

The first development was a set of simple rules written in 1913 by H.G. Wells in the form of a war game called Little Wars. This type of game overhauled complicated game systems at the time making this particular war game approachable by the masses. Little Wars included units such as infantry, cavalry, and even artillery that launched wooden projectiles. The rules included simplified mechanics for moving and firing within a set time.

The second development during this time was in the form of a series of novels, starting first with The Hobbit (1936) and continuing with The Lord of the Rings trilogy (1954) written by J. R. R. Tolkien. The influence of these classic books cannot be overstated as they established the "high fantasy" subgenre in literature, helping to propel fantasy as a distinct and commercial genre. These novels created a world with its own history, cultures, and traditions, at the center of which an epic battle between good and evil waged. Adventures across this world, Middle Earth, included elements of sacrifice and heroism, love and loss, beauty and terror.

Decades later, in the 1960s, Wells' Little Wars influence was still felt with ever-increasing complex wargaming experiences, including large-scale board games with hundreds of units. At this time, traditional wargaming revolved around real-world historical scenarios, but people started substituting the more traditional campaigns with recreations of the epic fictional battles from Tolkien's The Lord of the Rings novels. These players were without a system that defined rules for integrating magic or explaining the battle mechanics of flying dragons.

Chainmail was published in 1971 by Gary Gygax and Jeff Perren out of this need for a proper rule system for a fantasy-based wargaming experience. Chainmail had the first set of wargaming rules for magic spells and fantasy creatures. Years later, Gary Gygax and Dave Arneson collaborated and produced the first role-playing system, Dungeons & Dragons (D&D), published in 1974. From the late 1970s to early 1980s, the influence of Tolkien fiction and D&D seeped into the computer video game arena, and started the evolution of modern day CRPGs that began with the creation of text and graphic-based RPGs.

The first text-based adventure game was Colossal Cave Adventure (or Adventure for short) created by Will Crowther and Don Woods in 1976 with the first commercial release (renamed to The Original Adventure) in 1981. In Adventure, the player navigated an interactive story that included Tolkien-inspired monsters, mazes to explore, and puzzles to solve for treasure. The spirit of fantasy adventure in Adventure continued with Infocom's release of the Zork series as well as the catalyst for Roberta and Ken Williams in forming what would become Sierra Entertainment, and developing graphic adventure titles such as King's Quest, Space Quest, and Leisure Suit Larry.

The first graphic-based role-playing game, Akalabeth: World of Doom (Akalabeth) was created by Richard Garriott (known as Lord British) and published in 1980 with commercial success. The player assumed the role of the hero, traversing through dungeon labyrinths, collecting gold pieces, slaying monsters, and completing quests. The novel concepts at the time that set the standard for future CRPGs included first-person gameplay in dungeons, required food to survive, had a top-down overhead world view, and boasted procedurally generated dungeons.

Capitalizing on the success of Akalabeth, Garriott, after a year of development, published Ultima I: The First Age of Darkness (Ultima) in 1981. With the commercial success of Ultima, this game (and the series as a whole) became the defacto standard that defined graphic CRPGs for decades, with core features and gameplay found even in today's CRPGs. Aside from the features of its predecessor, such as dungeon crawling, turn-based combat, overhead world view, loot collection, and hunger management, Ultima also had new features including a character creation screen with point allocation for player statistics, and choice selections for race, class, and gender. Other features included proper leveling with experience points gained through combat, randomly appearing enemies, hit point regeneration, and a magic system managed with consumable one-time use items. Ultima even sported a first-person space shooter for part of the game!

Wizardry: Proving Grounds of the Mad Overlord (Wizardry) was another influential graphical CRPG published in 1981 and was developed by Andy Greenberg and Robert Woodhead. This dungeon crawler was the first party-oriented CRPG with up to six characters allowed for a party. Each character had three different alignments, four classes to choose from, and also an option for prestige classes that, after meeting certain requirements, would allow the character classes to be upgraded with hybrid abilities. An interesting feature was that upon a total party kill, the new party sent into the same dungeon could recover the bodies and belongings of the wiped party.

While the Ultima and Wizardry franchises satisfied the hunger of the home computer market in the United States, they also played a large part in the success of home console RPG development in Japan.

In 1986, Japanese company Enix published Dragon Quest (later renamed Dragon Warrior for the American audiences) as the first console-based RPG that in turn further fueled Japanese RPG (JRPG) development. Dragon Quest heavily drew on inspiration from Ultima and Wizardry, while at the same time making the game unique for Japanese audiences. Dragon Quest set the standard for the qualities that define a JRPG including greater emphasis on storytelling, emotional involvement of the player, and a streamlined interface. Dragon Quest was the game that set the bar for NPC interaction because a significant portion of time was spent gathering information for assorted places and events from the townspeople.

Inspired by Enix's commercially successful Dragon Quest, Final Fantasy received the green light at Square, and with a team lead by Hironobu Sakaguchi, it was published in 1987. Also heavily inspired by Ultima and Wizardry, Final Fantasy, which is one of the staples of JRPGs, became one of the most commercially successful JRPGs due to its mass appeal. The major features that set Final Fantasy apart from the rest include turn-based combat with characters engaged from a two-dimensional side view (up until that time, most combat featured a first-person perspective), and an epic story that spanned three continents.

The next evolutionary jump in the features for RPGS continued with the inclusion of three-dimensional environments, but for the purposes of this book, we will bring our adventure through the halls of computer role-playing history to an end. By understanding the historical precedent for CRPGs, you get a real perspective for the evolution of CRPGS and why certain design choices were made. Instead of working in a vacuum, we can learn from these genre-defining games, and begin to make more informed choices with regard to features instead of bolting on random elements.

RPG features

In general, asking people to define what makes an RPG an RPG, will spark an endless debate without ever arriving at a satisfactory answer. For the sake of clarity, a role-playing game, at its core, can be defined as a system with rules where you primarily play a character in some setting with various goals depending on the story.

First, children's make believe, for instance, would be considered role playing, but without rules, it cannot be considered a role-playing game. Once rules are added though, we now have a system in place where people can role play, and this is considered a role-playing game, specifically live action role-playing (LARP).

The second example of a role-playing game is where players assume the roles of heroes playing out famous battles on a physical miniature battle field. This is considered tabletop role-playing, which is the natural extension of wargaming that began with Wells's Little Wars.

The third example of role-playing games would be the pen and paper systems that D&D started and set the ground work for Tolkien-inspired fantasy systems with magic and dragons.

Finally, the fourth example of role-playing games would be CRPGs that began their popularity with text-based versions such as Adventure, and their graphical counterparts, the Ultima and Wizardry series, with elements inspired from their pen and paper parents.

With these definitions properly framed, let's lay some ground work for the type of features that will define the core of a graphic CRPG. For the purposes of this book, I will outline the types of qualities and features that most people can agree make up an RPG, based on the precedent set from the most influential titles in the graphic CRPG realm. Most likely, there will be some features from your favorite games that will not be outlined in this book. This book is meant to give you a starting place to begin to build out your RPG title with a functional model demonstrating most standard features that have come to be expected in most RPGs.

In this book, we will be covering the following features:

  • Develop characters with statistical attributes. Since Ultima, players have come to expect some measurable ways to gauge their in-game character's progress. As the player overcomes challenges, there should be some mechanism in place for the player to augment their character, demonstrating mastery as they hone their skills. For simplicity, we will only have to select a few attributes, such as the strength attribute for determining weapon usage as well as attack damage bonuses, and intelligence for determining magic usage as well as spell damage bonuses. This attribute system will allow you to easily expand upon later. Other attributes will include hit-points (determines how much physical damage your character can take before dying), magic points (determines how much magic damage your character can inflict before running out), and experience points (at every level, there is a set amount of points your character needs to earn through combat and quests in order to progress to the next level).

  • Develop a leveling system where your character grows in power throughout the game, making earlier encounters much easier as the character levels up. This is an important distinction from more modern RPGs such as Oblivion (a leveling system where enemies level up and scale relative to your current level). For the purposes of this book, the leveling will be similar to a game such as Dragon Warrior where the character at level 10 will have no problem with a level 1 green slime.

  • Develop player movement, animation, physics, and collision detection. These are critical to the player's interaction with the game world via their game character. We will delve into the various libraries within LibGDX in order to create the best player experience.

  • Create interactive NPC characters with speech windows and immersion via dialog trees. This particular element will draw inspiration from Dragon Warrior for its interactions with townspeople, which plays a vital role in gathering information about different locations and quests.

  • Create interesting enemies with battle mechanics, spawn points, and AI pathfinding. An RPG experience would not be complete without rescuing a princess from the dark overlord, killing rats, or level grinding on wild pigs.

  • Interact with the world through travelling portals and transition between different areas in the map. As the player moves throughout our game world, they should seamlessly be able to travel from shop in the town, to the overworld map, and to a dark and dangerous cave.

  • Build inventory management systems for item pickup and equip. Resource management is an important component in any RPG, from collecting animal skins for the local shopkeeper, storing magic potions to replenish magic points, to collecting treasure after vanquishing an evil troll.

  • Develop save and load game profiles. Persistent profiles play an important role in allowing the player to experience the game at their convenience over the course of hundreds of potential quests.

  • Create scripted cutscenes to add an element of story and drama. This feature takes its inspiration from the Final Fantasy playbook in order to give the player an epic story that introduces them to the world of your imagination.

  • Develop a quest system to expand out the content of the game. This system will create goals for the player to accomplish for experience and gold, as they go out and explore the world.

  • Build inventory and heads up display (HUD) layouts with customizable skins and also build logic for updates to health and magic. Constructing this streamlined interface will give the player all the tools they need during gameplay in order to make the best decisions in and out of combat.

  • Create a shop store user interface (UI) with items and money transactions. The shop will demonstrate how to view, select, purchase, and sell items as part of the resource management part of the game using the in-game currency of gold coins.

  • Create special effects to give the game extra "juiciness" and polish, and help build atmosphere. These added effects will cover more advanced topics, but will add a nice polish to your final game.

Based upon the style of the RPG that this book is focused on, the following features will not be covered:

  • There will be no character creation screens beyond a character name and starting statistical attributes.

  • There will be no class selection screens.

  • The monster-leveling system in the game will be static in the sense that the monsters will not dynamically level and scale based upon the player's current level, but remain at their predetermined level from the outset.

  • There will be no party-based system for dealing with multiple characters or fighting multiple enemies.

  • There will be no multilinear game story with multiple endings. The game story will progress (with cutscenes) linearly as the player completes quests.

  • There will be no skill trees as we are not dealing with skills at all.

  • The combat will be turn-based, so there will be no real-time combat elements.

  • The worlds will be built with tile editors and set quests from the beginning, so there will be no procedural-based content generation for this RPG.

  • There will be no persistent online world with other players. This RPG will be a single player experience without networking support.