Forums Gallery LOGIN |REGISTER

Community Archive is read-only - Here you can view content recorded up until February 2017. To join the latest discussions visit our new forums


[Tutorial] "Basic Melee Weapon" for player

Help others by sharing your tutorials here.


 

User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

[Tutorial] "Basic Melee Weapon" for player

Postby manuk » 18.08.2016, 23:18

This tutorial show you basics steps to create a simple melee weapon for first person player.

Requier:
CryEngine EaaS 3.8.x
or
CryEngine 5.x + Free CRYENGINE_GameSDK_Sample_Project

CHAPTER 1 : CREATE A CUSTOM WEAPON ( .chr + .cgf + .cdf + script )

With Cryengine EaaS: open the folder "/Assets/objects/weapons/"
or
With Cryengine 5: open the folder "/GameSDK/objects/weapons/"

Create a folder "MeleeWeaponTutorial" and an empty max file "MeleeWeaponTutorial.max"

A - Third Person Model "TP" ( cgf ) with 3dsMax

- Create a weapon mesh and make sure it face the Y axis
- Add a proxy and material
( if you need tutorial for creating a proxy and material, use the cryengine documentation )
- Name it "MeleeWeaponTuto_tp"
01.jpg
- Add a dummy and name it "collision"
- Place this dummy at the location you want to the "collision" and link it to "MeleeWeaponTuto_tp"
02.jpg
In the CryEngine Exporter:

- Add the object "MeleeWeaponTuto_tp" in the "Geometry export"
- Select "geometry (*.cgf)" in "Export format" and clic on "EXPORT NODE"
03.jpg
-> you should have a file "MeleeWeaponTuto_tp.cgf"

B - First Person Model "FP"( chr ) with 3dsMax

- Duplicate "MeleeWeaponTuto_tp" and name it "MeleeWeaponTuto_fp"
- Place it at position ( X=0,0 | Y=0,0 | Z=0,0 )
- Delete the proxy ( First person objects dont need proxy )
04.jpg
- Add a dummy and name it "weapon"
- Align this dummy to "MeleeWeaponTuto_fp"
05.jpg
- Add "CrySkin" Modifier to "MeleeWeaponTuto_fp"
- Add the dummy "weapon" in the CrySkin Bones list
- Make sure all the weapon mesh is selected ( is red ) when edit envelopes
06.jpg
In the CryEngine Exporter:

- Add the object "MeleeWeaponTuto_fp" in the "Geometry export"
- Add the dummy "weapon" in the "Animation Export"
- Select "character (*.chr)" in "Export format" and clic on "EXPORT NODE"
07.jpg
-> you should have a file "MeleeWeaponTuto_fp.chr"

C - Create the character definition file ( cdf ) with cryengine's character editor

- Open "charater tool", create "new character" ( in same folder as your chr and cgf ) and name it "MeleeWeaponTuto_fp"
- Add "MeleeWeaponTuto_fp.chr" in "Skeleton"
- Add an attachment on the joint "weapon", name it "collision" and place it at the location you want
08.jpg
- Save all

-> you should have a file "MeleeWeaponTuto_fp.cdf"

D - Create the weapon script ( xml ) with notepad++

- Create a weapon script xml in folder "Assets_or_GameSDK.../Scripts/Entities/Items/XML/weapons/MeleeWeaponTuto.xml"
Here a minimal example script for a melee weapon:
Code: Select all
<item name="MeleeWeaponTuto" class="Weapon" category="secondary" priority="1" weaponParams="1">
   <params>
      <param name="display_name" value="MeleeWeaponTuto" />
      <param name="giveable" value="1" />
      <param name="selectable" value="1" />
      <param name="mass" value="1" />
      <param name="tag" value="SDKPistol" />
      <aimAnims/>
   </params>
   <geometry>
      <firstperson name="Objects/Weapons/MeleeWeaponTutorial/MeleeWeaponTuto_fp.cdf" angles="0,0,0" position="0,0,0" />
      <thirdperson name="Objects/Weapons/MeleeWeaponTutorial/MeleeWeaponTuto_tp.cgf" angles="0,0,0" position="0,0,0" />
   </geometry>
   <firemodes>
      <firemode name="melee" type="Melee">
         <melee>
            <param name="helper" value="collision" />
            <param name="offset" value="0.35" />
            <param name="damage" value="200" />
            <param name="slide_damage" value="200" />
            <param name="damage_AI" value="200" />
            <param name="impulse" value="150"/>
            <param name="impulse_actor" value="300" />
            <param name="impulse_AI_to_Player" value="300"/>
            <param name="impulse_vehicle" value="300"/>
            <param name="impulse_up_percentage" value="0.4" />
            <param name="range" value="1.2" />
            <param name="delay" value="0.25" /><!-- Delay between animation start and damages -->
            <param name="aiDelay" value="0.2" />
            <param name="duration" value="0.7" /><!-- Delay between 2 melee attacks -->
            <param name="knockdown_chance" value="10" />
            <param name="use_melee_weapon_delay" value="0.0" />
         </melee>
      </firemode>
   </firemodes>
