Руководство по созданию персонажей

Материал из CryWiki Russia

Перейти к: навигация, поиск
Эта страница страница помечена как находящиеся в процессе перевода с: 18 мая 2011.
Статью пометил сам автор статьи.


Содержание

Character Creation Tutorial

AssetCreation CharacterCreationTutorial image001.gif

Overview

This will be a quick overview of getting a character into the engine; I will use the freely available SDK rig as an example. To follow this example you will need 3D Studio max and CryEngine 2, including the CryEngine exporter for StudioMax. (supplied on the Crysis /Tools folder)

Ориентирование

AssetCreation CharacterCreationTutorial image002.gif

Для того чтобы выполнить этот урок, у вас должны быть файлы показанные выше. Они свободно доступны в Интернете, а также находятся в папке Objects\characters\human_male Для того чтобы выполнить этот урок, у вас должны быть файлы показанные выше. Они свободно доступны в Интернете, а также находятся в папке.

Ассеты персонажей для CryENGINE® 2 хранятся в трёх .max-файлах; в файле с названием персонажа, в файле с названием персонажа и суффиксом _LOD1, и голова с произвольным названием. Вы можете видеть файлы character.max и character_LOD1.max на снимке выше.

Главным образом используется формат CHR, это файл персонажа CryENGINE® 2, также есть формат CGA, который мы опишем чуть позже..

Особое примечание: Во всём этом уроке я буду рассказывать не только об использовании примеров из SDK, но и обширный список заметок, для тех из вас, кто хочет создать свой собственный персонаж с нуля.

Установка экспортёра для 3ds Max

Файлы плагина

3dsMax 8 32 Bit CryExport8.dlu
3dsMax 9 32 Bit CryExport9.dlu
3dsMax 9 64 Bit CryExport9_64.dlu
3dsMax 2008 32 Bit CryExport10.dlu
3dsMax 2008 64 Bit CryExport10_64.dlu

Плагин

Существуют экспортёры на разные «вкусы», в зависимости от используемой Вами версии 3ds Max. Выше показаны версии, скомпилированные по состоянию на ноябрь 2007. Плагин CryExport должен быть помещен в папку plugins находящеюся в корневом каталоге 3ds Max.

INI-файл

Кроме плагина, необходимо разместить текстовый файл с названием CryExport.ini в ту же папку (/plugins), текстовый файл должен иметь путь к CBA-файлу и к редактору.

[Sandbox]
path=J:\Game02\bin32\Editor.exe
animlistpath=J:\Game02\Game\Animations\Animations.cba
buildPath=J:\depot\SDK\CryENGINE2\Main\

AssetCreation CharacterCreationTutorial image004.jpg

AssetCreation CharacterCreationTutorial image005.jpg

Добавление утилиты CryExport

В панели Utility, нажмите кнопку «Configure Button Sets», и из категории Crytek, выберите экспортёр «CryEngine 2 Exporter» и перетащите на кнопку справа.

Особое примечание:
Папка Resource Compiler (Компилятора ресурсов) определяется в зависимости от пути к редактору, в виду этого компилятор ресурсов должен находится в подпапке /rc. Если у вас нет компилятора ресурсов, убедитесь, что SDK установлен правильно.

Макет файла: character.max (LOD0/2/3)

Я хотел бы кратко объяснить узлы которые вы видите в этом .max-файле. Это: render meshes (сетка рендера), thin/fat variation meshes (сетка вариации тонкости/толщины), live deforming skeleton (живой скелет деформации), и live phys skeleton (живой скелет физики).

Сетка рендера:

  • Отображает геометрию персонажа, которую вы видите в игре.
  • Цветные вершины на сетке LOD0 ($character) обозначают области-маски, которые могут быть морфированы между тонкостью и толщиной в движке.
  • Уровень детализации или LOD — являются сетками с низко-полигональным разрешение, которые автоматически исчезают в зависимости от расстоянии до персонажа (в игровом мире).
  • Материал на этой сетке должен соответствовать MTL-файлу в папке персонажа

например: sdk_character.mtl.

  • Узлы сетки рендера:
  • $character
  • $character_LOD2
  • $character_LOD3

