In this four(ish) part tutorial, we’ll look at how to create a simple third person character in Lumberyard 1.9. In this inaugural post, we will go over the files involved, the tools we will be using, and finally set up a basic character which will play an idle animation.
The following few posts will take us through authoring Blend Spaces and setting up animation fragments in Mannequin, building a Component Entity, moving our entity using a Character Physics Component, and adding a third person camera.
The order in which these will come is not set and we may well diverge from the set path depending on any extra information I think you may need. I learned all of this the hard way and I’m hoping I can make this process a little easier for you!
First of all, we will need some assets to work with. Ideally, we would be using the FBX format and grabbing a bunch of free data online, however, since the FBX importer is a relatively new addition to Lumberyard we will be using the legacy format and a future post will go into depth about FBX. If you want a quick heads up on importing FBX, check out this great little video tutorial by Cognitive Studios.
I have chosen to use a selection of assets from the GameSDK found here. Since GameSDK is a fairly large download and we only care about a few of the assets I have done the legwork and pulled out some files for you already! Go Team! The assets I have collated are available for download here. Download these and drop the “GenericCharacter” folder into the root of your project folder. For me, that would be dev\Blogalicious.
Within this folder, you will see some files. Throughout this series, we will add to these files and slowly build up the complexity and functionality of our character.
We will be using Geppetto in this tutorial. Geppetto is one of the tools built into the Lumberyard editor. You can learn more about it here, or just dive on in!
“Geppetto is used to set up fully animated characters in Lumberyard, in preparation for use with either custom game code to select, play, and blend animations, or with the Mannequin animation controller system. In Geppetto you build a character by associating one or more skinned models with an animation skeleton (built in a DCC like 3DS Max or Maya), and specifying a list of animations (built in a DCC like 3DS Max or Maya) to use with that character.”
Create a New Character File
In this part, we will be creating our Character Definition File. This is a simple text file with the extension .cdf . This file will let the engine know what skeleton to use (.chr), what skins to use (.skin), what attachments we will hang off the skeleton (weapons, holsters, whatever), and what materials (.mtl) we will use to light and texture this character.
- Open Geppetto. [Fig. 1]
- Next, we want to actually create the Character Definition File from inside the Geppetto tool. [Fig. 2]
- Note, that the file created is just a text file so you can edit and inspect it by hand if you want to.
- Give the character a sensible name and save it in the GenericCharacter folder.
- I called mine ThirdKindCharacter.cdf and will be referring to it as such.
Setup Our Character
In this section, we will fill out some of the property fields in the Character Definition File.
We will mostly be using the “Assets” panel and the “Properties” panel to build our character so let’s ensure that they are both displayed. You can find them both underneath the View menu.
- Click on the ThirdKindCharacter.cdf file in the Assets panel.
- In the properties panel, we now need to go through and set the details on our character.
- In the skeleton field, click the folder icon.
- Go into the GenericCharacter folder provided with this blog.
- Browse to skeleton_player_generic.chr. This is the skeleton file we will be using for our character. [Fig 3.]
- Save the properties.
Next, in the properties panel, we now need to set up the skins on our character. This will involve the same steps repeated for each .skin file in the GenericCharacter\Skins folder
- On the attachments drop down, click the downward arrow and select Add. This will add an attachment which we can now set up.
- Give the attachment a sensible name, the first will be “Head” as we will attach the head_a.skin first. In the type attribute select “Skin Attachment”. There are a number of other possible attachments you can check out here.
- Now for the Geometry attribute find the head_a.skin file. When you select this you should see a disembodied head appear in the viewport!
Repeat this process for each of the skin files provided in the GenericCharacter folder. Remember to save your work regularly by using the save button in the Properties panel.
When you hit save the engine is updating the GenericCharacter.cdf file we set up at the beginning. This is just an .xml file so you can open it up in your text editor of choice and inspect it to see exactly what is going on.
We should now have a fully skinned character with a skeleton [Fig. 4]. It doesn’t have any textures on it and it doesn’t do much yet so let’s address those issues now!
Adding Some Colour
Our character is looking pretty broken at the moment, he’s sporting a very unappealing “Replace Me” texture which needs to go! This is where material (.mtl) files and texture (.tif) files come in.
- In the properties panel, expand the Head attachment and in the Material field find and add head_a.mtl
- You may need to restart the editor to pick up the changes here.
- This .mtl simply specifies the texture files we will be using for each different part of the characters head.
- In the properties panel, we now need to go through each other Skin attachment and set skeleton_male_generic.mtl for each of them.
- Setting the material for each attachment lets the engine know to override any material which may have been “baked” into the .skin file. In our case, this is necessary due to the fact we are using skins which were authored within a different project with a different folder structure.
We should now have textures on our previously very red looking character. [Fig. 5]
Let’s Get Moving!
Ok, the character is looking a little better now but he still can’t do a lot! Fortunately, this is pretty straightforward to fix. In this section, we will add the ability to play animations.
- In the Assets panel, select “Skeleton List”.
- This will change what is displayed in the Properties panel.
- All we need to do here is to add a new “Alias” which will tell the engine what skeleton file we are using and give it a descriptive name. [Fig. 6]
- In the Assets panel, we need to expand the “Skeletons” sub-section and select skeleton_player_generic.chrparams.
- This is the metadata associated with our .chr skeleton file.
- This is another simple XML file so feel free to open it up and look at the insides of it.
- We need to set some attributes on this metadata so that the engine knows which animations we want to associate with the skeleton.
- We only have one animation at the moment so just point the engine at the folder containing this one. [Fig. 7]
- In the properties panel, click on the drop down beside the “Animation Set Filter” field and “Add” a new field.
- In the top folder selection box, we just want to find and select the folder with our animations in, GenericCharacter\Animations.
- Hit save.
- When you have selected this, assuming we have done everything right, you should see some new stuff appear in the Assets panel.
- Click on the new relaxed_tac_idledawdling_nw_3p_01 entry and our character should start moving about.
- Admittedly I seem to have chosen the creepiest assets imaginable, but you get the idea! We now have a character with an idle animation. Booya!
What We Learned
In this post, we learned about the Geppetto tool and how we use it to create a Character Definition File. In addition, we set this Character Definition File up to use a skeleton, a number of skin attachments, and finally, to animate using a basic idle animation.
In the next part, we will add a load more animations, we will then use these to create a Blend Space, finally, once we have a Blend Space we are happy with, we will set up Mannequin to contain some Animation Fragments.
See you soon!