</item>

For first testings, we use the pistol idlepose and animations, for this we use the tag "SDKPistol" at line 7
- Save script
- Restart cryengine
- Add the weapon "MeleeWeaponTuto" in the "Player_Default" Equipment pack
09.jpg
- Test it ( crtl+g )

-> You should see the weapons on FP and TP with the pistol idlepose
10.jpg


https://youtu.be/PhwOIsjiyaQ

At this point you got a melee weapon working on FP and TP with melee attack on key "V"
but with the pistol animations its not really convincing ( lol )
So lets go for next chapter: :easter:
Last edited by manuk on 23.08.2016, 14:57, edited 34 times in total.
User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

Re: [Tutorial] Basic Melee Weapon

Postby manuk » 18.08.2016, 23:21

CHAPTER 2 : CREATE CUSTOM ANIMATIONS ( 3dsmax > .caf > mannequin setup )

A - Copy and setup a character file in your folder.

° For EaaS you should use the file "sdk_player.max" in "CRYENGINE_SampleAssets.zip"
° For Cry 5 i think you should use the file "skeleton_player_generic.max" in "SAMPLE_v6.zip"
( but im not sure, my version of 3dsmax wont open the file )

- Open it
- Unhide the objects "weapon_bone" and "_Bip01 weapon_bone" ( ref 1 in pict )
- Clic on "import > merge", choose the file "MeleeWeaponTutorial.max" and import "MeleeWeaponTuto_fp"
- Align "MeleeWeaponTuto_fp" to "_Bip01 weapon_bone" ( ref 2 in pict )
- Link "MeleeWeaponTuto_fp" to "_Bip01 weapon_bone" ( ref 3 in pict )
11_12_13.jpg
Now when you move the right arm or hand, the weapon should follow.
-> Your file is ready to be animated.

B - Create IdlePose with 3dsMax

- Clic on "Auto Key"
- Move the bone "_Bip01 weapon_bone" to precisely locate the weapon in your hand.
( dont move the "MeleeWeaponTuto_fp", it should follow the bone "_Bip01 weapon_bone" )

- Move the fingers bones and the arms bones to create the IdlePose you want.

In the CryEngine Exporter:

- Add the bone "Bip01" in the "Animation Export"
- Clic on "Custom from 0 to 0"
- And clic on "EXPORT BONES"
- Choose a folder to export your idlepose animation:
for example: "Assets_or_GameSDK.../Animations/human/male/weapons/generic/1p/"
- Name it "stand_tac_idlepose_meleeweapontuto_1p" and save
14.jpg
-> You should have a file "stand_tac_idlepose_meleeweapontuto_1p.i_caf" in the folder "Assets_or_GameSDK.../Animations/human/male/weapons/generic/1p/"

C - Create Melee Animation with 3dsMax

- Create the animation for the melee attack

In the CryEngine Exporter:

- Add the bone "Bip01" in the "Animation Export"
- Clic on "Entire timeline"
- Choose the same folder to export your melee animation
for example: "Assets_or_GameSDK.../Animations/human/male/weapons/generic/1p/"
- Name it "stand_tac_melee_meleeweapontuto_1p" and save
15.jpg
-> You should have a file "stand_tac_melee_meleeweapontuto_1p.i_caf" in the folder "Assets_or_GameSDK.../Animations/human/male/weapons/generic/1p/"

