Reader small image

You're reading from  Learning AWS Lumberyard Game Development

Product typeBook
Published inOct 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781786460868
Edition1st Edition
Languages
Right arrow
Author (1)
Dr. Edward Lavieri
Dr. Edward Lavieri
author image
Dr. Edward Lavieri

Dr. Edward Lavieri is a veteran software engineer and developer with a strong academic background. He earned a Doctorate of Computer Science from Colorado Technical University, an MS in Management Information Systems (Bowie State University), an MS in Education (Capella University), and an MS in Operations Management (University of Arkansas). He has been creating and teaching computer science courses since 2002. Edward retired from the U.S. Navy as a Command Master Chief after 25 years of active service. He is the founder and creative director of three19, a software design and development studio. Edward has authored more than a dozen technology books, including several on Java.
Read more about Dr. Edward Lavieri

Right arrow

Chapter 5.  Animating Your Characters

In the previous chapter, we looked at how characters are created in Lumberyard and how they can be imported from other digital content creation tools. We also took an in-depth look at Lumberyard's character tool, Geppetto. In this chapter, we will examine the process of animating our game characters. Our primary tool will be Mannequin, Lumberyard's animation tool. This chapter covers Mannequin's user interface and its functionality.

After reading this chapter, you will:

  • Understand animation concepts as they apply to 3D games

  • Understand the Mannequin filesystem

  • Be able to navigate the Mannequin user interface

  • Understand the Mannequin workflow

  • Understand the basics of Flow Graphs

  • Understand how animations are incorporated into Lumberyard games

Basic animation concepts


Animation is more than the art of motion. The 3D games we play are full of motion, not all of it is animation. It is important to differentiate between the two. Motion is when an object moves or is moved. If an apple falls from a tree, it moved from the tree to the ground. This is an example of motion. Animation is when something moves on its own. The apple's descent to the ground did not occur because the apple was alive and decided to fall to its death; rather, the apple was forced to move either by gravity or other means.

When a player throws a hand grenade into a moving vehicle, the vehicle is likely to explode. The motion involved is the hand grenade's flight, and the vehicle's forward motion. The explosion will cause several particles of the vehicle, and people and things in it, to catapult in various directions. This is an example of physics creating motion. We will explore game physics in Chapter 6, Creating Gameplay. What about the player throwing the hand...

Introducing Mannequin


Lumberyard's Mannequin system is a key feature of the game engine and one that sets it apart from other game engines. With Mannequin, we can define movement fragments that are part of a set, or family, of movements. Each movement is given a unique identification so that it can be referenced by code and for grouping. As an example, we might have a power drink in our game that, when consumed, our character exhibits new behaviors. These might be longer strides, faster running, shaky hands, and a widened look of the eyes. Each of these can be crafted as movement fragments and grouped together and employed as needed.

This level of specificity allows us to create realistic animations in reaction to in-game behaviors, other characters, and environmental components. Nearly every character has a walk cycle. Imagine if your character had extreme fatigue based on a lack of water consumption and exposure to desert heat. That character might walk a bit differently. Instead of creating...

Getting familiar with Mannequin's UI


The Mannequin system is accessible using the top menu. Select View | Open View Pane | Mannequin Editor. As you can see in the following screenshot, there are five areas of the Mannequin interface:

Area A –€“ pull-down menus

There are four top-level pull-down menus: File, Previewer, View, and Tools.

The menu options are not always enabled. They are contextual in nature which means they will only be enabled, or available to you, if they are of use based on the current context of your work.

File menu

The File menu provides you with the ability to:

  • Load a Preview Setup file. These files are XML files that were discussed in the previous section.

  • You can use the Context Editor to edit a Preview Setup file.

  • The Animation DB Editor is used to create and edit an animation database.

  • The Tag Definition Editor is where you can add, edit, remove, and manage your fragment tags. The green plus icon in the top-left corner of the Mannequin Tag Definitions Editor dialog window...