Сетка вариации тонкости/толщины:

  • Это две вариации сетки LOD0 ($character).
  • Поскольку эта сетка является морфом, она должна сохранять индекс точек LOD0.
  • Узлы сетки вариации тонкости/толщины:
  • $character_thin
  • $character_fat

Скелет живой деформации:

  • Это скелет, который деформирует сетку рендера.
  • Кости геометрии этого скелета используется для обнаружения ударов и физики у живого персонажа (не

рэгдолл).

  • Материалы, применённые к этому скелету используются для обнаружения ударов.
  • В его иерархии присутствуют «attachment nodes» (узлы прикрепления).
  • Например: $weapon_bone, сюда будет прикреплено оружие в движке.
  • Это основной «Biped Skeleton» (скелет двуногого). Также есть некоторые дополнительные узлы, используемые для автоматического прикрепления ног и обнаружения движений.
  • «$Bip01 L Heel» и «$Bip01 L Toe0Nub» для левой ноги. (R — для правой ноги).
  • Узлы скелета живой деформации:
  • Иерархия узлов с основой «$Bip01».

Скелет живой физики:

Представьте что скелет — это набор переключателей, узел, присутствующий в этом скелете означает, что его дубликат в скелете живой деформации физикализирован в движке, а сам персонаж жив .

  • Каждый узел в этом скелете также хранит физические свойства для соответствующей ему кости в иерархии деформации, и так же хранит IK-свойства физики.
  • Узлы скелета живой физики:
  • Иерархия узлов с основой «$Bip01 Pelvis Phys».

Макет файла: character_LOD1.max (LOD1)

Я хотел бы кратко объяснить узлы которые вы видите в этом .max-файле. Это: render meshes (сетка рендера), thin/fat variation meshes (сетка вариации тонкости/толщины), a ragdoll deforming skeleton (скелет рэгдолл-деформации), и ragdoll phys skeleton (скелет рэгдолл-физики).

Сетка рендера:

  • Отображает геометрию персонажа, которую вы видите в игре.
  • Узлы сетки рендера:
  • $character_LOD1

Сетка вариации тонкости/толщины:

  • Это две вариации сетки LOD1 ($character_LOD1).
  • Поскольку эта сетка является морфом, она должна сохранять индекс точек LOD1.
  • Узлы сетки вариации тонкости/толщины:
  • $character_thin_LOD1
  • $character_fat_LOD1

Скелет рэгдолл-деформация:

  • Иерархия этого скелета должна в точности соответствовать скелету иерархии LOD0 (скелет деформации в character.max).
  • Кости геометрии этого скелета используется для рэгдолл-физики.
  • Геометрия должна состоять из сфер, прямоугольников и капсул.
  • Поддерживается произвольная геометрия, но она может снизить производительность.
  • Материалы, применённые к этому скелету используются для обнаружения ударов.
  • Узлы скелета рэгдолл-деформации:
  • Иерархия узлов с основой «$Bip01».

Скелет рэгдолл-физики:

Подобно LOD0, представьте что скелете — это набор переключателей, узел, присутствующий в этом скелете означает, что его дубликат в скелете рэгдолл-деформации физикализирован в движке, в то время как персонаж находится в состоянии куклы.

  • Каждый узел в этом скелете также хранит физические свойства для соответствующей ему кости в иерархии деформации, и так же хранит IK-свойства физики.
  • Узлы скелета рэгдолл-физики:
  • Иерархия узлов с основой «$Bip01 Pelvis Phys».

Макет файла: head.max

Я хотел бы кратко объяснить узлы которые вы видите в этом .max-файле. Это: render meshes (сетка рендера), morph targets (цели морфинга), thin/fat variation meshes (сетка вариации тонкости/толщины), и deforming skeleton (скелет деформации).

Сетка рендрера:

  • Отображает геометрию персонажа, которую вы видите в игре.
  • Узлы сетки рендера:
  • $head

Цели морфинга:

  • «Цели морфинга» или «сочетания фигур», создают лицевую деформацию сетки рендера.
  • Узлы целей морфинга:
  • $Brow_lowerer
  • $Jaw_dropper_01
  • $Jaw_pusher

Сетка вариации тонкости/толщины:

  • Это две вариации сетки LOD0 ($head).
  • Поскольку эта сетка является морфом, она должна сохранять индекс точек LOD0.
  • Узлы сетки вариации тонкости/толщины:
  • $head_thin
  • $head_fat

