Chapter 39: Guidelines and Resources

In this chapter, you'll find guidelines for rigging, deformation, cutter and many useful animation tips.

This chapter contains the following topics:

Rigging Guidelines
Deformation Guidelines
Cutter Guidelines
Animation Tips
Orthographic Camera

Rigging Guidelines

The following is a list of general guidelines to keep in mind when rigging your character. As you're planning the character rig for your game, keep in mind the style of the character, and create your custom colour palette. However, there are some limitations to consider if you plan to extract the game data:

Create rigs in the Timeline view only. The Node view can have complex connections that are not always interpreted well by game engines.
Nudge layers in Z space if you need to reorder layers. However, significant Z offsets are not supported within a character rig.
Make every layer in your game engine a separate scene in Harmony. If you have two characters at different depths, put them in separate scene files.
Character rigs in groups at the root level of your Harmony scene will render to a single plane in Unity, but use separate sprite sheet and animation data sets. Keep this in mind for scenes in which you may have more than one character interacting with each other.
Don’t use any effects. Effects like colour overrides are not interpreted by game engines. Use only direct hierarchy, drawing swaps, and keyframe animation.
Don’t use 3D space. If you want to set things up in 3D space, you can do this when you get to your game engine.
Set your pivot points on Peg layers using the Rotate tool to set the pivot on the entire layer. Peg pivots are recommended over drawing pivots. You should also set the pivot points on your drawing layers, even if you don’t animate on them, as this will allow you to retrieve the information later on in the game engine if you need to put a locator on a drawing layer.
Don’t use Morphing. This is not yet supported in game engines.
Both Morphing and Deform can be used and then baked out to individual drawings. These drawings will then show up as new drawings in your sprite sheet. Be wary of doing this too often as it will increase your texture space!
For your pegs, when you animate, use Bezier curves and set them to Separate. If you use 3D Path, it’s heavier than Separate.

Keeping these tips in mind will allow you to create a tight, efficient 2D game character in Harmony while taking advantage of all the great tools.

Here are some things you should do:

Create a simple parent-child relationship hierarchy in the Timeline view.
Use peg layers to contain keyframe animation data, set to Separate Position.
Use drawing layers to draw on, creating new drawings when needed.
Use the Rotate tool to set the pivot points on the peg layers.
Name your layers properly so if you need to fetch a specific layer’s pivot point later on in the game engine, you can easily recognize the layer you need. If you have a top-level Group A, which has a child group inside it (Group B), and the drawing layer is a child of Group B, then the drawing layer is exported as A_B_DrawingLayer.

You can use any of the drawing tools you want: Pencil and Brush tools, textured lines, solid areas, and gradients. Each individual drawing will be rendered out and assembled into a sprite sheet later.

Deformation Guidelines

Harmony can export deformations to the game engine XML format. Only hierarchies made of Game Bones can be successfully exported. Although deformation comes equipped with a wide range of features, many were restrained to ensure that performance is on par with gaming industry standards. The following features are not compatible with the game engine SDK:

Zones of influence
Curve and Envelope deformations
Only a single pose is allowed per deformation hierarchy

The deformation in the game engine SDK does not behave exactly as the deformation in Harmony.

To comply with most game engines and maintain fast calculations, the SDK implements a linear base skinning algorithm to linearly blend the bones at articulations. You may notice some differences depending on the curvature of the articulations used.

NOTE: * Not currently available in the Cocos2d-x implementation of the game engine SDK.

Cutter Guidelines

The cutter, or mask, operation in Harmony is used for cutting off drawings with custom shapes. The game engine SDK implements both cutters and inverted cutters with the following limitations:

For a sprite, only a single cutter drawing can be applied when it is rendered. This also applies to a composite of multiple matte drawings. The game engine SDK will only use the first matte drawing during rendering and discard the others.
A deformed drawing cannot be cut, but a cut drawing can be deformed.
NOTE: * Not currently available in the Cocos2d-x implementation of the game engine SDK.

Animation Tips

When animating for games, depending on the type of game you’re creating, you may need to limit your animation. For example, if you’re creating mobile games and you want to keep the file sizes small and playback fast on all devices, then limit yourself to simple keyframe animation with as few drawing swaps as possible. If you’re creating console games, you have the freedom to create more drawings and have a higher complexity. You can explore with your programmer the limitations of the platforms you’re exporting to, and what your game engine supports.

Here are some tips for efficient, lightweight animation:

Use mainly transformations, such as move, rotate, scale, and skew.
Create additional drawing swaps when needed.
If you use Curve and Envelope deformers or Morphing, you’ll need to bake out the drawings for export. Be careful when doing this, as you may want to keep the number of drawings small. Don’t bake out an entire sequence, just selected drawings. You don't need to bake the Game Bone deformers.
The bigger the drawings are in the Drawing view, the more pixels they will occupy in the texture size on the sprite sheet. When setting up your rig, make sure to not scale individual layers by using a keyframe with the Transform tool. If you want to scale things up or down, use the Select tool. This will keep things the same relative size on the sprite sheet. When you export the sprite sheets, in the script you can also set the resolution of the sprite sheet so the drawings can be downscaled for smaller devices.
Only drawings which are exposed in the scene will be exported to the sprite sheet. For example, if you have 10 drawings in your Library view, but only two of them are showing in your scene, only those two will export out. This keeps the sprite sheet as tight as possible.

Animating Multiple Sequences

You will always have multiple animations for your characters. For example, an idle sequence, a run sequence, an action sequence, and so on. You need to work in a specific structure so you can export all of these animations to a single sprite sheet.

First, create a scene file with the name of the character, such as Space Duck. This is the file where you can create or import your game rig. In the top menu, select File > Save As New Version, and give this new version the name of the animation. For example, Idle.

Every time you need to do a new animation using the same character, perform a Save As New Version. In the end, you may have something like this:

Scene: Space Duck

Versions:

Run
Idle
Jump
Shoot

When you run the export script, it will export the drawings from the current scene into the export folder. It will also let you know if there are any other scene versions that were already exported to that folder. If so, then it will recompile the sprite sheet to include all the drawings from all the animations. This allows the maximum possible reuse of drawings.