D - Import animations in cryengine

- Restart cryengine
- Open the Character Tool and open a character file ( for example: "sdk_player.cdf" )
- Search and select your idlepose animation "stand_tac_idlepose_meleeweapontuto_1p"
- Select the skeleton " skeleton_player_generic " and clic "Import"
- Search and select your melee animation "stand_tac_melee_meleeweapontuto_1p"
- Select the skeleton " skeleton_player_generic ", check "Additive" and clic "Import"
16.jpg
-> You should have animation files .caf & .animsettings in they regular folders
17.jpg

E - Setup the cryengine mannequin for you weapon for the First Person view

1 - Declare a Tag for your weapon

- Open the file "Assets_or_GameSDK.../Animations/Mannequin/ADB/itemTags.xml"
( if you dont have it, extract it from "animations.pak > Animations/Mannequin/ADB/" )
- Add the tag "SDKMeleeWeaponTuto" in the group "item" and save the file
18.jpg
- Restart cryengine

2 - Create fragment for idlepose

- Open the "Mannequin Editor"
- Clic on ID "idlepose" and "New fragment entry"
- Select the new fragment created and select the Tag "SDKMeleeWeaponTuto" in the field "item"
19.jpg
- Add an "AnimLayer" on Scope "FullBody1p"
- Add an "AnimClip" with the animation "stand_tac_idlepose_meleeweapontuto_1p" and clic "looping"
20.jpg

3 - Create fragment for melee

- Clic on ID "melee" and "New fragment entry"
- Select the new fragment created and select the Tag "SDKMeleeWeaponTuto" in the field "item"
- Add an "AnimLayer" on Scope "Torso1P"
- Add an "AnimClip" with the animation "stand_tac_melee_meleeweapontuto_1p"
21.jpg

4 - Save the mannequin

If you never extracted mannequin files, a message will pop:
22.jpg
- Clic "save"
-> The modified files are extracted from pak

F - Setup the weapon script for this customized mannequin

- Replace the Tag "SDKPistol" with "SDKMeleeWeaponTuto" at line 7 in the weapon script "Assets_or_GameSDK.../Scripts/Entities/Items/XML/weapons/MeleeWeaponTuto.xml"
Code: Select all
<param name="tag" value="SDKMeleeWeaponTuto" />

- Save the weaponscript
- Restart cryengine

FINAL RESULT :

Now when you equip this weapon, it should play your idlepose,
and when you use melee attack ( key "V" ), it should play your melee animation


https://youtu.be/0aJxHak33DY

Enjoy and have fun :easter:

WHAT NEXT ?

This chapter was setup the mannequin for first person only.
But for or third person view you will need to setup the mannequin "SDK_playerPreview3P"

SDK_playerPreview3P setup example:
https://www.cryengine.com/community/viewtopic.php?f=291&t=134962&start=15#p1300334

_________________________________________________________________________________________

If you like this tutorial or just want to support our game project,
you can donate any amount: https://sites.google.com/site/heathenblog/donate
Last edited by manuk on 23.08.2016, 16:46, edited 45 times in total.
No PMs for help plz, use the forums.
Image
User avatar asfor_farah
Intern Dev
Intern Dev
 
Posts: 194
Member since: 22.06.2014, 16:17
Location: Iraq
Likes: 38

Re: [Tutorial] Basic Melee Weapon

Postby asfor_farah » 18.08.2016, 23:37

I just love you :love:
Check my YouTube channel ^-^ :cheesy: :easter: :
http://www.youtube.com/c/farahsamir

#Asfor
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] Basic Melee Weapon

Postby Ljubisa » 19.08.2016, 09:45

manuk wrote:CHAPTER 2 : CREATE CUSTOM ANIMATIONS ( 3dsmax > .caf > mannequin setup )

UNDER CONSCTRUCTION




again dude, thank you sooo **** much for this !!!!
Life is more fun,when there is a certain someone,or a risk involved!
User avatar Creating1
Senior Developer
Senior Developer
 