Скелет деформации:

  • Иерархия этого скелета не должна иметь больше элементов, чем у скелета деформации персонажа к которому Вы присоедините голову (character.max).
  • Скелеты не должны совпадать! Скелет SLAVE, должен иметь меньше костей, чем скелет MASTER, подробнее об этом чуть позже.
  • Поддерживается произвольная геометрия, но она может снизить производительность.
  • Узлы скелета деформации:
  • Иерархия узлов с основой «$Bip01».

Сетка рендера

Закончим с разъяснениями, начнём окапываться. И кстати пришло время для фотографий.

AssetCreation CharacterCreationTutorial image006.jpg

Откройте файл character.max , Откройте файл сетки рендера, вы просматриваете все три сетки (LOD0/2/3).

Имейте в виду при создании сеток персонажа:

  • Их точка опоры (pivot) должна быть равна нулю во всех трёх плоскостях.
  • Персонаж должен быть обращены вниз по положительной оси Y.
  • К нему не должны быть применены преобразования (позиция, поворот, масштабирование).
  • Если преобразования есть, примените Reset X-Form, перед тем, как начнёте.
  • Убедитесь, что модель соответствует сочленяем скелета.
  • Скелет живой деформации должен «привязать форму», если вы примените модификатор Skin.

Особое примечание:
При создании своего собственного персонажа, вам не нужно подгонять свою сетку рендера под наш скелет из SDK. Но имейте в виду, при этом ваш персонаж не сможет использовать существующие наборы анимации Crysis. Если вы хотите использовать пользовательский персонаж/скелет, примите к сведению трудность создания всех анимаций, необходимых для получения движущегося пользовательского скелета с достойной верность движений нового поколения игр, это может быть сотни и тысячи ассетов анимации.

Если модель вашего персонажа подходит под этот скелет, используйте Skin (или Physique если вы мазохист), чтобы добавить вес к сетки рендера в сетке деформации .

Скелеты «деформации» и «физики»

Ассеты персонажей разделены на основной файл (character.max) и файл LOD1 (character_LOD1.max), у каждого файла есть скелет деформации и физики. Очень важно понимать роль каждого скелета в каждом файле.

Живой скелет деформации и живой скелет физики в основном файле (LOD0/2/3) хранят обнаружение ударов и физические свойства живого скелета, а те, что в LOD1 хранят обнаружение ударов и физические свойства рэгдолла.

Не бейте себя по голове, это важно:

Основной файл персонажа (character.max).

Сетка рендера персонажа взвешена на скелет живой деформация, физические свойства которого хранятся в скелете живой физики.

Файл LOD1 персонажа (character_LOD1.max).

Сетка рендера персонажа взвешена на скелет рэгдолл-деформации, физические свойства которого хранятся в скелете рэгдолл-физики.

AssetCreation CharacterCreationTutorial image007.jpg

Откройте Layer Manager (Управление слоями), там вы увидите скрытый слой «bip», если вы скроете «default» и отобразите «bip», вы увидите это:

AssetCreation CharacterCreationTutorial image008.jpg

Это скелеты живой деформации и физики файла LOD0/2/3 (character.max).

Скелеты «деформации»

В случае если вы пропустили раздел «Макет файла», вот за что ответственен скелет деформации:

  • This is the skeleton that deforms the render meshes
  • The bone geometry of this skeleton is used for hit detection and physics in the live character (non-ragdoll)
  • The materials applied to this skeleton are used for hit detection, to tell the engine what part of the character you have hit.
  • There are ‘attachment nodes’ in this hierarchy
  • Example: $weapon_bone, this is where the weapon will be attached in the engine.
  • This a basic ‘Biped Skeleton’ but other than ‘attachment nodes’ there are some additional nodes used for automatic foot plant and gait detection
  • $’Bip01 L Heel’ and $‘Bip01 L Toe0Nub’ on the left foot. (also present on the right foot)
  • Deforming Skeleton Nodes:
  • Hierarchy of nodes under and including $Bip01
  • The Ragdoll Deforming Skeleton , located in the LOD1 asset file, is used for collision and hit detection in the ragdoll.

Special Note: The recommended number of physicalized bones in a humanoid biped ragdoll is 10-14