Using Mannequin


Before you can use Mannequin, you must create a Mannequin Entity. This process includes identifying the character model, the action controller, and the animation database. To access this functionality, you will select Entity | Anim | MannequinObject from the RollupBar.

As you can see from the following screenshot, you will next perform the following actions:

  • Name the Mannequin Object

  • Assign a material

  • Edit, as necessary, the entity's parameters

  • Assign the entity's properties:

    • Controller

    • Character model

    • Animation database

All about fragments

One of the keys to mastering Mannequin is to understand fragments and how they are used. Fragments, as previously mentioned, are snippets of motion also known as animation clips, or simply clips.

Transitions can be created between fragments so that the animations seem more natural. For example, when a person transitions from a walk to a run, they do not stop walking then start running. The transition between the two states (walking and running...

Adding animations to characters


Using the Mannequin Editor provides great control and fidelity with character animations. With Lumberyard, we have options other than just using the Mannequin Editor. We can also use Geppetto, Lumberyard's character tool.

In Chapter 4, Creating 3D Characters, we created a farmer boy character and applied skin and clothing material to it. Next, we will breathe life into it with animations.

Animation files

To animate characters, you will first use a third-party modeling and animation tool such as Autodesk Maya or Autodesk 3DS Max. Those tools can export animations to compressed Intermediate Character Animation Files. These files have a *.i_caf file extension.

You can download the intermediate character animation files from the book's website. Here is a table with the filename and associated animation description:

Putting it all together


So far we have explored animation functionality with Mannequin and Geppetto. We understand that a third-party content creation system such as Autodesk Maya or Autodesk 3DS Max is required to create the animation files for import into our game levels. Next, let's take a look at a finished project to see how this all works together.

We will look at two types of animations: one that is initiated by user input and one that runs automatically.

Animation triggered by user input

Follow these steps:

  1. Launch the Lumberyard Editor.

  2. On the Welcome to Lumberyard Editor dialog window, click the Open level button. If you previously checked the Don't show this dialog on startup checkbox in the Welcome to Lumberyard Editor dialog window, the window will not be present. You can toggle the window back on by selecting File | Global Preferences | Editor Settings and checking the Show Welcome to Lumberyard at startup checkbox. You can also select File | Open from the pull-down menu to launch...

Summary


In this chapter, we reviewed game animation concepts and discussed external content creation tools that are needed to create animations. In addition to revisiting Geppetto, you were introduced to Mannequin, Lumberyard's animation tool. The complexities of Mannequin were broached with suggestions to explore the game engine's documentation for advanced uses of the system. Mannequin's user interface was fully explored.

We also took a preview of Flow Graphs, Lumberyard's visual scripting system. We used Flow Graphs to look behind the green curtain and learn how animations are governed. Both user-initiated and automatic animations were covered. This preview of Flow Graphs will serve as a nice primer for the next chapter.

In the next chapter, we will start creating gameplay. This will include a look at game logic, AI, and game physics. We will look at pre-built examples and create gameplay of our own.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning AWS Lumberyard Game Development
Published in: Oct 2016Publisher: PacktISBN-13: 9781786460868
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Dr. Edward Lavieri

Dr. Edward Lavieri is a veteran software engineer and developer with a strong academic background. He earned a Doctorate of Computer Science from Colorado Technical University, an MS in Management Information Systems (Bowie State University), an MS in Education (Capella University), and an MS in Operations Management (University of Arkansas). He has been creating and teaching computer science courses since 2002. Edward retired from the U.S. Navy as a Command Master Chief after 25 years of active service. He is the founder and creative director of three19, a software design and development studio. Edward has authored more than a dozen technology books, including several on Java.
Read more about Dr. Edward Lavieri

Filename

Animation Description

Boy_Idle.i_caf

The boy standing in one place with minor movements of legs, hands, and face.

Boy_Run.i_caf

The...