Posts: 812
Images: 2
Member since: 24.09.2012, 18:29
Likes: 54

Re: [Tutorial] Basic Melee Weapon

Postby Creating1 » 19.08.2016, 12:17

Nice 1 manuk.
i look forward to the next tut ;)
It's Minutes to Midnight
User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

Re: [Tutorial] Basic Melee Weapon

Postby manuk » 19.08.2016, 15:28

BONUS : MELEE ATTACK ON MOUSE 1

here a simple FlowGraph to set melee attack on mouse 1 for your melee weapons:
24.jpg
Copy this flowgraph on all your levels.
Last edited by manuk on 20.08.2016, 00:38, edited 2 times in total.
No PMs for help plz, use the forums.
Image
User avatar neverfollow81
Regular Dev
Regular Dev
 
Posts: 595
Images: 49
Member since: 24.02.2013, 16:23
Location: New Hampshire
Likes: 274

Re: [Tutorial] "Basic Melee Weapon" for player

Postby neverfollow81 » 19.08.2016, 17:42

Awesome post!
It'd be nice of Crytek to provide the rig in a more 'friendly' format than .max
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] Basic Melee Weapon

Postby Ljubisa » 19.08.2016, 18:23

B - Create IdlePose with 3dsMax

- Clic on "Auto Key"
- Move the bone "_Bip01 weapon_bone" to precisely locate the weapon in your hand.
( dont move the "MeleeWeaponTuto_fp", it should follow the bone "_Bip01 weapon_bone" )

- Move the fingers bones and the arms bones to create the IdlePose you want.


It says can't create keys inwhen in figure mode, I try to get out of figure mode and the model freaks the **** out, what is going on ?
Life is more fun,when there is a certain someone,or a risk involved!
User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

Re: [Tutorial] Basic Melee Weapon

Postby manuk » 20.08.2016, 00:36

Ljubisa wrote:
B - Create IdlePose with 3dsMax

- Clic on "Auto Key"
- Move the bone "_Bip01 weapon_bone" to precisely locate the weapon in your hand.
( dont move the "MeleeWeaponTuto_fp", it should follow the bone "_Bip01 weapon_bone" )

- Move the fingers bones and the arms bones to create the IdlePose you want.


It says can't create keys inwhen in figure mode, I try to get out of figure mode and the model freaks the **** out, what is going on ?


You cannot animate in figure mode.
If your character changing pose when you go out of figure mode means there allready some animation keys.
You have to delete all old existing animations key.

If you never animated a character with 3dsMax, you should do some 3dsMax tutorial about animation before doing this tutorial.
No PMs for help plz, use the forums.
Image
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] Basic Melee Weapon

Postby Ljubisa » 20.08.2016, 10:43

manuk wrote:
Ljubisa wrote:
B - Create IdlePose with 3dsMax

- Clic on "Auto Key"
- Move the bone "_Bip01 weapon_bone" to precisely locate the weapon in your hand.
( dont move the "MeleeWeaponTuto_fp", it should follow the bone "_Bip01 weapon_bone" )

- Move the fingers bones and the arms bones to create the IdlePose you want.


It says can't create keys inwhen in figure mode, I try to get out of figure mode and the model freaks the **** out, what is going on ?


You cannot animate in figure mode.
If your character changing pose when you go out of figure mode means there allready some animation keys.
You have to delete all old existing animations key.

If you never animated a character with 3dsMax, you should do some 3dsMax tutorial about animation before doing this tutorial.




I got out of figure mode, highlighted everything , thank deleted all the keys at the bottom, and I expected the model to go back to it's natural stance, but no it stayed in it's umm I think that is the ladder climbing pose.. I understand basic animating in this, but can you help me out with this as I seem not to be able to fix it :(
Life is more fun,when there is a certain someone,or a risk involved!
User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

Re: [Tutorial] Basic Melee Weapon

Postby manuk » 20.08.2016, 15:29

Ljubisa wrote:I got out of figure mode, highlighted everything , thank deleted all the keys at the bottom, and I expected the model to go back to it's natural stance, but no it stayed in it's umm I think that is the ladder climbing pose.. I understand basic animating in this, but can you help me out with this as I seem not to be able to fix it :


1 - go out figure mode
2 - delete all keys
3 - go in figure mode again
4 - go out figure mode again
-> you character should be now on basic pose
No PMs for help plz, use the forums.
Image
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] Basic Melee Weapon