AssetCreation CharacterCreationTutorial image009.jpg

The deforming skeleton 3dsMax material setup for a Crysis humanoid character.

Material Setup As you can see, the deforming skeleton has different submaterials assigned to it, these are used for hit detection in the engine. On Crysis, the first 10 submaterials were devoted to hit locations, and any after that were used for textures. This can vary by project.

AssetCreation CharacterCreationTutorial image010.gif

The submaterials in the engine correspond to surface types defined by code

If you open the sdk_character.mtl in the CryEngine2 Material Editor, you will see that the submaterials used for hit detection are assigned to corresponding surface types ; they are also assigned the ‘ nodraw ’ shader.

Special Note: Here are some things to keep in mind when altering or replacing the deforming skeleton with something of your own:

  • Keep your bones and rig elements in the ‘bip’ layer
  • Allows animators to easily hide the rig
  • Allows cryTools to manage rig visibility automatically
  • If you are using a new or custom skeleton, you should be prepared to recreate the full locomotion animation set to support it’s moving in the game.

The skeleton must face down the +Y axis*

  • Nodes in the hierarchy should have no scale applied to them

All bones/nodes should have 100 % XYZ scale*

  • There is a bug in Max where mirroring bones causes them to have a −100 % scale: be on the lookout for this. Use the mirror function in ‘Bone Tools’ before converting them to ePoly.

The root bone pivot should be placed at 0,0,Z* in world coordinate space.

  • The pivot of the root bone must have its positive X looking forward, positive Y looking left (of the facing direction of the character) and positive Z looking up vertically.
  • No bones can be outside of the skeletal hierarchy, the exporter starts at one root bone and steps through all its children.
  • This also means no external bones can be constrained into the skeleton

If you want bones to act like they are outside of the skeleton, you can change their transform inheritance in Command Panel->Hierarchy->Link Info->Inherit*

  • Once they are not inheriting transforms from their parents, you can drive them with constraints as if they were outside the hierarchy
  • The bones of the spine and head need to match the orientations and names of the biped skeleton for lookIK to work

The names are 'Bip01 Head' 'Bip01 Neck' 'Bip01 Spine3' 'Bip01 Spine2'*

  • If you want to have rig elements inside the hierarchy, keep them to the periphery and use the prefix '_' to comment them out of export
  • The '_' prefix effectively comments an object, and all of it’s children out on export
  • If you must have them in the hierarchy, and they are exported into the engine, try not to have them be splines or shapes, convert them to polygons
  • Keep in mind that any rig elements inside the hierarchy that are exported will be null bones in the engine, and take up memory/cpu time, so do this sparingly
  • It’s a good idea to put your hit material submats first for humanoid skeletons that you will re-use, this way the numbers will not change based on how many different texture submats you use.
  • Make sure that all the models are NOT linked to anything. Having, for instance, the pants of your character linked to it’s hands will cause an error in the exporter causing it to create multiple skeletons.

Ragdoll Deforming Skeleton (LOD1)

AssetCreation CharacterCreationTutorial image011.gif

Above you see the ragdoll deforming skeleton and ragdoll phys skeleton from the LOD1 file.

The deforming skeleton in the LOD1 asset file is used for collision/hit detection in the ragdoll, this is called the ragdoll deforming mesh . It can be made from arbitrary geometry, like the live deforming skeleton , but should be made from capsules, boxes, and spheres.

Special Note: Biped can be finicky, the best way to create your own custom ragdoll deforming skeleton is to align capsules and boxes to your existing skel, then via editPoly, attach them to your node and delete the old geometry.

The ‘Phys’ Skeletons

There are two phys skeletons that a character has, one in the main character file, and one in the LOD1. In case you skipped the file layout section, here is what the phys skeleton is responsible for:

  • Think of this skeleton as a set of switches, a node being present in this skeleton signifies that it’s counterpart in the deforming skeleton is physicalized in the engine.
  • Each node in this skeleton also stores physical properties for it’s corresponding bone in the deforming hierarchy, this is stored in the phys bone’s IK properties.
  • Phys Skeleton Nodes:
  • Hierarchy of nodes under and including $’Bip01 Pelvis Phys’

The ragdoll phys skeleton is stored in the LOD1 file (character_LOD1.max). It stores the ragdoll physical properties of the character in the same way that the live phys skeleton stores them for the live deforming skeleton .

AssetCreation CharacterCreationTutorial image012.jpg

Here we are looking at the phys skeleton in the main character file (character.max), this is also known as the live phys skeleton , because it is used for the live character physics.

Each part of the phys skeleton references a node in the deforming skeleton , it has the same name as that node, but the suffix ‘ phys ’. In the example above you see ‘ Bip01 Spine1 Phys ’, which is the phys node referring to ‘ Bip01 Spine1 ’ in the deforming skeleton .

Limits The phys skeleton nodes match the orientations of their counterparts in the deforming mesh exactly, and their IK limits are the offset rotations that that physics will be able to deviate from any playing animation. Be sure to check ‘ Active ’ and ‘ Limit ’, then enter in your values. If your limits exceed +/- 90 degrees read on about ‘ ParentFrames ’.

AssetCreation CharacterCreationTutorial image013.gif

ParentFrames When the needed rotational limits of a node in the phys skeleton exceed +/- 90 degrees, you will often need to use a ‘ ParentFrame ’. A ParentFrame is a node that sits above the phys node and zero’s out it’s rotations. It is basically an identical copy of the node, which sits above it in the hierarchy, and has the suffix ‘ parentFrame ’. Here is an example of a phys hierarchy with parentframes on all limbs:

AssetCreation CharacterCreationTutorial image014.jpg

Dampening and Spring Tension Stiffness of an angular spring at a joint can be adjusted via «Spring Tension» parameter. A value of 1 means acceleration of 1 radian/second2 (1 radian = 57�). Damping should also be set to some reasonable value (1.0 corresponds to fully dumped oscillations for an isolated joint, 1.0 is the recommended value).

As shown above, each piece of the phys skeleton has properties under the Hierarchy tab(IK).

Special Notes:

  • If you have a node present in the phys skeleton, it must have physical properties
  • If all it’s limits are defaulted to ‘0’ it will not be export into the game engine
  • This is important with the root, which should have no real limits, but needs garbage numbers in the limit fields to export properly (check SDK char)
  • The recommended number of physicalized bones in a humanoid biped ragdoll is 10-14
  • The deforming skeletons will have their shapes and mass taken into account, so the mesh must be physically valid in order to behave convincingly
  • Heavy-light-heavy patterns in bone structure should be avoided in the 'Phys Skeleton’.
  • A typical example from biped is spine-neck-clavicle-upper arm connection with heavy spine, light neck and clavicle, and relatively heavy upper arm.
  • For ragdoll phys skeletons it’s recommended to exclude neck (not necessarily neck1,2, though) and the clavicles from the Phys Skeleton.
  • Try to have your ragdoll deforming skeleton consist of primitives wherever possible.
  • Try to avoid sharp corners near joints
  • Avoid using joints with all 3 axis locked whenever possible, because they slow down the simulation w/o doing anything useful
  • Remember: Keep the phys mesh pivot points alligned in orientation to the bones they are suppose to be physicalising. When the phys IK values are set, they are translated onto the bones of the character in the game. But those IK values work with the pivot alignment. If the bone pivot orientation is different from that on the phys mesh, when in the game, the bone will be rotated to align to the phys mesh, thus creating the undesirebale effect.
  • When creating your own phys skeleton, because it needs to have the same orientations as the deforming skeleton, just snapshot your existing skeleton. Then, remove parts you do not want, reparent the children, and rename them. When you have removed one of these, it will remain locked in default orientation, and will not be physicalized. Check the spine setup on the SDK character for an example.
  • You can also place certain words in an object’s ‘user defined properties’ to force it into a primitive in the engine, this will generate a bounding primitive around the mesh. Here are some you can try
  • nonphysical
  • sphere
  • box
  • capsule
  • cylinder
  • If your limits and deforming skeleton meshes match for ragdoll and live skeletons, you can store all the rendermeshes in one file, this makes things a lot simpler
  • You no longer have two files to manage and two hierarchies to sync

Advanced Setup

These are some techniques/features that are not present in the SDK character example.

Character Ropes

Characters with ropes and hinges are not included in the SDK, but I will touch on them quickly.

AssetCreation CharacterCreationTutorial image015.jpg