Postby Ljubisa » 21.08.2016, 12:31

manuk wrote:
Ljubisa wrote:I got out of figure mode, highlighted everything , thank deleted all the keys at the bottom, and I expected the model to go back to it's natural stance, but no it stayed in it's umm I think that is the ladder climbing pose.. I understand basic animating in this, but can you help me out with this as I seem not to be able to fix it :


1 - go out figure mode
2 - delete all keys
3 - go in figure mode again
4 - go out figure mode again
-> you character should be now on basic pose



When I check "additive" it messes my animation up, it looks weird and jiggly , but when additive is off it looks fine..??

Also, my Mannequin editor's layout is really messed up, I can't view the timeline,I tried you know dragging it up like it should be, but it doesn't go anywhere it stas the same, **** my life
Life is more fun,when there is a certain someone,or a risk involved!
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] "Basic Melee Weapon" for player

Postby Ljubisa » 21.08.2016, 20:51

:(
Life is more fun,when there is a certain someone,or a risk involved!
User avatar manuk
Producer
Producer
 
Posts: 1265
Images: 8
Member since: 03.06.2013, 19:50
Location: Paris, France
Likes: 306

Re: [Tutorial] Basic Melee Weapon

Postby manuk » 22.08.2016, 13:42

Ljubisa wrote:When I check "additive" it messes my animation up, it looks weird and jiggly , but when additive is off it looks fine..??

additive animation could look "weird and jiggly" when you look at it in character editor and mannequin editor ( like every others additives animations )
but its working fine and look normal when you are in game ( that how cryengine works )
if you want test the additive animation in character editor you have to:
http://docs.cryengine.com/display/SDKDOC2/Creating+Additive+Animations#CreatingAdditiveAnimations-TestingAdditivesintheCharacterEditor

Ljubisa wrote:Also, my Mannequin editor's layout is really messed up, I can't view the timeline,I tried you know dragging it up like it should be, but it doesn't go anywhere it stas the same, **** my life

i dont know, but the mannequin editor can be messy sometimes.
some windows can "vanish"
on cryengine 5:
- try to "Layout" > "Reset Layout" and strech the mannequin window from min to max.
on EaaS:
- try to "View" > "Layout" > "Restore Default Layout" and strech the mannequin window from min to max.

maybe post a pict of your bug.
No PMs for help plz, use the forums.
Image
User avatar Ljubisa
Regular Dev
Regular Dev
 
Posts: 412
Images: 4
Member since: 13.06.2013, 19:55
Likes: 16

Re: [Tutorial] Basic Melee Weapon

Postby Ljubisa » 22.08.2016, 18:58

manuk wrote:
Ljubisa wrote:When I check "additive" it messes my animation up, it looks weird and jiggly , but when additive is off it looks fine..??

additive animation could look "weird and jiggly" when you look at it in character editor and mannequin editor ( like every others additives animations )
but its working fine and look normal when you are in game ( that how cryengine works )
if you want test the additive animation in character editor you have to:
http://docs.cryengine.com/display/SDKDOC2/Creating+Additive+Animations#CreatingAdditiveAnimations-TestingAdditivesintheCharacterEditor

Ljubisa wrote:Also, my Mannequin editor's layout is really messed up, I can't view the timeline,I tried you know dragging it up like it should be, but it doesn't go anywhere it stas the same, **** my life

i dont know, but the mannequin editor can be messy sometimes.
some windows can "vanish"
on cryengine 5:
- try to "Layout" > "Reset Layout" and strech the mannequin window from min to max.
on EaaS:
- try to "View" > "Layout" > "Restore Default Layout" and strech the mannequin window from min to max.

maybe post a pict of your bug.



Hey guess the good thing, I can see the Animation tab again...except everything else..
-Basically restoring to default layout made me lose my **** mind, look at this beautiful thing I like to call my **** luck
Attachments
Capture.JPG
Life is more fun,when there is a certain someone,or a risk involved!