Here is a piece of the ‘Trooper’ hierarchy, Rope3 is a physicalized rope

Character Ropes

  • In order to have some character bones simulated using rope physics one has to name the corresponding bones 'rope[rope number] Seg[segment number]' i.e "Rope1 Seg01”. The bones in the same rope strand need to have identical Rope numbers and continuous numbering for the segments, i.e. Seg01, Seg02, Seg03. The ‘rope number’ can go from 1-9, and then needs to be 01, 02, 03, etc. The roots of each strand (Seg01) should be linked to a point helper named "null_[rope name]_connect”, which in turn should be linked to the bone to which the ropes are required to be attached to.
  • All segments in one rope should have approximately equal length. Note that a rope bone should never be the leaf bone (w/o children), since the bone after the last rope bone is used to provide terminal rope vertex. Also note that currently ropes cannot connect 2 physicalized parts of a skeleton; they can be either «roots» (ex: hanging light cord), or leaves (ex: character’s ponytail or braid).
  • In game script one should first create some physical entity, then load and physicalize the character model. By default all bones are physicalized (unless « Phys» counterpart skeleton is present, which will most likely be the case only for characters). Note, however, that rope bones normally should not be a part of main character physics (which for hanging lamp will most likely be a rigid body), thus they should have 'nonphysical' keyword in their user-defined properties (as well as other bones that do not represent physical geometry).
  • During the physicalization ropes are created and stored internally in the character system. The 1st end of the rope is the one that is closer to the root bone. Both the 1st and the 2nd ends are automatically tied to character physical entity if they are connected to its physicalized parts (not necessarily directly).
  • In order to alter parameters of rope physics one should call:
  • SetCharacterPhysics(slot_number, «ropename», PHYSICSPARAM_ROPE,param_table).

param_table* can contain the following fields: length* — full length of the rope; entity_id_1* — entity id the 1st rope end is tied to (-1 if statically tied world, −2 if not tied at all); entity_part_id_1* — entity part id the 1st rope end is tied to end1 (vector)* — the 1st end attachment point (if unspecified, it is assumed to be current end point position); end2 (vector)* — the 2nd end attachment point; check_collisions* — 1 if the rope should collide with the environment (0 otherwise); coll_dist* — rope thickness for collision detection.

  • Currently ropes cannot apply forces or otherwise alter the behavior of the objects they are colliding with, save the objects they are directly tied to (and tied objects receive impulses only when the rope is fully strained along a straight line).
  • 'Stiff' ropes can be mimicked by having few rope segments (bones) and setting up mesh skinning so that visually the rope bends smoothly rather than abruptly at joint points.

Adjusting Rope Properties

To physicalize the ropes and make them active you also need to create phys bones for the first segment of each bone strand. These phys bones should be linked to the phys mesh of the character body. To activate collision of the ropes with the body and environment and/or activate the gravity you need to put ‘ "active_phys gravity”* ’ in the UDP (User Defined Properties). These are the settings to activate certain properties of the rope’s behavior and properties (set in the Hierarchy/IK/Rotational Joints panel): character collision* — y axis active, will collide with the local character environment collision* — x axis active, will collide with the environment joint limit* — spring tension x, this will be the per-bone rotational limit for the chain stiffness* — maximum x limit stiffness decay* — maximum y limit damping* — maximum z limit max time step (default 0.02)* — spring tension y friction* — spring tension z

Character Hinge Attachments

AssetCreation CharacterCreationTutorial image016.jpg

When adding CGF bone attachments in character editor, you can create hinge joints to give the rigid attachments realistic secondary motion. Just select the bone attachment, then check ‘ Physicalized ’, select a hinge rotational axis, and specify some values. It takes some trial and error to get right, but the results are great.

CGA Files

AssetCreation CharacterCreationTutorial image017.jpg

A CGA file is a conglomerate of CGF objects and animation data. They are used for rigid, non-deforming animations, like the baked physics above. CGA files are like character files with some major differences:

  • They store a hierarchy but no skinning data
  • There are CGF files attached to this skeleton, which are also stored in this file
  • There is a default animation also stored in the mail file
  • It is referenced as ‘Default’
  • A CGA can also play ANM files, and reference them in a CAL file.
  • CGA animated objects must use TCB controllers in 3dsMax; to reduce size, reduce keys

Special Notes: To convert many objects to TCB you can use this snippet of maxscript (or cryAnimationTools)

=forobjinselectiondo= =(= = obj.rotation.controller = tcb_rotation ()= = obj.position.controller = tcb_position ()= =)=
AssetCreation CharacterCreationTutorial image018.jpg

Exporting Your Character into CryEngine2

Add your render meshes into the ‘ Object Export ’ listbox, make sure that ‘ Export To ’ is set to ‘ Character (.chr) ’ and then click ‘ Export Nodes ’. Your CHR should be saved to disk in the location of the max file, you can click ‘ Exlore… ’ to go there immediately.

Special Notes: You can export multiple meshes at once; just add them in the Object Export list box.

CAL files

In the SDK folder (/human male), you may have noticed a CAL file, this is a Character Animation List . It points the engine to the animations a character can playback.

Special Note: Every character must have a CAL file, if you created a custom skeleton you might have to make custom anims to drive it, to do this you need to make a custom CAL file and Animation graph, which is beyond the scope of this tutorial.

CDF files

A CDF or ‘ Character Definition File ’ is used to group many CHR files together, or CHR files that have CGF attachments. For more information on assembling characters in the engine, please refer to the Character Editor documentation.

Special Note: You can also attach ‘null sockets’, which can be placeholders for particle effects, or node orientations for things like grabbing or orienting an object onto another in game.

In Engine Debugging (Animation, Hit Detection, Physics)

It can be difficult to tell if your skeletal changes are working in the engine. Well, it’s easy to see if it’s deforming by simply playing an animation on it. The difficult thing can be checking the phys setup. Here’s how:

On the Rollup Bar , select Entity , then drag a Grunt into an empty level. Under the ‘ Entity Properties ’ for the Grunt, find the ‘ Model ’ property.

image019.jpg Extracted from ReadOnly-0-Rev-2-character_creation_tutorial.doc_files.zip

AssetCreation CharacterCreationTutorial image020.gif

When you reload the entity, you should now see something like this:

AssetCreation CharacterCreationTutorial image021.jpg

‘Grunt’ Entity in engine with character.chr from the SDK loaded as ‘Model’ under Entity Properties

Special Note: Reloading Entity Scripts - When working with characters, you will need to reload them to check changes you have made, the easiest way to do this is right slick the character or the icon and select ‘ Reload Script ’, or you can click ‘ Reload Script ’ under the Entity Properties . Some systems can cache a character, and when all else fails, try closing Editor and reopening it again.

Hit Detection and Live Physics

So now that you have the character in the engine, let’s check out the skeleton, to do this, go to the console (‘ ~ ’ key) and type in ‘ p_draw_helpers 1 ’, without the ‘’ of course, and press enter. You should see something like this:

AssetCreation CharacterCreationTutorial image022.jpg Character.chr with ‘ p_draw_helpers ’ enabled, this shows the physical hit mesh.

If the skeleton is in the default pose, you might need to toggle ‘ AI/Physics ’ in the lower right.

So now you can see the deforming skeleton, and you can jump into game and shoot/test it. But how do you know if the hit materials are set up properly? If you jump into game mode and press ‘ 7 ’, you will see that you have a weapon that tells you the material of any object you point at, and it will tell you even more info about that item if you ‘shoot’ it. Here is what it looks like when pointing at the hit skel:

AssetCreation CharacterCreationTutorial image023.jpg

Using this tool you can debug all the parts of your skeleton, checking them to see that they are set up with the proper materials.

Ragdolls

Testing ragdolls in the engine can be a lot of fun, especially for non humanoids.

AssetCreation CharacterCreationTutorial image024.jpg

There are three ways to test the ragdoll physics of a character, the two best being shown above: Either gun them down, or right click them and select " Events>Kill

AssetCreation CharacterCreationTutorial image025.jpg

You can also add the character as a DeadBody entity. Be sure to uncheck ‘resting’, when you enter the game, or enable ai/physics, the ragdoll should simulate.

Special Note: I should say that ragdoll functionality has been been ‘nerfed’ in Crysis, and once a ragdoll rests it will cease to be simulated. (if your SDK is augmenting the commercial Crysis game) That said, licensees receive code drops with all CryEngine2 features intact.