Weapon Creation/Prefab Configuration – Arma Reforger
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{TOC|side}} | {{TOC|side}} | ||
{{Feature|informative|'''Previous part''' - [[Arma Reforger:Weapon Creation/Asset Preparation|Asset Preparation]].}} | |||
In this chapter we will learn how fuel is simulated in game and we will change following things: | |||
* '''Creating new rifle prefab''' | * '''Creating new rifle prefab''' | ||
* '''Configuring basic weapon parameters''' | * '''Configuring basic weapon parameters''' | ||
* '''Configuring ammo parameters''' | * '''Configuring ammo parameters''' | ||
== Prefab Setup == | |||
{{Feature|informative|Other method involves duplicating some already existing prefab - this might be handy if you are creating something similar to already existing weapons. | When making prefabs of weapons it is recommended to inherit from one of the already existing prefabs located in '''''Prefabs\Weapons\Core''''' - those prefabs should have most of the necessary configuration for various kinds of weapons.{{Feature|informative|In this article, [[Arma_Reforger:Resource_Manager:_Options#Register_.22enfusion:.2F.2F.22_protocol|'''Enfusion links''']] are used. With those links it is possible to open specific resource just by simply clicking on that link. Enfusion links '''has to be manually activated in Workbench options''' (Workbench -> Options -> Workbench -> Register "enfusion://" protocol) before it can be used}}In this case we will use '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Rifle_Base.et|Rifle_Base.et}}''' as parent prefab. To do so, navigate in '''Resource Browser''' to '''''Prefabs\Weapons\Core''''' and locate {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Rifle_Base.et|Rifle_Base.et}} prefab. | ||
For instance if you are making some new M16 variant, you could use '''{{Link|Arma_Reforger:Data_Modding_Basics#Using_.22Duplicate_to....22_function|Duplicate to "addon name"}}''' function on | Once you are there, click with right mouse button on that prefab and select '''{{Link|Arma_Reforger:Data_Modding_Basics#Using_.22Inherit_in....22_function|Inherit in}}''' from context menu. | ||
When asked about new name of prefab, consider calling this new prefab ''WeaponName_base'' - this might be especially useful when you plan to have multiple variants of weapon, since it will help you to keep your structure nice and clean. After new inherited prefab is created, relocate it to some more fitting location like the {{hl|Prefabs/Weapons/Rifles}} directory.{{Messagebox|Other method involves duplicating some already existing prefab - this might be handy if you are '''creating something similar to already existing weapons or don't want to add manually components'''. | |||
For instance if you are making some new M16 variant, you could use '''{{Link|Arma_Reforger:Data_Modding_Basics#Using_.22Duplicate_to....22_function|Duplicate to "addon name"}}''' function on '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Rifles/M16/Rifle_M16A2_base.et|Rifle_M16A2_base.et}}''' and then modify parameters of such new prefab.|✩|#88cc88}}[[File:armareforger-new-weapon-creating-inherited-prefab.gif]] | |||
After new prefab is created, it is possible to start modifying it. It can be done by either by opening prefab in [[Arma Reforger:Prefabs Basics#Opening prefab in Prefab Edit Mode|'''Prefab Edit Mode''']] button or by [[Arma Reforger:Prefabs Basics#Creating entity prefab in World Editor|'''placing prefab manually in''' '''World Editor''']]. In this tutorial '''Prefab Edit Mode''' was used to edit the ''SampleWeapon_01_base.et'' prefab. | After new prefab is created, it is possible to start modifying it. | ||
It can be done by either by opening prefab in [[Arma Reforger:Prefabs Basics#Opening prefab in Prefab Edit Mode|'''Prefab Edit Mode''']] button or by [[Arma Reforger:Prefabs Basics#Creating entity prefab in World Editor|'''placing prefab manually in''' '''World Editor''']]. | |||
In this tutorial '''Prefab Edit Mode''' was used to edit the ''SampleWeapon_01_base.et'' prefab. | |||
Once prefab is loaded, first step would be assigning correct model - in this case it is '''''SampleWeapon_01.xob''''' - to '''MeshObject''' component. | Once prefab is loaded, first step would be assigning correct model - in this case it is '''''SampleWeapon_01.xob''''' - to '''MeshObject''' component. | ||
[[File:armareforger-new-weapon-meshobject.png|thumb| | [[File:armareforger-new-weapon-meshobject.png|thumb|367px|'''MeshObject''' component with assigned weapon model]] | ||
If you inherited from core weapon type like | If you inherited from core weapon type like '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Rifle_Base.et|Rifle_Base.et}}''' then you will need to add few components listed below. In case of duplication of existing prefab, it might be still worth to adjust data in those components before moving to next section of this tutorial, since some of the values might need to be adjusted, like for example '''damage''' in '''SCR_MeleeWeaponProperties'''. | ||
* '''RigidBody''' - this component is responsible for all kind of collisions and without it will be impossible to pick up weapon. | * '''RigidBody''' - this component is responsible for all kind of collisions and without it will be impossible to pick up weapon. | ||
Line 41: | Line 38: | ||
In component itself, following changes will be required: | In component itself, following changes will be required: | ||
* Assign fitting particle effect to '''Particle Effect''' field - i.e. | * Assign fitting particle effect to '''Particle Effect''' field - i.e. {{Link|enfusion://ResourceManager/~ArmaReforger:Particles/Weapon/Smoke_M16A2.ptc|Smoke_M16A2.ptc}} | ||
* In '''Effect Position''' parameter click on '''set class''' button and pick '''EntitySlotInfo''' class and call it for instance Muzzle | * In '''Effect Position''' parameter click on '''set class''' button and pick '''EntitySlotInfo''' class and call it for instance Muzzle | ||
** Inside '''Effect Position''', change '''Pivot ID''' to '''barrel_muzzle''' | ** Inside '''Effect Position''', change '''Pivot ID''' to '''barrel_muzzle''' | ||
Line 48: | Line 45: | ||
Additionally, you might also want to adjust: | Additionally, you might also want to adjust: | ||
* '''What kind of cartridges are ejected by the weapon''' - this is defined in '''CaseEjectingEffectComponent''' - over here you can select from many particle effects like for instance | * '''What kind of cartridges are ejected by the weapon''' - this is defined in '''CaseEjectingEffectComponent''' - over here you can select from many particle effects like for instance {{Link|enfusion://ResourceManager/~ArmaReforger:Particles/Weapon/Casing_556x45.ptc|Casing_556x45.ptc}} and assign them to '''Particle Effect''' property | ||
* '''Muzzle effect of the weapon''' - this is controlled by '''Particle Effect''' parameter in '''SCR_MuzzleEffectComponent -''' again, you can pick from some existing effects like | * '''Muzzle effect of the weapon''' - this is controlled by '''Particle Effect''' parameter in '''SCR_MuzzleEffectComponent -''' again, you can pick from some existing effects like {{Link|enfusion://ResourceManager/~ArmaReforger:Particles/Weapon/Muzzle_AK74.ptc|Muzzle_AK74.ptc}} or create your own effects like mentioned in [[Arma Reforger:Weapon Modding#Particle Effects Change|Weapon Modding]] documentation | ||
Line 72: | Line 69: | ||
Besides these attributes, there are also '''Custom Attributes''' where it is possible to change e.g. '''Item Inspection Anim''' or the character's maximum speed when a given item is equipped, or '''PreviewRenderAttributes''', which controls the weapon preview in the inventory menu - if your weapon has an odd size, it might be necessary to adjust the camera parameters there. | Besides these attributes, there are also '''Custom Attributes''' where it is possible to change e.g. '''Item Inspection Anim''' or the character's maximum speed when a given item is equipped, or '''PreviewRenderAttributes''', which controls the weapon preview in the inventory menu - if your weapon has an odd size, it might be necessary to adjust the camera parameters there. | ||
In Reforger, inventory system is no '''longer using pictures''' to for model thumbnails but instead, '''3D models are rendered inside | In Reforger, inventory system is no '''longer using pictures'<nowiki/>'' to for model thumbnails but instead, '''''<nowiki/>''3D models are rendered inside inventorymenu'''. How this item is rendered inside inventory is controlled by '''PreviewRenderAttributes''', where you have bunch of camera controls'<nowiki/>''''', and In case of '''SampleWeapon_01_base.et''', some tweaks to will be required to the camera distance. Since this bullpup weapon is smaller than regular rifles, it looks quite small in inventory menu. To fix this, navigate to '''PreviewRenderAttributes class in Custom Attributes''' and change '''Camera Distance To Item''' parameter from '''1 to 0.8.''' | ||
[[File:armareforger-new-weapon-preview-render.png|none|thumb|470x470px|'''PreviewRenderAttributes''' inside '''SCR_WeaponAttachmentsStorageComponent''']] | [[File:armareforger-new-weapon-preview-render.png|none|thumb|470x470px|'''PreviewRenderAttributes''' inside '''SCR_WeaponAttachmentsStorageComponent''']] | ||
Line 94: | Line 91: | ||
-->{{Messagebox|'''Tip''': If you already want to configure your display name in a way, where it can be translated, consider looking at the {{Link|Arma Reforger:Mod Localisation}} page.|✩|#88cc88}} | -->{{Messagebox|'''Tip''': If you already want to configure your display name in a way, where it can be translated, consider looking at the {{Link|Arma Reforger:Mod Localisation}} page.|✩|#88cc88}} | ||
* '''In Item Phys Attributes''': | * '''In Item Phys Attributes''': | ||
** '''Weight''' parameter was adjusted to somehow match the weight of real weapon without any accessories (including magazine). This '''parameter is using''' '''kilograms''' and in this example it was set to 4kg | ** '''Weight''' parameter was adjusted to somehow match the weight of real weapon without any accessories (including magazine). This '''parameter is using''' '''kilograms''' and in this example it was set to 4kg. Weight in game affects for instance character stamina. | ||
** '''Size Setup Strategy''' was setup to '''Volume'''. This means that size of that object will be calculated using '''Item Volume'''. | ** '''Size Setup Strategy''' was setup to '''Volume'''. This means that size of that object will be calculated using '''Item Volume'''. | ||
** '''Item Volume''' | ** '''Item Volume''' (in cm<sup>3</sup>) defines how much space in inventory container takes that object. Containers like vest have their own definition how large object can fit in their pouches | ||
*** In this example it is set to '''2500''' just to showcase how it works, normally, 3000 is used for machine guns, while rifle like AK74 has this value set to '''1500''' | |||
Additionally, it will be also necessary to add one entry to '''Custom Attributes'''. This can be done by clicking on '''arrow icon (1)''' to the right of it and then selecting '''ItemOneHandAnimAttributes''' class. This class controls the behavior of the weapon when it is held with one hand only - i.e. when the gadget is equipped - and in most cases the default values are good enough for rifles.{{Clear}} | Additionally, it will be also necessary to add one entry to '''Custom Attributes'''. This can be done by clicking on '''arrow icon (1)''' to the right of it and then selecting '''ItemOneHandAnimAttributes''' class. This class controls the behavior of the weapon when it is held with one hand only - i.e. when the gadget is equipped - and in most cases the default values are good enough for rifles.{{Clear}} | ||
== | == Action Contexts Adjustment == | ||
=== Add New Action Context === | === Add New Action Context === | ||
[[File:armareforger-new-weapon-action-contexts-optic.gif|left|thumb|649x649px|Adding new '''Action Contexts''']] | [[File:armareforger-new-weapon-action-contexts-optic.gif|left|thumb|649x649px|Adding new '''Action Contexts''']] | ||
Interactions with weapon in game world, like being able to take weapon from ground or performing some actions in inspect menu, are controlled by '''ActionsManagerComponent'''. | Interactions with weapon in game world, like being able to take weapon from ground or performing some actions in inspect menu, are controlled by '''ActionsManagerComponent'''. '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Rifle_Base.et|Rifle_Base.et}}''' prefab should already have most of the '''Action Contexts''' and '''Additional Actions''' configured although if your weapon is capable of mounting some optic - like '''Sample Weapon -''' it might be necessary to add another context for handling '''optic-related actions it'''. | ||
To do add new '''Action Context, simply click on plus icon next to it''' and then inside of it (''by default it should be called UserActionContext''), locate '''Context Name''' property and type in '''optic'''. | To do add new '''Action Context, simply click on plus icon next to it''' and then inside of it (''by default it should be called UserActionContext''), locate '''Context Name''' property and type in '''optic'''. | ||
Line 135: | Line 133: | ||
{{Clear}} | {{Clear}} | ||
=== | === Action Contexts Location Change === | ||
It might seem that adjusting of action contexts position is a tedious job but thankfully it is possible to adjust their position directly in viewport using gizmos. | It might seem that adjusting of action contexts position is a tedious job but thankfully it is possible to adjust their position directly in viewport using gizmos. | ||
Line 152: | Line 150: | ||
[[File:armareforger-new-weapon-actions-final.png]] | [[File:armareforger-new-weapon-actions-final.png]] | ||
=== | === Action Contexts Radius Adjustment === | ||
Last step will be adjusting radius of actions. '''Default''' action context is used for instance for picking up weapon from the ground so preferable it should cover the whole gun. | Last step will be adjusting radius of actions. '''Default''' action context is used for instance for picking up weapon from the ground so preferable it should cover the whole gun. | ||
Line 174: | Line 172: | ||
Since parent prefab has only two fire modes, a new one has to be added through '''➕ sign (1)''' on the right side of the '''Fire Modes''' property. Once it is there, it can be filled with proper data. | Since parent prefab has only two fire modes, a new one has to be added through '''➕ sign (1)''' on the right side of the '''Fire Modes''' property. Once it is there, it can be filled with proper data. | ||
'''BaseFireMode''' with ''' | '<nowiki/>''BaseFireMode''' with '''MaxBurst''' set to 1 will work as single fire mode'<nowiki/>'''''. On newly added '''BaseFireMode, Max Burst''' should be set to '''-1''' - this fire mode will work as '''full auto mode'''. | ||
Burst fire weapons can be configured by setting '''Max Burst''' property to something above 1. In this case, new property will appear - '''Burst Type'''. Over there it is possible to select 3 types of burst fire: | Burst fire weapons can be configured by setting '''Max Burst''' property to something above 1. In this case, new property will appear - '''Burst Type'''. Over there it is possible to select 3 types of burst fire: | ||
Line 187: | Line 185: | ||
Weapon '''recoil''' is in configured on of the sub classes of '''Weapon Aim Modifiers. Rifle_Base''' prefab is missing '''RecoilWeaponAimModifier & ZeroingWeaponAimModifier''' subclasses in '''Weapon Aim Modifiers''', therefore those have to be added to it. | Weapon '''recoil''' is in configured on of the sub classes of '''Weapon Aim Modifiers. Rifle_Base''' prefab is missing '''RecoilWeaponAimModifier & ZeroingWeaponAimModifier''' subclasses in '''Weapon Aim Modifiers''', therefore those have to be added to it. | ||
While '''ZeroingWeaponAimModifier''' doesn't need any tweaks, '''RecoilWeaponAimModifier''' class will have to be set from scratch by hand. | While '''ZeroingWeaponAimModifier''' doesn't need any tweaks, '''RecoilWeaponAimModifier''' class will have to be set from scratch by hand. | ||
As reference, either '''pictures below''' or | As reference, either '''pictures below''' or {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Rifles/AK74/Rifle_AK74_base.et|AK74}} prefab can be used as reference. | ||
<gallery mode="nolines" widths="455" heights="273"> | <gallery mode="nolines" widths="455" heights="273"> | ||
File:armareforger-new-weapon-recoil-data-linear.png | File:armareforger-new-weapon-recoil-data-linear.png | ||
Line 198: | Line 196: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Recoil | ! Recoil | ||
| '''X''' | | | ||
| '''Y''' | '''X''' | ||
| '''Z''' | | | ||
'''Y''' | |||
| | |||
'''Z''' | |||
|- | |- | ||
! Linear | ! Linear | ||
(1u = 1m) | (1u = 1m) | ||
| [[File:armareforger-new-weapon-recoil-linear-x2.gif]] | | | ||
| [[File:armareforger-new-weapon-recoil-linear-y.gif]] | [[File:armareforger-new-weapon-recoil-linear-x2.gif]] | ||
| [[File:armareforger-new-weapon-recoil-linear-z.gif]] | | | ||
[[File:armareforger-new-weapon-recoil-linear-y.gif]] | |||
| | |||
[[File:armareforger-new-weapon-recoil-linear-z.gif]] | |||
|- | |- | ||
! Angular | ! Angular | ||
(1u = 1°) | (1u = 1°) | ||
| [[File:armareforger-new-weapon-recoil-angular-x.gif|269x269px]] | | | ||
| [[File:armareforger-new-weapon-recoil-angular-y.gif]] | [[File:armareforger-new-weapon-recoil-angular-x.gif|269x269px]] | ||
| [[File:armareforger-new-weapon-recoil-angular-z.gif]] | | | ||
[[File:armareforger-new-weapon-recoil-angular-y.gif]] | |||
| | |||
[[File:armareforger-new-weapon-recoil-angular-z.gif]] | |||
|- | |- | ||
! Offset | ! Offset | ||
(1u = 1rad) | (1u = 1rad) | ||
| [[File:armareforger-new-weapon-recoil-offset-x.gif]] | | | ||
| [[File:armareforger-new-weapon-recoil-offset-y.gif]] | [[File:armareforger-new-weapon-recoil-offset-x.gif]] | ||
| ''not used, should be left to 0'' | | | ||
[[File:armareforger-new-weapon-recoil-offset-y.gif]] | |||
| | |||
''not used, should be left to 0'' | |||
|} | |} | ||
== Weapon Deployment Configuration == | |||
Weapon deployment feature allows you to rest your weapon on appropriate surface below defined deploy point, which reduces the weapon sway & recoil. System supports both resting on the weapon body and on bipod legs. | |||
Deploying of weapon on the surfaces is control by parameters located in two components - '''SCR_WeaponAttachmentsStorageComponent + MuzzleComponent -''' and we will begin our configuration adventure with '''SCR_WeaponAttachmentsStorageComponent''' component.{{Messagebox|'''Tip''': It is recommended to turn on diagnostics when trying to configure weapon deployment. This can be done by activating options from ''' [[Arma_Reforger:Diag_Menu|Diag Menu]] → Gamecode -> Weapons → Deployment''' menu|✩|#88cc88}} | |||
=== Adding Deployment Points === | |||
'''SCR_WeaponAttachmentsStorageComponent''' contains deployment related parameters in '''AimingModifierAttributes''' class which is part of '''Custom Attributes'''. Over there it is possible to define '''Deployment Points''' for both '''weapon body''' (f.e. when resting rifle on front section of the weapon without any bipod attached whatsoever ) and for '''integrated bipod'''. Since Sample Weapon doesn't have integrated weapon, PKM setup will be used to explain this part. | |||
==== Base Deployment ==== | |||
Starting with basic deployment, begin with adding new entry to '''Deployment Points''' array by clicking on '''+ button''' on the right side of the parameter. This should add new '''PivotPointInfoItem''' to the list with some default parameters. Next, click on '''set class''' button next to '''Point Info''' parameter and type in some unique name like "''deploy''". Over here, you will be able to set a point which will be used as a pivot & snap point for weapon when its deployed. | |||
Depending on your preferences, you can either create some slot in model and select it as '''Pivot ID''' or use '''Offset''' and in-game gizmo to place that in desired place. In case of the '''Sample Weapon''', this point was placed at the front of the weapon as on picture below: | |||
[[File:armareforger-new-weapon-base-deployment-point.png]] | |||
Make sure that '''System Identifier''' is set to 0 - this tells engine to use following '''PivotPointInfoItem''' when there is no bipod or bipod is folded. {{Feature|informative|'''System Identifier''' possible values: | |||
* 0 - no bipod or bipod folded | |||
* 1 - not used atm | |||
* 2 - bipod unfolded}} | |||
==== Bipod Deployment ==== | |||
Weapons with integrated bipod need a special treatment. First of all, make sure that you have modeled bipod in deployed state and put additional bones for bipod legs folding animation - like '''bipod_l & bipod_r'''. Additionally, it is also possible to add new '''empty objects''' at the bipod legs ends, which are parented to '''bipod legs''' bones via '''Relations''' - this might be bit easier to do compared setting offsets in '''World Editor''' viewport. | |||
[[File:armareforger-new-weapon-bipod-setup.png]] | |||
In vanilla weapons, bipod is animated via '''weapon animation graph''', which means you need to create '''new animation with 2 frames''' (where first frame represents folded bipod and second show unfolded bipod) and '''add new logic to animation graph''' from i.e. PKM. | |||
[[File:armareforger-new-weapon-deployment-stabilization-points.png|thumb|643x643px|PKM '''Stabilization Points''' configuration. Note usage of '''Offset''' to set the point at the bipod leg end]] | |||
[[File:armareforger-new-weapon-deploy-anim-graph.png|none|thumb|355x355px|Portion of PKM animation graph responsible for bipod animation]] | |||
Once model and animations are done, make sure that you still have '''PivotPointInfoItem''' defined when bipod is folded as described [[Arma Reforger:Weapon Creation/Prefab Configuration#Base Deployment|above]] and then perform following actions: | |||
* Click again on '''+ button''' next to '''Deployment Points''' array to add second element to the list | |||
* Click on '''set class''' button next to '''Point Info''' in that new array element and place this point where bipod is supposed to '''pivot''' | |||
* Change '''System Identifier''' parameter to '''2''' - this will tell engine to use that '''PivotPointInfoItem''' when '''bipod is unfolded''' | |||
* Add '''two new elements''' to '''Stabilization Points''' array by clicking on '''+ button''' and call it i.e. '''LeftLeg''' & '''RightLeg''' | |||
** Set '''Pivot Info''' class and use '''Pivot ID''' to select empty object attached to bone leg previously created (''bipod_l/r''). If you didn't create empty socket for those points, use leg bones (i.e. '''''w_bipodleg_left/right''''') and use '''Offset''' to place that point at the end of the leg. Watch out for the rotation of the bones! | |||
* '''Optionally''': tweak '''Stabilization Size''' parameter - this controls how large is the surface on which given stabilization point is resting. For bipod legs it might be useful to user bit lower values | |||
=== Deployment IK Targets === | |||
Next thing on the list is setting of '''Deployment IK Targets''' in '''MuzzleComponent''' where it will be necessary to adjust 3 parameters '''- LEFT HAND TARGET, RIGHT HAND TARGET and''' '''BUTTSTOCK TRANSFORMATION.''' | |||
* '''LEFT HAND TARGET -''' used to determine '''position of left hand when deployment is active'''. Use '''slot_magazine''' as '''Pivot ID''' | |||
* '''RIGHT HAND TARGET -''' used to determine '''position of right hand when deployment is active'''. Use '''snap_hand_right as Pivot ID''' | |||
* '''BUTTSTOCK TRANSFORMATION -''' used to snap weapon butt stock character shoulder. Use '''Offset''' to place this point at the end of the buttstock. | |||
[[File:armareforger-new-weapon-deployment-ik-targets.png]]{{Feature|important|Currently, '''LEFT HAND TARGET''' is using offset from '''LeftHandProp''' in IK anim. Because of that, it is necessary to use '''slot_magazine''' as '''Pivot ID''' and adjust how much left hand should move changing '''Z''' value in '''Offset'''. If it still doesn't work, then make sure that magazine (prop.L to be precise) in your IK anim is attached to '''slot_magazine'''}}{{Feature|warning|Make sure that [[Arma_Reforger:Weapon_Animation/Basic_Tutorial#Adding_magazine_to_the_Scene|magazine is snapped to '''slot_magazine''']] in your IK animation! Otherwise, you might encounter weird deformations of left hand weapon weapon is deployed.}} | |||
After setting those parameters it should be now possible to deploy the weapon in game and verify the results. If you encounter some issues, make sure to turn on '''Deployment''' diagnostics from '''Diag Menu'''. | |||
=== Deployment Aim Modifiers === | |||
In most cases this step is completely optional, since default values should be fine for most of the weapons. If you want to have some non standard behavior (like even better recoil reduction when weapon is deployed) then it is possible to tweak it '''MuzzleComponent → Weapon Aim Modifiers → RecoilWeaponAimModifier''' section. By changing '''Deployment Multiplier''' and '''Bipod Deployment Multiplier''' parameters in '''Linear Data, Angular Data, Turn Offset Data''' you can achieve rather interesting results if you seek for some unusual experience. As it was mentioned before though, in most cases you should be fine with default values. | |||
[[File:armareforger-new-weapon-deployment-aim-modifiers.png]] | |||
== Zeroing == | == Zeroing == | ||
<!-- | <!-- | ||
{{Feature|informative|Zeroing is the term used in videogames for '''boresighting'''.}} | {{Feature|informative|Zeroing is the term used in videogames for '''boresighting'''.}} | ||
Line 271: | Line 339: | ||
This means that you should have following zeroing modes: | This means that you should have following zeroing modes: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Zeroing Modes Table | |+Zeroing Modes Table | ||
! Animation Source Value | ! Animation Source Value | ||
! Range [m] | ! Range [m] | ||
Line 317: | Line 385: | ||
At this stage we won't bother with animating iron sights and we will get back to it once there is animation graph set in. | At this stage we won't bother with animating iron sights and we will get back to it once there is animation graph set in. | ||
== Dispersion == | |||
Dispersion of the weapon is controlled by two parameters - '''Dispersion Diameter''' & '''Dispersion Range''' - located in '''MuzzleComponent''' of the weapon. Both of those parameters are measured in '''meters.''' | |||
Quite often you might find weapon dispersion data being specified in {{Link|https://en.wikipedia.org/wiki/Minute_and_second_of_arc|MOA}} - in such case you can '''multiple MOA by 0.029''' to get '''Dispersion Diameter''' value and set '''Dispersion Range''' to '''100 meters'''. | |||
For Sample Weapon, it is assumed that weapon has '''2 MOA''' dispersion, which results in '''Dispersion Diameter''' value being equal to '''0.058'''. | |||
[[File:armareforger-new-weapon-dispersion-config.png|thumb|392x392px|Setup of dispersion in prefab]] | |||
[[File:armareforger-new-weapon-dispersion-setup.png|953x953px]] | |||
Additionally, dispersion is also affected by ammunition which is fired - you can read about it [[Arma Reforger:Weapon Creation/Prefab Configuration#Extra Things|here]]. | |||
Line 326: | Line 411: | ||
Depending on the type of ammo are you preparing, there are few '''core prefabs''' for various types of ammunition located in Prefabs/Weapons/Core folder. In general, there are three suggested approaches: | Depending on the type of ammo are you preparing, there are few '''core prefabs''' for various types of ammunition located in Prefabs/Weapons/Core folder. In general, there are three suggested approaches: | ||
* Creating new prefab inheriting from | * Creating new prefab inheriting from {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_Bullet_Base.et|Ammo_Bullet_Base.et}} ''via'' '''[[Arma Reforger:Data Modding Basics#Using .22Inherit Prefab in Addon.22 function|Inherit in]]''' functionality | ||
* Duplicating one of existing ammo prefabs via [[Arma Reforger:Data Modding Basics#Using .22Duplicate to....22 function|'''Duplicate in''']] option - this might be useful for instance on rockets, if i.e. you don't want to use some of the components but still want to keep some of the configuration from it | * Duplicating one of existing ammo prefabs via [[Arma Reforger:Data Modding Basics#Using .22Duplicate to....22 function|'''Duplicate in''']] option - this might be useful for instance on rockets, if i.e. you don't want to use some of the components but still want to keep some of the configuration from it | ||
* [[Arma Reforger:Prefabs Basics#Creating inherited prefab|Inheriting from one of existing prefabs]] - this can be used if you are trying to do some variant of existing ammo. This method could be for example used when you | * [[Arma Reforger:Prefabs Basics#Creating inherited prefab|Inheriting from one of existing prefabs]] - this can be used if you are trying to do some variant of existing ammo. This method could be for example used when you {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Ammo/Ammo_545x39_Ball_7N6.et|5.45x39 7N6}} vanilla bullet if you would like to do newer variant of that bullet (for instance {{Link|https://en.wikipedia.org/wiki/5.45%C3%9739mm#Basic_specifications|7N10}}) with slightly changed characteristics | ||
In this tutorial, '''Sample Weapon''' is supposed to use a variant of {{Link|https://en.wikipedia.org/wiki/6.5mm_Grendel|6.5 Grendel}} ammo but unlike in A3, this round won't be caseless to show how to configure '''spent cartridge ejection'''. Because of that, '''inheriting from | In this tutorial, '''Sample Weapon''' is supposed to use a variant of {{Link|https://en.wikipedia.org/wiki/6.5mm_Grendel|6.5 Grendel}} ammo but unlike in A3, this round won't be caseless to show how to configure '''spent cartridge ejection'''. Because of that, '''inheriting from {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_Bullet_Base.et|Ammo_Bullet_Base.et}}''' was selected for configuration of this new bullet. | ||
When trying to configure a bullet that exists in real life, it is good to gather as much reference material as possible. | When trying to configure a bullet that exists in real life, it is good to gather as much reference material as possible. | ||
The {{arma3}} variant of the 6.5x39mm is a fictional bullet, so as an inspiration, {{Link|http://www.prvipartizan.com/search_rb.php?id=A-484|PRVI PARTIZAN | The {{arma3}} variant of the 6.5x39mm is a fictional bullet, so as an inspiration, {{Link|http://www.prvipartizan.com/search_rb.php?id=A-484|PRVI PARTIZAN 6.5 mm Grendel FMJ BT 7.10 g }} with 6.5x39mm dimensions (instead of 6.5x38mm) was used, since there is a decent amount of information available for it. | ||
After creating new inherited prefab called '''Ammo_65x39_FMJBT.et''', first step will be creating '''Ammo''' folder in '''Prefabs/Weapons''' folder and then moving '''Ammo_65x39_FMJBT.et''' prefab from '''Prefabs/Weapons/Core''' to the '''Ammo''' folder. | After creating new inherited prefab called '''Ammo_65x39_FMJBT.et''', first step will be creating '''Ammo''' folder in '''Prefabs/Weapons''' folder and then moving '''Ammo_65x39_FMJBT.et''' prefab from '''Prefabs/Weapons/Core''' to the '''Ammo''' folder. | ||
Line 341: | Line 426: | ||
In Prefab itself, there are two things you will want to adjust before moving on to more complex topics. First one will be adjusting things in '''Projectile''' itself like changing following parameters: | In Prefab itself, there are two things you will want to adjust before moving on to more complex topics. First one will be adjusting things in '''Projectile''' itself like changing following parameters: | ||
*In '''Projectile Model''' assign model of the bullet itself - this model is visible after it is being fired | * In '''Projectile Model''' assign model of the bullet itself - this model is visible after it is being fired | ||
*In '''Cartridge Model''' assign model of the cartridge (bullet+case). '''Right now it is not being rendered in game''' though, unless loose bullet is placed in '''World Editor'''. | * In '''Cartridge Model''' assign model of the cartridge (bullet+case). '''Right now it is not being rendered in game''' though, unless loose bullet is placed in '''World Editor'''. | ||
If you don't have models for neither '''Projectile''' or '''Cartridge Model''' , then you can use of the existing ones. | If you don't have models for neither '''Projectile''' or '''Cartridge Model''' , then you can use of the existing ones. | ||
In this case | In this case {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Bullets/762x51/Bullet_762x51_M62.xob|Bullet_762x51_M62.xob}} and {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Bullets/762x51/Cartridge_762x51_M62.xob|Cartridge_762x51_M62.xob}} were used since they are closest thing which matches Lapua FMJ BT round. | ||
Next, go to '''InventoryItemComponent''' and click on '''set class''' button next to '''Item Phys Attributes'''. | Next, go to '''InventoryItemComponent''' and click on '''set class''' button next to '''Item Phys Attributes'''. | ||
Over there you will set inventory values which could be useful when i.e. taking single rounds (''which normally in the game doesn't happen)'' try to tweak following parameters: | Over there you will set inventory values which could be useful when i.e. taking single rounds (''which normally in the game doesn't happen)'' try to tweak following parameters: | ||
*'''Weight''' - weight of the cartridge in kilograms - in this case it was set to 22 grams - '''influences weight of the magazine''' | * '''Weight''' - weight of the cartridge in kilograms - in this case it was set to 22 grams - '''influences weight of the magazine''' | ||
*'''Size Setup Strategy''' - change it to '''Volume''' | * '''Size Setup Strategy''' - change it to '''Volume''' | ||
*'''Item Volume''' - set it up to your linking. 7 is a good starting point | * '''Item Volume''' - set it up to your linking. 7 is a good starting point | ||
*'''Size -''' change it to '''SLOT_1x1''' | * '''Size -''' change it to '''SLOT_1x1''' | ||
[[File:armareforger-new-weapon-ammo-inventory.png|frameless|557x557px]] | [[File:armareforger-new-weapon-ammo-inventory.png|frameless|557x557px]] | ||
===Ballistic Properties=== | === Ballistic Properties === | ||
====Formula==== | ==== Formula ==== | ||
[[File:armareforger-new-weapon-ammo-air-resistance.png|thumb|483x483px|https://archive.hnsa.org/doc/firecontrol/partc.htm]] | [[File:armareforger-new-weapon-ammo-air-resistance.png|thumb|483x483px|https://archive.hnsa.org/doc/firecontrol/partc.htm]] | ||
Bullets, just like in real life, are affected by | Bullets, just like in real life, are affected by {{Link|https://en.wikipedia.org/wiki/Drag_(physics)#Aerodynamics|air resistance}}. Simulating air resistance in a very realistic way is a very demanding task for the CPU - especially if you want to have firefights with hundreds of soldiers all with fully automatic weapons. Therefore, some compromises are necessary and the '''air drag''' in the game is calculated using the following formula: | ||
:<math>F=a/v^2*1/m</math> | :<math>F=a/v^2*1/m</math> | ||
Line 371: | Line 456: | ||
:<math>m</math> is the '''mass''' of the bullet | :<math>m</math> is the '''mass''' of the bullet | ||
====Setting Air Drag | ==== Setting Air Drag Parameter ==== | ||
Since the acceleration value is usually nowhere to be seen, you can try to set the correct value for '''air drag''' by guessing the value and seeing if it '''matches the data you already have'''. In this case, it is quite obvious that your first task in setting up ballistic properties will be to look for '''references''' and '''hard data'''. | Since the acceleration value is usually nowhere to be seen, you can try to set the correct value for '''air drag''' by guessing the value and seeing if it '''matches the data you already have'''. In this case, it is quite obvious that your first task in setting up ballistic properties will be to look for '''references''' and '''hard data'''. | ||
Try to match the '''bullet type''' and '''barrel length''' used for measurements to get the best results. In this case, '''Sample Weapon''' uses '''14.5 inch barrel''' and there is limited | Try to match the '''bullet type''' and '''barrel length''' used for measurements to get the best results. | ||
In this case, '''Sample Weapon''' uses '''14.5 inch barrel''' and there is limited {{Link|http://www.prvipartizan.com/search_rb.php?id{{=}}A-484|ballistic data available on ammo producer website}}. | |||
{| class="wikitable" | {| class="wikitable" | ||
!'''Range [m]''' | ! | ||
|0 | '''Range [m]''' | ||
|50 | | 0 | ||
|100 | | 50 | ||
|150 | | 100 | ||
|200 | | 150 | ||
|250 | | 200 | ||
|300 | | 250 | ||
| 300 | |||
|- | |- | ||
!'''Velocity [m/s]''' | ! | ||
|840 | '''Velocity [m/s]''' | ||
|802 | | 840 | ||
|765 | | 802 | ||
|730 | | 765 | ||
|695 | | 730 | ||
|661 | | 695 | ||
| 661 | |||
| 628 | | 628 | ||
|} | |} | ||
Line 402: | Line 490: | ||
Quite often though, the only data that is available is '''ballistic coefficient, speed or time''' it takes bullet to reach '''certain range'''. If you don't have those but at least have '''muzzle velocity''', '''weight''' and '''dimensions''' of the bullet, you can try to calculate '''ballistic coefficient''' yourself to get rough approximation of the value. | Quite often though, the only data that is available is '''ballistic coefficient, speed or time''' it takes bullet to reach '''certain range'''. If you don't have those but at least have '''muzzle velocity''', '''weight''' and '''dimensions''' of the bullet, you can try to calculate '''ballistic coefficient''' yourself to get rough approximation of the value. | ||
====Ballistic Coefficient==== | ==== Ballistic Coefficient ==== | ||
First, lets start with establishing what Ballistic Coefficient is. As per | First, lets start with establishing what Ballistic Coefficient is. As per {{Link|https://en.wikipedia.org/wiki/Ballistic_coefficient|Wikipedia}}: | ||
''In | ''In {{Link|https://en.wikipedia.org/wiki/Ballistics|ballistics}}, the '''ballistic coefficient''' ('''BC''', '''C<sub>b</sub>''') of a body is a measure of its ability to overcome air resistance in flight.'' | ||
If there is some '''BC''' (''ballistic coefficient)'' specified for bullet you are looking for, it will be most likely a | If there is some '''BC''' (''ballistic coefficient)'' specified for bullet you are looking for, it will be most likely a {{Link|https://en.wikipedia.org/wiki/Ballistic_coefficient#The_G_model|G model}} value. Beside '''BC''' in '''G model''', you would also need '''bullet weight, muzzle velocity''' and some '''ballistic calculator''' in order to prepare '''ballistic chart.''' | ||
There are bunch of online calculators which are capable of creating ballistic tables like: | There are bunch of online calculators which are capable of creating ballistic tables like: | ||
* | * {{Link|https://www.hornady.com/team-hornady/ballistic-calculators/#!/|Hornady ballistic calculator}} - provides quite good selection of customization | ||
* | * {{Link|https://www.federalpremium.com/ballistics-calculator|Fedral ballistic calculator}} - bit more simple but it still provides good data | ||
There is a lot of other calculators online too and you might already be using one of them. Above list though, contains calculators which are capable of providing data in '''metric system | There is a lot of other calculators online too and you might already be using one of them. Above list though, contains calculators which are capable of providing data in '''metric system''', which is quite handy when trying to match data '''game air drag.''' | ||
Additionally, you can also try using ''' | Additionally, you can also try using '''{{Link|https://www.bfxyz.nl/docs/bfxdownloads.shtml|Ballistics for Excel addon}}''', which allows you to customize a lot of parameters. | ||
=====Using G1 vs G7 ===== | ===== Using G1 vs G7 ===== | ||
Once you have decided which calculator you want to use, it is now necessary to decide which model should be used to create ballistic table, if i.e. both values for G1 and G7 are provided. | Once you have decided which calculator you want to use, it is now necessary to decide which model should be used to create ballistic table, if i.e. both values for G1 and G7 are provided. | ||
G1 and G7 refer both refer to aerodynamic drag models based on particular “standard projectile” shapes. The G1 shape looks like a flat-based bullet. The G7 shape is quite different, and better approximates the geometry of a modern long-range bullet. So, when choosing your drag model, G1 is preferable for flat-based bullets, while G7 is ordinarily a “better fit” for longer, boat-tailed bullets. | G1 and G7 refer both refer to aerodynamic drag models based on particular “standard projectile” shapes. The G1 shape looks like a flat-based bullet. The G7 shape is quite different, and better approximates the geometry of a modern long-range bullet. So, when choosing your drag model, G1 is preferable for flat-based bullets, while G7 is ordinarily a “better fit” for longer, boat-tailed bullets. | ||
====Creating | ==== Creating Ballistic Table ==== | ||
===== Online | ===== Online Calculator ===== | ||
Assuming you have found G7 BC for your bullet, you can use previously mentioned | Assuming you have found G7 BC for your bullet, you can use previously mentioned {{Link|https://www.hornady.com/team-hornady/ballistic-calculators/#!/|Hornady ballistic calculator}} to generate ballistic tables. On that page, fill following information: | ||
*Change unit system to '''metric''' | * Change unit system to '''metric''' | ||
*Type in ballistic coefficient ( in this case '''G7 BC is equal to 0.204 )''' | * Type in ballistic coefficient ( in this case '''G7 BC is equal to 0.204 )''' | ||
*Change '''velocity''' so it matches your bullet velocity - in this case it was set to '''840m/s''' | * Change '''velocity''' so it matches your bullet velocity - in this case it was set to '''840m/s''' | ||
*Adjust '''weight''' parameter so it matches bullet weight. '''Keep in mind this value is in | * Adjust '''weight''' parameter so it matches bullet weight. '''Keep in mind this value is in {{Link|https://en.wikipedia.org/wiki/Grain_(unit)|grains}}''' | ||
*Change '''drag coefficient''' so it matches ballistic coefficient of your bullet. In this example '''G7''' was used | * Change '''drag coefficient''' so it matches ballistic coefficient of your bullet. In this example '''G7''' was used | ||
Once its ready, you can click on '''Calculate''' button at the bottom of the page and after few seconds you should get ballistic table like one below. | Once its ready, you can click on '''Calculate''' button at the bottom of the page and after few seconds you should get ballistic table like one below. | ||
Line 446: | Line 534: | ||
! colspan="3" | Pressure | ! colspan="3" | Pressure | ||
! colspan="3" | Temperature C | ! colspan="3" | Temperature C | ||
! colspan="3" |Humidity | ! colspan="3" | Humidity | ||
|- | |- | ||
! | ! | ||
!''unit'' | ! | ||
|''Pascal'' | ''unit'' | ||
|''mmHg'' | | | ||
|''inHg'' | ''Pascal'' | ||
|''C'' | | | ||
|''F'' | ''mmHg'' | ||
|''K'' | | | ||
|''%'' | ''inHg'' | ||
|''kg/m3'' | | | ||
|''lb/ft3'' | ''C'' | ||
| | |||
''F'' | |||
| | |||
''K'' | |||
| | |||
''%'' | |||
| | |||
''kg/m3'' | |||
| | |||
''lb/ft3'' | |||
|- | |- | ||
! colspan="2" |ICAO | ! colspan="2" | ICAO | ||
|101324,6 | | 101324,6 | ||
| 760,00 | | 760,00 | ||
|29,92 | | 29,92 | ||
|15,00 | | 15,00 | ||
|59 | | 59 | ||
|288,15 | | 288,15 | ||
|0 | | 0 | ||
|1,22552 | | 1,22552 | ||
|0,076506 | | 0,076506 | ||
|- | |- | ||
! colspan="2" |US Army Standard Metro | ! colspan="2" | US Army Standard Metro | ||
|99991,8 | | 99991,8 | ||
|750,00 | | 750,00 | ||
|29,53 | | 29,53 | ||
|15,00 | | 15,00 | ||
|59 | | 59 | ||
|288,15 | | 288,15 | ||
|78 | | 78 | ||
|1,20333 | | 1,20333 | ||
|0,075121 | | 0,075121 | ||
|- | |- | ||
! colspan="2" |Mayeveski Ingalls | ! colspan="2" | Mayeveski Ingalls | ||
|101591,7 | | 101591,7 | ||
|762,00 | | 762,00 | ||
|30,00 | | 30,00 | ||
| 15,56 | | 15,56 | ||
|60 | | 60 | ||
| 288,71 | | 288,71 | ||
|67 | | 67 | ||
|1,22099 | | 1,22099 | ||
|0,076224 | | 0,076224 | ||
|} | |} | ||
=====Excel | ===== Excel Addon ===== | ||
Alternatively, if you want to use '''{{Link|https://www.bfxyz.nl/docs/bfxdownloads.shtml|Ballistics for Excel addon}}''', air drag calculator contains small section which utilizes this addon and creates ballistic table based on selected ballistic model & coefficient. | |||
Alternatively, if you want to use ''' | First, make sure that you have installed this addon as per instructions {{Link|https://www.bfxyz.nl/docs/bfxinstallandupdate.shtml|on this page}} and then download & open '''{{Link|https://github.com/BohemiaInteractive/Arma-Reforger-Misc/blob/main/Configuration/Weapons/Weapons_Ballistic_Coefs.xlsm|Weapons_Ballistic_Coefs.xlsm}}''' spreadsheet. | ||
This spreadsheet is using '''VBA''' macros to calculate '''air drag''' so when asked to enable them, please do so. | |||
{{Messagebox|You can always scan Weapons_Ballistic_Coefs.xlsm with antivirus to make sure it doesn't contain any malicious code.|✩|#88cc88}} | |||
{{Feature|warning|'''Ballistics for Excel addon''' doesn't work with i.e. '''Libre Office''' and it requires desktop version of '''Microsoft Excel'''. | |||
If you don't have it, consider using other online calculators.}} | |||
Once this spreadsheet is loaded, you would need to modify following fields: | Once this spreadsheet is loaded, you would need to modify following fields: | ||
*'''Muzzle velocity''' - in '''m/s''' | * '''Muzzle velocity''' - in '''m/s''' | ||
*'''Ballistic Model''' - plugin accepts model from '''G1 to G8''' | * '''Ballistic Model''' - plugin accepts model from '''G1 to G8''' | ||
*'''Ballistic Coef - ballistic coefficient''' value in selected model | * '''Ballistic Coef - ballistic coefficient''' value in selected model | ||
Optionally, you can also change interval at which data will be calculated by changing '''Interval''' parameter ''(in meters)''. | Optionally, you can also change interval at which data will be calculated by changing '''Interval''' parameter ''(in meters)''. | ||
Line 508: | Line 610: | ||
[[File:armareforger-new-weapon-ammo-sheet-calc-1.png]] | [[File:armareforger-new-weapon-ammo-sheet-calc-1.png]] | ||
====Air | ==== Air Drag Calculation ==== | ||
Once you have ballistic table, it will be time to utilize excel spreadsheet to guesstimate correct '''air drag''' value. To do so, download & open spreadsheet | Once you have ballistic table, it will be time to utilize excel spreadsheet to guesstimate correct '''air drag''' value. | ||
To do so, download & open spreadsheet {{Link|https://github.com/BohemiaInteractive/Arma-Reforger-Misc/blob/main/Configuration/Weapons/Weapons_Ballistic_Coefs.xlsm|Weapons_Ballistic_Coefs.xlsm}} and enable '''macros''' - this spreadsheet is using '''VBA script''' to calculate values of air drag at selected range.{{Messagebox|This spreadsheet '''works in {{Link|https://www.libreoffice.org/download/download-libreoffice/|Libre Office}}'''. Don't forget to enable macros in the settings (<code>Tools > Options > LibreOffice > Security > Macro Security</code> ) if you are using it.|✩|#88cc88}} | |||
After file is opened, start with typing basic data like '''Muzzle Velocity''' ''(in m/s)'' and '''Mass''' ''(in kg)'' of the bullet. Next, fill in data in '''data from firing tables''' columns according to what you have available at hand. You can also adjust '''Interval''' value to better match the source data. | After file is opened, start with typing basic data like '''Muzzle Velocity''' ''(in m/s)'' and '''Mass''' ''(in kg)'' of the bullet. Next, fill in data in '''data from firing tables''' columns according to what you have available at hand. You can also adjust '''Interval''' value to better match the source data. | ||
Line 527: | Line 630: | ||
Since air friction works in bit simplified way compared to real world (or even ''G1'' or ''G7'' ballistic models) it will be necessary to do some compromises. Discrepancies between real life data and what can be achieved in game are especially visible for machine gun ammo above 1km. While it might not sound like a big problem for infantry used weapons, it can for instance prevent from using '''real life reticles''' on '''tanks or APCs''', since '''discrepancy between their ballistic in-game and reticle will be noticeable'''. | Since air friction works in bit simplified way compared to real world (or even ''G1'' or ''G7'' ballistic models) it will be necessary to do some compromises. Discrepancies between real life data and what can be achieved in game are especially visible for machine gun ammo above 1km. While it might not sound like a big problem for infantry used weapons, it can for instance prevent from using '''real life reticles''' on '''tanks or APCs''', since '''discrepancy between their ballistic in-game and reticle will be noticeable'''. | ||
After fiddling a little bit with '''Air Drag''' value you should get values matching '''firing tables | After fiddling a little bit with '''Air Drag''' value you should get values matching '''firing tables'''. In this case '''Air Drag''' with value '''0.00007''' seems to match real life equivalent of the bullet quite nicely, therefore we will assign such number to '''Air Drag''' property in '''General''' section of '''ShellMoveComponent''' in bullet prefab. | ||
Next, adjust the '''Mass''' parameter in the '''Movement Config''' section of the '''ShellMoveComponent''' and set it to match the weight of the bullet - in this case it was set to '''0.0071''' ''[kG]''. | Next, adjust the '''Mass''' parameter in the '''Movement Config''' section of the '''ShellMoveComponent''' and set it to match the weight of the bullet - in this case it was set to '''0.0071''' ''[kG]''. | ||
Line 533: | Line 636: | ||
Weapon ballistics data | Weapon ballistics data | ||
====Barrel | ==== Barrel Length vs Muzzle Velocity ==== | ||
Ballistic data for bullet that we picked was measured on weapon with '''24 inch''' long barrel, while the '''Sample Weapon''' is using '''14.5 inch barrel | Ballistic data for bullet that we picked was measured on weapon with '''24 inch''' long barrel, while the '''Sample Weapon''' is using '''14.5 inch barrel'''. | ||
In general, the shorter barrel is, the lower muzzle velocity is. Of course, this effect is not always linear and in case of some bullets, the muzzle velocity might slightly drop after reaching certain length so it is best to try gathering some source data for particular bullet type. For instance on '''{{Link|http://ballisticsbytheinch.com/calibers.html|Ballistic By The Inch}}''' page you can find data about many different calibers available on the market. | |||
Getting back to 6.5 Grendel ammo, on following page - https://www.gunbuilders.com/blog/the-65-grendel-ar15-build-guide<nowiki/>/ - you can find data for | Getting back to 6.5 Grendel ammo, on following page - https://www.gunbuilders.com/blog/the-65-grendel-ar15-build-guide<nowiki/>/ - you can find data for {{Link|https://www.hornady.com/bullets/rifle/6-5mm-264-129-gr-sst#!/|6.5 Grendel 129 grain Hornady}} bullet. | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
!Barrel length [inch] | ! Barrel length [inch] | ||
!Velocity [m/s] | ! Velocity [m/s] | ||
|- | |- | ||
|14.5 | | 14.5 | ||
|682 | | 682 | ||
|- | |- | ||
|16 | | 16 | ||
|704 | | 704 | ||
|- | |- | ||
|20 | | 20 | ||
|728 | | 728 | ||
|- | |- | ||
|24 | | 24 | ||
| 752 | | 752 | ||
|} | |} | ||
Line 557: | Line 661: | ||
Now, there are two approaches how to set it in data: | Now, there are two approaches how to set it in data: | ||
*Reduce '''Init Speed''' in '''ShellMoveComponent''' of bullet itself by 9% (''to 764m/s'') and leave '''Muzzle Init Speed Coef''' in '''MuzzleComponent''' of weapon unchanged ''(1.0)''. | * Reduce '''Init Speed''' in '''ShellMoveComponent''' of bullet itself by 9% (''to 764m/s'') and leave '''Muzzle Init Speed Coef''' in '''MuzzleComponent''' of weapon unchanged ''(1.0)''. | ||
*Set '''Init Speed''' in '''ShellMoveComponent''' to value matching '''24 inch barrel''' ''(840/ms)'' and reduce '''Muzzle Init Speed Coef''' in '''MuzzleComponent''' of weapon to '''0.91''', so bullet leaves this weapon with lower velocity (''~764m/s''). | * Set '''Init Speed''' in '''ShellMoveComponent''' to value matching '''24 inch barrel''' ''(840/ms)'' and reduce '''Muzzle Init Speed Coef''' in '''MuzzleComponent''' of weapon to '''0.91''', so bullet leaves this weapon with lower velocity (''~764m/s''). | ||
Both solutions have pros and cons and its worth to think which weapon should be used as baseline for different barrel calculations. For instance M16A2 (20 inch barrel) is quite often used as baseline for 5.56 ballistic and because of that, it might be worth to use this as a base and i.e. reduce '''Muzzle Init Speed Coef''' on your 14.5 inch '''M4''' rifle. If there are some community mods which could potentially use, then perhaps check if someone tried to establish some standards already. | Both solutions have pros and cons and its worth to think which weapon should be used as baseline for different barrel calculations. For instance M16A2 (20 inch barrel) is quite often used as baseline for 5.56 ballistic and because of that, it might be worth to use this as a base and i.e. reduce '''Muzzle Init Speed Coef''' on your 14.5 inch '''M4''' rifle. If there are some community mods which could potentially use, then perhaps check if someone tried to establish some standards already. | ||
Since in this case, it's rather unlikely anyone would use this semi fictional 6.5x39mm round and also because of the fact, that 14'''.5 inch barrel was also base line for 6.5x39 weapon in Arma 3''', '''first method''' was picked and '''Init Speed''' | Since in this case, it's rather unlikely anyone would use this semi fictional 6.5x39mm round and also because of the fact, that 14'''.5 inch barrel was also base line for 6.5x39 weapon in Arma 3''', '''first method''' was picked and '''Init Speed''' | ||
Since there is no concrete data about penetration of reference 6.5 Grendel bullet, M855A1 penetration properties are used as reference. By checking {{Link|https://en.wikipedia.org/wiki/5.56%C3%9745mm_NATO|Wikipedia article about 5.56x45 ammunition}}, we can see that M855A1 can penetrate 9.5 mm of mild steel at 350 meter. Now, to translate this into game, few steps are necessary like: | |||
Since there is no concrete data about penetration of reference 6.5 Grendel bullet, M855A1 penetration properties are used as reference. By checking | |||
* Checking density of target material and how it matches materials present in game | * Checking density of target material and how it matches materials present in game | ||
Line 574: | Line 677: | ||
When bullet hits for instance an metal plate in game, there are two major variables which influences whether bullet will pass through such object or not - its '''bullet penetration ability''' and '''material resistance'''. | When bullet hits for instance an metal plate in game, there are two major variables which influences whether bullet will pass through such object or not - its '''bullet penetration ability''' and '''material resistance'''. | ||
'''Penetration ability of the bullet''' is configured in '''ShellMoveComponent''' and | '''Penetration ability of the bullet''' is configured in '''ShellMoveComponent''' and is calculated using the following formula: | ||
{{Feature|informative|Penetration Ability {{=}} Penetration Depth * Penetration Density / Penetration Speed}} | |||
After filling values in above parameters inside of '''ShellMoveComponent''' you click on that component with '''Right Mouse Button''' and select from context menu '''Show penetration config''' option. | After filling values in above parameters inside of '''ShellMoveComponent''' you click on that component with '''Right Mouse Button''' and select from context menu '''Show penetration config''' option. Once this is done, penetration ability of the bullet will be printed in '''Log Console''' window. | ||
'''Material resistance''' on the other hand is linked to the | '''Material resistance''' on the other hand is linked to the [[Arma Reforger:FBX Import|collider]] & '''game material''' ''(which is described bit more in detail below)'' that is used on it. | ||
The following formula is used to calculate material resistance: | |||
{{Feature|informative| | |||
Material resistance {{=}} Thickness * Density * Penetration Resistance / Penetration Ability | |||
}} | |||
Now, if impact '''speed of bullet is larger than material resistance''', then '''bullet will penetrate''' such object - otherwise it is assumed that projectile was stopped by the obstacle. | Now, if impact '''speed of bullet is larger than material resistance''', then '''bullet will penetrate''' such object - otherwise it is assumed that projectile was stopped by the obstacle. | ||
==== Game | ==== Game Materials ==== | ||
'''Game materials''' contain information about '''material density''', their '''coefficient versus kinetic and chemical projectiles''' and sometimes they can also have '''thickness overrides''' inside of them. | '''Game materials''' contain information about '''material density''', their '''coefficient versus kinetic and chemical projectiles''' and sometimes they can also have '''thickness overrides''' inside of them. | ||
If '''Thickness Override''' is set to '''None | If '''Thickness Override''' is set to '''None''', then penetration is calculated by measuring actual thickness of the collider (including {{Link|https://en.wikipedia.org/wiki/Sloped_armour|slope effect}}). If '''Thickness Override''' is enabled, then one of the following situations might happen depending on settings which was selected: | ||
* '''Min''' - Thickness of the collider is used but it's capped to the value specified '''Thickness''' parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but '''Thickness''' is set 5mm, then game will use 5mm in '''material resistance''' calculations. In same situation but with collider being '''2mm''' thick visually, game would use '''2mm''' in material resistance calculations since this value is | * '''Min''' - Thickness of the collider is used but it's capped to the value specified '''Thickness''' parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but '''Thickness''' is set 5mm, then game will use 5mm in '''material resistance''' calculations. In same situation but with collider being '''2mm''' thick visually, game would use '''2mm''' in material resistance calculations since this value is {{Link|https://en.cppreference.com/w/c/numeric/math/fmin|smaller from two values which are compared}}. | ||
* '''Max -''' Thickness of the collider is used but minimal thickness of this object is equal to '''Thickness''' parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but '''Thickness''' is set 5mm, then game will use 25mm in '''material resistance''' calculations. In same situation but with collider being '''2mm''' thick visually, game would use '''5mm''' in material resistance calculations since this value is | * '''Max -''' Thickness of the collider is used but minimal thickness of this object is equal to '''Thickness''' parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but '''Thickness''' is set 5mm, then game will use 25mm in '''material resistance''' calculations. In same situation but with collider being '''2mm''' thick visually, game would use '''5mm''' in material resistance calculations since this value is {{Link|https://en.cppreference.com/w/c/numeric/math/fmax|larger from two values which are compared}}. | ||
* '''Clamp -''' Returns value '' | * '''Clamp -''' Returns value ''{{Link|https://en.cppreference.com/w/cpp/algorithm/clamp|clamped}}'' to the inclusive range of min and max | ||
* '''Value -''' Game is using exact value as specified in '''Thickness''' in material resistance calculations | * '''Value -''' Game is using exact value as specified in '''Thickness''' in material resistance calculations | ||
<gallery widths="307" heights="159"> | <gallery widths="307" heights="159"> | ||
Line 603: | Line 711: | ||
Below is small table showing density and penetration resistance coefficients.{{Feature|informative|Kinetic and chemical penetration coefficients is often refereed as '''Kinetic Energy (KE)''' or '''Chemical Energy (CE)''' coefficients}} | Below is small table showing density and penetration resistance coefficients.{{Feature|informative|Kinetic and chemical penetration coefficients is often refereed as '''Kinetic Energy (KE)''' or '''Chemical Energy (CE)''' coefficients}} | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
!Material | ! Material | ||
!Density [g/cm^3] | ! Density [g/cm^3] | ||
!KE | ! KE | ||
!CE | ! CE | ||
|- | |- | ||
| | | | ||
|7.860 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/armor.gamemat|Armor (RHA)}} | ||
|1 | | 7.860 | ||
|1 | | 1 | ||
| 1 | |||
|- | |- | ||
| | | | ||
|7.870 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/metal.gamemat|Metal}} | ||
|0.6 | | 7.870 | ||
|0.6 | | 0.6 | ||
| 0.6 | |||
|- | |- | ||
| | | | ||
|7.870 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/iron_cast.gamemat|Iron Cast}} | ||
|0.6 | | 7.870 | ||
|0.6 | | 0.6 | ||
| 0.6 | |||
|- | |- | ||
| | | | ||
|2.700 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/metal_sheet.gamemat|Metal Sheet}} | ||
|0.5 | | 2.700 | ||
|0.5 | | 0.5 | ||
| 0.5 | |||
|- | |- | ||
| | | | ||
|0.650 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/wood.gamemat|Wood}} | ||
|0.7 | | 0.650 | ||
|1 | | 0.7 | ||
| 1 | |||
|- | |- | ||
| | | | ||
|1.922 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/brick.gamemat|Brick}} | ||
|0.8 | | 1.922 | ||
|0.8 | | 0.8 | ||
| 0.8 | |||
|- | |- | ||
| | | | ||
|2.300 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/concrete.gamemat|Concrete}} | ||
|1 | | 2.300 | ||
|1 | | 1 | ||
| 1 | |||
|- | |- | ||
| | | | ||
|2.6 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/glass.gamemat|Glass}} | ||
|1.4 | | 2.6 | ||
|1 | | 1.4 | ||
| 1 | |||
|- | |- | ||
| | | | ||
|5.700 | {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/glass_armored.gamemat|Glass Armored}} | ||
|2 | | 5.700 | ||
|1 | | 2 | ||
| 1 | |||
|} | |} | ||
==== | ==== Penetration Data Calculation ==== | ||
Armor game material reflects ''' | Armor game material reflects '''{{Link|https://en.wikipedia.org/wiki/Rolled_homogeneous_armour|rolled homogeneous armor}}''' and serves as a baseline for penetration calculation. Because of that, there are few approaches how to translate 9.5mm of mild steel into game value: | ||
* Try to find a material which would fill description of mild steel that was used in such test | * Try to find a material which would fill description of mild steel that was used in such test | ||
Line 665: | Line 781: | ||
In this case we are going with second method which is trying to convert mild steel to RHA. Metal game materials can already be considered a kind of regular steel and it is using 0.6 coefficient compared to RHA material. Since we are using M855A1 as reference we will convert 9.5mm mild steel into RHA. After multiplying 9.5 by previously mentioned '''RHA coefficient - 0.6''', we will get that '''5.7mm of RHA is equivalent''' of 9.5mm mild steel plate. | In this case we are going with second method which is trying to convert mild steel to RHA. Metal game materials can already be considered a kind of regular steel and it is using 0.6 coefficient compared to RHA material. Since we are using M855A1 as reference we will convert 9.5mm mild steel into RHA. After multiplying 9.5 by previously mentioned '''RHA coefficient - 0.6''', we will get that '''5.7mm of RHA is equivalent''' of 9.5mm mild steel plate. | ||
Next, we need to calculate speed of the bullet at 350 meters which were mentioned on Wiki. Furthermore, we want to achieve 9.5mm at 350m performance when firing round from '''14.5 inch barrel of Sample New Weapon.''' | Next, we need to calculate speed of the bullet at 350 meters which were mentioned on Wiki. Furthermore, we want to achieve 9.5mm at 350m performance when firing round from '''14.5 inch barrel of Sample New Weapon.''' | ||
To do so, we will '''adjust muzzle velocity in ballistic chart''' that we generated before and see what '''speed it has at 350 meters.''' | To do so, we will '''adjust muzzle velocity in ballistic chart''' that we generated before and see what '''speed it has at 350 meters.''' | ||
Line 675: | Line 791: | ||
After ballistic chart is recalculated, it is possible to write down speed of the bullet - '''538m/s'''. Now, we should have all the information to fill in '''Penetration''' section of '''ShelMoveComponent''' in '''Ammo_65x39_FMJBT''' prefab : | After ballistic chart is recalculated, it is possible to write down speed of the bullet - '''538m/s'''. Now, we should have all the information to fill in '''Penetration''' section of '''ShelMoveComponent''' in '''Ammo_65x39_FMJBT''' prefab : | ||
* '''Penetration Depth''' should be set to '''5.7''' ''[mm]'' | * '''Penetration Depth''' should be set to '''5.7''' ''[mm]'' | ||
* '''Penetration Density''' should be set to '''7.860''' ''[g/cm^3]'' - this is the density of RHA material - | * '''Penetration Density''' should be set to '''7.860''' ''[g/cm^3]'' - this is the density of RHA material - {{Link|enfusion://ResourceManager/~ArmaReforger:Common/Materials/Game/armor.gamemat|armor.gamemat}} | ||
* '''Penetration Speed''' should bet set to '''538''' ''[m/s] -'' at this speed bullet will penetrate 5.7mm of RHA plate | * '''Penetration Speed''' should bet set to '''538''' ''[m/s] -'' at this speed bullet will penetrate 5.7mm of RHA plate | ||
Line 683: | Line 799: | ||
If everything went fine, you could verify penetration of your weapon on some test map and check how it performs versus various target with '''Game Code → Projectiles → Show shell trajectory''' debug turned on. One of the Grendel advantages is its good performance at higher ranger compared to i.e. 5.56x45 round and this should be quite visible in game too. | If everything went fine, you could verify penetration of your weapon on some test map and check how it performs versus various target with '''Game Code → Projectiles → Show shell trajectory''' debug turned on. One of the Grendel advantages is its good performance at higher ranger compared to i.e. 5.56x45 round and this should be quite visible in game too. | ||
==== Extra | ==== Extra Things ==== | ||
'''Init Speed Variation''' - in real life bullets are not leaving barrel at precisely same speed and there is some variation with than. For rifles, usually difference is +/- 10m/s and as can it be seen with AK74, where most sources are claiming muzzle velocity of 880m/s and Soviet official ballistic firing tables are calculated for 900m/s. In this case, truth most likely lies in between and 880m/s is minimal observed muzzle velocity and 900m/s is maximal one. In this case, you should set '''Init Speed''' to middle value (890m/s) and configure '''Init Speed Variation''' to 10m/s | '''Init Speed Variation''' - in real life bullets are not leaving barrel at precisely same speed and there is some variation with than. For rifles, usually difference is +/- 10m/s and as can it be seen with AK74, where most sources are claiming muzzle velocity of 880m/s and Soviet official ballistic firing tables are calculated for 900m/s. In this case, truth most likely lies in between and 880m/s is minimal observed muzzle velocity and 900m/s is maximal one. In this case, you should set '''Init Speed''' to middle value (890m/s) and configure '''Init Speed Variation''' to 10m/s | ||
'''Dispersion Multiplier -''' this parameter controls dispersion of the bullet living the barrel and can be for example used to simulate precision munition variants like 7.62x54R 7N1 rounds, which are more precise variants of 7.62x54R When trying to simulate more precise ammunition, it is good to combine '''Dispersion Multiplier''' parameter with reduced '''Init Speed Variation'''. | '''Dispersion Multiplier -''' this parameter controls dispersion of the bullet living the barrel and can be for example used to simulate precision munition variants like 7.62x54R 7N1 rounds, which are more precise variants of 7.62x54R When trying to simulate more precise ammunition, it is good to combine '''Dispersion Multiplier''' parameter with reduced '''Init Speed Variation'''. | ||
=== Tracer projectiles === | === Tracer Projectiles === | ||
Tracer projectiles can be created in 3 ways: | |||
* Creating new '''TracerProjectile''' entity via '''Create''' tab in '''World Editor''' and filling all the data manually | |||
* Creating inherited prefab from {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_BulletTracer_Base.et|Ammo_BulletTracer_Base.et}} | |||
* Inheriting from some '''existing bullet prefab''' and '''changing entity type in text editor''' | |||
First method is not really recommended since it most likely will be quite difficult to maintain such file. There might be some use cases for it though, if you are creating Sci-fi equipment. | |||
==== Base Tracer Prefab Inheritance ==== | |||
Second method is recommended method although it might require setting some parameters again, like '''Init Speed''', '''Air Drag''', penetration and so on. Tracer bullets are quite often designed in a way, that they have very similar ballistic properties to regular bullets of selected rifle, so they can be used with same optics or iron sights. | |||
To create such prefab, simply use [[Arma Reforger:Data Modding Basics#Using .22Inherit in....22 function|Inherit in]] option on {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_BulletTracer_Base.et|Ammo_BulletTracer_Base.et}} and call that new bullet i.e. ''Ammo_65x39_FMJBT_Tracer.et.'' If you are using this method, you can skip to tracer projectile configuration chapter. | |||
==== Entity Type Change ==== | |||
The third method is used on most vanilla bullets and while in this method, you just inherit all ballistic properties of standard bullet, it requires '''tinkering with text editor''' outside of '''Workbench.''' | |||
First, start by [[Arma Reforger:Prefabs Basics#Creating inherited prefab|creating new inherited prefab]] from basic round of your choice - in this case it would be Ammo_65x39_FMJBT prefab. | |||
[[File:armareforger-new-weapon-tracer-ammo.gif]] | |||
==== Tracer Projectile Configuration ==== | |||
Once you have tracer prefab prepared, there will be still few parameters to configure like | |||
* '''Tracer Burn Start After''' - type here '''time in seconds''' when tracer is supposed to '''start burning'''. Quite often specs of the bullet are starting distance, instead of time, but using spreadsheet from [[Arma Reforger:Weapon Creation/Prefab Configuration#Air drag calculation|air drag calculations]] chapter, you can estimate roughly estimate that time. | |||
* '''Tracer Burn Time - duration in seconds''' when tracer should be '''burning'''. | |||
* '''Projectile Model -''' model of the tracer. There are already few models of tracers available - all of them with different color - which can be used here: | |||
** {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Tracers/Tracer_red.xob|Tracer_red.xob}} | |||
** {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Tracers/Tracer_yellow.xob|Tracer_yellow.xob}} | |||
** {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Tracers/Tracer_white.xob|Tracer_white.xob}} | |||
** {{Link|enfusion://ResourceManager/~ArmaReforger:Assets/Weapons/Ammo/Tracers/Tracer_green.xob|Tracer_green.xob}} | |||
If you want and have available data, you can also type specific values for tracer bullet like different init speed, mass or penetrability. | |||
=== Damage === | |||
Kinetic damage is currently automatically calculated via following formula: | |||
Kinetic damage is currently automatically calculated via following formula:{{Feature|informative| | {{Feature|informative|Damage {{=}} Diameter * Penetration Ability * Init Speed}} | ||
where '''Penetration Ability''' is '''bullet penetration ability (described in penetration segment), Diameter''' is a parameter inside '''ShellMoveComponent''' inside '''General''' section & '''Init Speed''' is initial speed of the bullet. This value can be previewed by using '''Show penetration config''' available in context menu after clicking with '''RMB''' on '''ShellMoveComponent.''' | |||
Example output '''Show penetration config''' 6.5x39mm FMJBT bullet<syntaxhighlight lang="c"> | Example output '''Show penetration config''' 6.5x39mm FMJBT bullet<syntaxhighlight lang="c"> | ||
DEFAULT | DEFAULT : PenetrationDepth: 5.700 | ||
DEFAULT | DEFAULT : PenetrationDensity: 7.860 | ||
DEFAULT | DEFAULT : PenetrationSpeed: 538.000 | ||
DEFAULT | DEFAULT : PenetrationAbility: 0.083 | ||
DEFAULT | DEFAULT : DamageValue: 114.049 | ||
</syntaxhighlight>{{Feature|informative|Damage simulation is subject to change}} | </syntaxhighlight>{{Feature|informative|Damage simulation is subject to change}} | ||
===AI | === AI Target Selection === | ||
AI relies on '''AICombatPropertiesComponent''' to select a target and the weapon. Not having this on equipment will prevent AI from using that equipment. | AI relies on '''AICombatPropertiesComponent''' to select a target and the weapon. Not having this on equipment will prevent AI from using that equipment. | ||
====Usage==== | ==== Usage ==== | ||
'''AICombatPropertiesComponent''' must be attached to: | '''AICombatPropertiesComponent''' must be attached to: | ||
*Magazine prefabs | * Magazine prefabs | ||
*Grenade prefabs - it is only relevant for grenades which can be used by AI to attack a target - e.g smoke grenades don't require it | * Grenade prefabs - it is only relevant for grenades which can be used by AI to attack a target - e.g smoke grenades don't require it | ||
*UGL grenade prefabs | * UGL grenade prefabs | ||
*Rocket prefabs | * Rocket prefabs | ||
Note that weapons do not need the AICombatProperties component except for throwable grenades. | Note that weapons do not need the AICombatProperties component except for throwable grenades. | ||
Line 717: | Line 869: | ||
Most likely base prefabs of such equipment already have this component. | Most likely base prefabs of such equipment already have this component. | ||
====Weapon & Target Selection==== | ==== Weapon & Target Selection ==== | ||
AI weapon & target selection algorithm evaluates all known targets and all available weapons and magazines available to an AI soldier. Then it selects best target, weapon and magazine for attack. | AI weapon & target selection algorithm evaluates all known targets and all available weapons and magazines available to an AI soldier. Then it selects best target, weapon and magazine for attack. | ||
This evaluation takes into account multiple parameters of target and weapon. | This evaluation takes into account multiple parameters of target and weapon. | ||
*Target parameters: distance to target, target type, target priority, is target aiming at us, is target in cover. | * Target parameters: distance to target, target type, target priority, is target aiming at us, is target in cover. | ||
*Weapon parameters: can this be used against that target type, priority of this weapon compared to other available weapons, min range of the weapon (relevant for rockets and grenades). | * Weapon parameters: can this be used against that target type, priority of this weapon compared to other available weapons, min range of the weapon (relevant for rockets and grenades). | ||
Also AI separate their targets into those which they can attack '''directly''' and those which they can attack '''indirectly. Indirect''' attack means that we don't have to hit the target precisely to cause damage, for instance think of a frag grenade or rocket. Targets available for indirect attack are currently those which we have lost behind cover, but didn't totally forget about. The '''Direct''' attack means that we see the target and can shoot it directly. | Also AI separate their targets into those which they can attack '''directly''' and those which they can attack '''indirectly. Indirect''' attack means that we don't have to hit the target precisely to cause damage, for instance think of a frag grenade or rocket. Targets available for indirect attack are currently those which we have lost behind cover, but didn't totally forget about. The '''Direct''' attack means that we see the target and can shoot it directly. | ||
====Properties==== | ==== Properties ==== | ||
*'''Used Against''' - most important property. It specifies against which target types this equipment can be used. Example: AK-74 magazine is configured to be used against infantry and unarmored vehicles. | * '''Used Against''' - most important property. It specifies against which target types this equipment can be used. Example: AK-74 magazine is configured to be used against infantry and unarmored vehicles. | ||
*'''Priority''' - priority value of this equipment. If all other properties are same, AI will choose the equipment with highest priority. | * '''Priority''' - priority value of this equipment. If all other properties are same, AI will choose the equipment with highest priority. | ||
*'''Priority Against Vehicles''' - priority of this equipment against vehicles. If the default value is used, it will have same priority against vehicles as against infantry. | * '''Priority Against Vehicles''' - priority of this equipment against vehicles. If the default value is used, it will have same priority against vehicles as against infantry. | ||
*'''Indirectly Used Against''' - specifies against which target types AI will prefer to use the weapon for '''indirect attacks'''. Example: grenades are configured to be used indirectly against infantry. | * '''Indirectly Used Against''' - specifies against which target types AI will prefer to use the weapon for '''indirect attacks'''. Example: grenades are configured to be used indirectly against infantry. | ||
====Priority Values==== | ==== Priority Values ==== | ||
The minimal requirement is that priority values must make sense for all equipment combinations available for AI in generic case. | The minimal requirement is that priority values must make sense for all equipment combinations available for AI in generic case. | ||
For example, if in our faction we don't have an AI soldier carrying both PKP and M249 at the same time, it makes no sense to think which one the AI should use first, and which one should have higher priority. | For example, if in our faction we don't have an AI soldier carrying both PKP and M249 at the same time, it makes no sense to think which one the AI should use first, and which one should have higher priority. | ||
Line 745: | Line 897: | ||
If you do not know what priority value to use, please refer to values on existing comparable magazine/weapon prefabs. We can't quote recommended values here because they might change. | If you do not know what priority value to use, please refer to values on existing comparable magazine/weapon prefabs. We can't quote recommended values here because they might change. | ||
====Examples==== | ==== Examples ==== | ||
{| class="wikitable" | {| class="wikitable" | ||
!Type | ! Type | ||
!Prefab | ! Prefab | ||
!Comment | ! Comment | ||
|- | |- | ||
|Generic Rifle Magazine | | Generic Rifle Magazine | ||
|{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Magazine_Base.et|Magazine_Base.et}} | | | ||
{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Magazine_Base.et|Magazine_Base.et}} | |||
| | | | ||
|- | |- | ||
|Frag Grenade | | Frag Grenade | ||
|{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/FragGrenade_Base.et|FragGrenade_Base.et}} | | | ||
|It has a small priority, it is configured to be used for indirect attacks. AI decides to use the grenade against targets which hide behind cover. | {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/FragGrenade_Base.et|FragGrenade_Base.et}} | ||
| It has a small priority, it is configured to be used for indirect attacks. AI decides to use the grenade against targets which hide behind cover. | |||
|- | |- | ||
|UGL Grenade | | UGL Grenade | ||
|{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_GrenadeLauncher_Base.et|Ammo_GrenadeLauncher_Base.et}} | | | ||
|It also has small priority, but higher than normal grenade. It has higher priority against vehicles. Like the frag grenade, it's configured for indirect attacks, but only against infantry. | {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_GrenadeLauncher_Base.et|Ammo_GrenadeLauncher_Base.et}} | ||
| It also has small priority, but higher than normal grenade. It has higher priority against vehicles. Like the frag grenade, it's configured for indirect attacks, but only against infantry. | |||
|- | |- | ||
|Armor-Piercing Rocket | | Armor-Piercing Rocket | ||
|{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_Rocket_Base.et|Ammo_Rocket_Base.et}} | | | ||
{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Ammo_Rocket_Base.et|Ammo_Rocket_Base.et}} | |||
| | | | ||
|- | |- | ||
|LMG/HMG APC turret ammo | | LMG/HMG APC turret ammo | ||
|{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Magazines/Box_762x54_PK_250rnd_Base.et|Box_762x54_PK_250rnd_Base.et}}<br> | | | ||
{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Magazines/Box_762x54_PK_250rnd_Base.et|Box_762x54_PK_250rnd_Base.et}}<br> | |||
{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Magazines/Box_145x114_KPVT_50rnd_Base.et|Box_145x114_KPVT_50rnd_Base.et}} | {{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Magazines/Box_145x114_KPVT_50rnd_Base.et|Box_145x114_KPVT_50rnd_Base.et}} | ||
|HMG magazine priority against infantry is smaller than LMG magazine priority to make AI prefer LMG against infantry. | | HMG magazine priority against infantry is smaller than LMG magazine priority to make AI prefer LMG against infantry. | ||
|} | |} | ||
=== AI | === AI Ballistic Tables === | ||
As describe in [[Arma Reforger:Weapon Modding#New Ammo AI Config|Weapon Modding]] tutorial, there is still one important thing to do when creating new ammo type - generation of '''AI Ballistic Tables'''. Those tables are used by AI soldiers to estimate how much they need to adjust their weapon to hit desired target. Details of the setting AI tables are described on previously mentioned [[Arma Reforger:Weapon Modding#New Ammo AI Config|Weapon Modding]] tutorial so here is short version of what is necessary to create and configure such tables: | As describe in [[Arma Reforger:Weapon Modding#New Ammo AI Config|Weapon Modding]] tutorial, there is still one important thing to do when creating new ammo type - generation of '''AI Ballistic Tables'''. Those tables are used by AI soldiers to estimate how much they need to adjust their weapon to hit desired target. Details of the setting AI tables are described on previously mentioned [[Arma Reforger:Weapon Modding#New Ammo AI Config|Weapon Modding]] tutorial so here is short version of what is necessary to create and configure such tables: | ||
Line 779: | Line 937: | ||
** When asked about type of config, select '''BallisticTableArray''' | ** When asked about type of config, select '''BallisticTableArray''' | ||
** It is recommended to use AIBT_''nameOfAmmoPrefab.conf'' name for ballistic tables - i.e. '''AIBT_65x39_FMJBT.conf''' | ** It is recommended to use AIBT_''nameOfAmmoPrefab.conf'' name for ballistic tables - i.e. '''AIBT_65x39_FMJBT.conf''' | ||
* Open ammo prefab and in '''ShellMoveComponent''' locate '''Ballistic Table Config''' parameter in '''Ballisitc Tables''' section | * Open ammo prefab and in '''ShellMoveComponent''' locate '''Ballistic Table Config''' parameter in '''Ballisitc Tables''' section | ||
** Assign AIBT ''(AIBT_65x39_FMJBT.conf)'' config to '''Ballistic Table Config proper''' & save prefab | ** Assign AIBT ''(AIBT_65x39_FMJBT.conf)'' config to '''Ballistic Table Config proper''' & save prefab | ||
* Click on '''ShellMoveComponent''' with '''Right Mouse Button''' and from context menu select '''Generate ballistic tables''' option | * Click on '''ShellMoveComponent''' with '''Right Mouse Button''' and from context menu select '''Generate ballistic tables''' option | ||
** Whole process might take few seconds depending on air drag value of the bullet - higher values tend to result in higher computing times | ** Whole process might take few seconds depending on air drag value of the bullet - higher values tend to result in higher computing times | ||
** Once process is complete, save changes in '''World Editor''' by i.e. '''Ctrl | ** Once process is complete, save changes in '''World Editor''' by i.e. '''{{Controls|Ctrl|S}}''' combo | ||
[[File:armareforger-new-weapon-generating-ai-bt.gif]] | [[File:armareforger-new-weapon-generating-ai-bt.gif]] | ||
==Magazine Well== | |||
== Magazine Well == | |||
Magazine wells are classes which help to establish multi weapon (and mods) magazine compatibility. Any magazine which is using the selected class will be usable in any other weapon, which is using exactly the same magazine well. | Magazine wells are classes which help to establish multi weapon (and mods) magazine compatibility. Any magazine which is using the selected class will be usable in any other weapon, which is using exactly the same magazine well. | ||
Line 800: | Line 959: | ||
<enforce> | <enforce> | ||
// Script File | // Script File | ||
class MagazineWell65x39C_SampleWeaponClass {} | class MagazineWell65x39C_SampleWeaponClass | ||
{ | |||
} | |||
MagazineWell65x39C_SampleWeaponClass MagazineWell65x39C_SampleWeaponSource; | MagazineWell65x39C_SampleWeaponClass MagazineWell65x39C_SampleWeaponSource; | ||
class MagazineWell65x39C_SampleWeapon : BaseMagazineWell | class MagazineWell65x39C_SampleWeapon : BaseMagazineWell | ||
{ | { | ||
} | } | ||
</enforce> | </enforce> | ||
Line 815: | Line 977: | ||
If there is already some class assigned in the '''Magazine Well''' property, then you can still change it by a right-click on it and selecting '''change class''' option from the context menu. | If there is already some class assigned in the '''Magazine Well''' property, then you can still change it by a right-click on it and selecting '''change class''' option from the context menu. | ||
New magazine prefab can be easily created by inheriting from | == Magazine Prefab Setup == | ||
New magazine prefab can be easily created by inheriting from '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Magazine_Base.et|Magazine_Base.et}}''' prefab. Once new prefab inheriting from '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Weapons/Core/Magazine_Base.et|Magazine_Base.et}}''' is prepared, it is possible to assign magazine model in '''MeshObject'''. | |||
Next step will be modification of magazine related properties in '''MagazineComponent'''. Over there, it is possible to set things like ammo which is used or capacity of magazine. | Next step will be modification of magazine related properties in '''MagazineComponent'''. Over there, it is possible to set things like ammo which is used or capacity of magazine. | ||
Line 823: | Line 986: | ||
In '''InventoryItemComponent''', similar to main weapon, it is possible to change inventory related properties like name or weight. In this example, values were set as on picture below. | In '''InventoryItemComponent''', similar to main weapon, it is possible to change inventory related properties like name or weight. In this example, values were set as on picture below. | ||
==Crate Filling== | === Tracer Magazine Setup === | ||
== Crate Filling == | |||
Once weapon and magazine are ready, it is possible to add those to crates, so they can be picked up either in '''Conflict''' armory or during '''Game Master''' sessions. | Once weapon and magazine are ready, it is possible to add those to crates, so they can be picked up either in '''Conflict''' armory or during '''Game Master''' sessions. | ||
In principle, there are two types of crates available in game: | In principle, there are two types of crates available in game: | ||
*'''Arsenal crates''' - those can be either unlimited or be single use. Closely tied to '''playable Factions'''. It is impossible to precisely specify the amount of available items. | * '''Arsenal crates''' - those can be either unlimited or be single use. Closely tied to '''playable Factions'''. It is impossible to precisely specify the amount of available items. | ||
*'''Regular storage crates''' - using standard storage system, where creator defines exact amount of items, which are available inside of the crate. | * '''Regular storage crates''' - using standard storage system, where creator defines exact amount of items, which are available inside of the crate. | ||
=== Arsenal Crates === | |||
Content of Arsenal Crates is closely tied with '''faction configs''' and '''Faction Manager'''. If for instance given faction is not present in currently present game mode, then such faction specific will be empty in game. Content of those crates is defined through '''[[Arma Reforger:Entity Catalog|Entity Catalogs]]''' which are placed inside of faction configs. | |||
[[File:armareforger-new-weapon-adding-weapon-to-arsenal.png|thumb|609x609px|Adding elements to '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/USSR/USSR_InventoryItems.conf|USSR_InventoryItems.conf}}''']] | |||
==== Adding to existing crates ==== | |||
Adding new items to '''existing''' '''Faction Arsenals''' crates involves the following steps: | |||
* Creating override of '''existing Arsenal config''' - either '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/US/US_InventoryItems.conf|US_InventoryItems.conf}}''' (''used by US Army''), '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/FIA/FIA_InventoryItems.conf|FIA_InventoryItems.conf}}''' (''used by FIA'') or '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/USSR/USSR_InventoryItems.conf|USSR_InventoryItems.conf}}''' (''used by the USSR faction'') - by using '''[[Arma Reforger:Data Modding Basics#Using .22Override in....22 function|Override in "addon name"]]''' functionality | |||
* Open overridden file and add new element to one of the sub containers in '''Multi Lists''' array. | |||
** For instance, if you want to add new weapon, then click on '''plus + arrow''' '''(1)''' on the right side of '''Multi Lists → Weapons''' and add new element of '''SCR_EntityCatalogInventoryItem.''' | |||
* '''Assigning prefab of item''', which is supposed to be visible in '''Arsenal''' crate, to '''Entity Prefab''' property. This can be done either by clicking on button with two dots or by dragging and dropping prefab on this field | |||
* In '''Entity Data List''' property, add new '''SCR_ArsenalItem''' element to the list by clicking on '''plus button (2)''' | |||
* In '''Arsenal Data''' entry added in previous step, select proper '''Item Type & Item Mode''' from the drop down menu | |||
** For rifles, '''Item Type''' can be set to '''RIFLE''' and '''Item Mode''' to '''WEAPON''' | |||
** For rifle magazines, '''Item Type''' can be set to '''RIFLE''' and '''Item Mode''' to '''AMMUNITION''' | |||
* If you want to have your item visible in '''Racks ('''like '''{{Link|enfusion://ResourceManager/~ArmaReforger:PrefabsEditable/Auto/Systems/Arsenal/WeaponRacks/E_WeaponRackCabinetArsenal_FIA.et|E_WeaponRackCabinetArsenal_FIA.et}}''' or one visible in Conflict armory), then it is also necessary to '''add entry (3)''' to '''Arsenal Display Data''' | |||
** Over there, fill in '''Item Offset & Item Rotation Values''' so item is correctly displayed on weapon rack | |||
* Repeat above steps until you have added all items which you wish to have in Arsenal. | |||
{{Feature|important|Once those changes are performed, it might be necessary to '''Reload Game Scripts''' or even '''restart the Workbench'''; after that, those new items should be visible in existing crates in both '''Game Master''' and '''Conflict''' game mode}} | |||
=== | {{Clear}} | ||
==== Creating new faction-less crates ==== | |||
Alternative to adding items to one of the existing arsenal crates is creating a new, faction less variant. This is possible by using '''Arsenal Override Config''' located in '''SCR_ArsenalComponent''' of '''Arsenal''' crate prefab. | |||
* | * Duplicate one of the existing crates or inherit from '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Systems/Arsenal/ArsenalBoxes/ArsenalBox_Base.et|ArsenalBox_Base.et}}''' if you want to create new crate from scratch | ||
** In case of Sample New Weapon, '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Systems/Arsenal/ArsenalBoxes/USSR/ArsenalBox_USSR.et|ArsenalBox_USSR.et}}''' was duplicated using "[[Arma Reforger:Data Modding Basics#Using .22Duplicate to....22 function|'''Duplicate to'''" functionality.]] | |||
===Regular Crates=== | Once box is ready, it is time to prepare content of the crate itself. First step towards it will be preparing of '''alternative arsenal config -''' unfortunately config prepared for [[Arma Reforger:Entity Catalog|'''Entity Catalog''']] is not compatible with override config, so it is necessary to create new one. To do so, create a new config file of '''SCR_ArsenalItemListConfig''' type in '''Configs→ Arsenal''' folder - in this example it is called ''ArsenalConfig_SampleNewWeapon.conf''. Once config file is created, you should be greeted with somehow familiar parameters that previously found in '''Entity Catalog''' configuration. | ||
After filling ''ArsenalConfig_SampleNewWeapon.conf'' with all the data, the config should be ready to be used. To do so, open previously prepared Arsenal Box in i.e. Prefab Edit Mode and assign arsenal config to '''Overwrite Arsenal Config''' in '''SCR_ArsenalComponent'''. Once that ready, don't forget to save prefab - at this stage this box should be testable in any World Editor scenario - even if there are no factions defined. | |||
Once all steps completed, you might wish to make this prefab visible in Game Master, to do so, you would need to make editable variant of '''Arsenal Box''' via instructions mentioned on [[Arma Reforger:Game Master: Editable Entities Configuration|Editable Entities Configuration]] page and then follow the steps mentioned on [[Arma Reforger:Asset Browser Mod Integration|Asset Browser Mod Integration]] page to register it in '''Game Master''' itself. | |||
=== Regular Crates === | |||
If it is desired to have some specific amount of items, then it is possible to use '''UniversalInventoryStorageComponent''' (or its SCR_ equivalent) which can be added to basically to any entity with physics enabled. | If it is desired to have some specific amount of items, then it is possible to use '''UniversalInventoryStorageComponent''' (or its SCR_ equivalent) which can be added to basically to any entity with physics enabled. | ||
Line 850: | Line 1,038: | ||
First step is to locate the prefab where the new item should be stored. | First step is to locate the prefab where the new item should be stored. | ||
In this tutorial ''' | In this tutorial '''{{Link|enfusion://ResourceManager/~ArmaReforger:Prefabs/Props/Military/AmmoBoxes/AmmoBox_545x39_2160rnd.et|AmmoBox_545x39_2160rnd.et}}''' was [[Arma Reforger:Data Modding Basics#Using .22Duplicate to....22 function|duplicated to addon]] as '''AmmoBox_SampleWeaponMagazines.et''' and then used as an example on how to add new magazines to it. | ||
Once that duplicated prefab is present in target addon, following things have to be done: | Once that duplicated prefab is present in target addon, following things have to be done: | ||
*Navigate to '''SCR_UniversalInventoryStorageComponent''' | * Navigate to '''SCR_UniversalInventoryStorageComponent''' | ||
*Add new entry to '''Multi Slots''' array | * Add new entry to '''Multi Slots''' array | ||
*Set '''Slot Template''' to '''InventoryStorageSlot''' and assign to it some unique name, i.e. ''Magazines'' | * Set '''Slot Template''' to '''InventoryStorageSlot''' and assign to it some unique name, i.e. ''Magazines'' | ||
*Assign magazine prefab to '''Prefab slot''' in this newly created '''Slot Template''' | * Assign magazine prefab to '''Prefab slot''' in this newly created '''Slot Template''' | ||
*Change '''number of items''' present in this slot by modifying '''Num Slots''' value ''(f.e. it can be set to 25)'' | * Change '''number of items''' present in this slot by modifying '''Num Slots''' value ''(f.e. it can be set to 25)'' | ||
After that, this crate should have 25 magazines of your choice inside. | After that, this crate should have 25 magazines of your choice inside. | ||
{{Feature|informative|'''Next part '''- [[Arma_Reforger:Weapon_Animation|Weapon Animation]]}}{{GameCategory|armaR|Modding|Tutorials|Assets|Weapon Creation}} | |||
{{Feature|informative|'''Next part''' - [[Arma_Reforger:Weapon_Animation|Weapon Animation]].}} | |||
{{GameCategory|armaR|Modding|Tutorials|Assets|Weapon Creation}} |
Revision as of 11:48, 4 July 2024
In this chapter we will learn how fuel is simulated in game and we will change following things:
- Creating new rifle prefab
- Configuring basic weapon parameters
- Configuring ammo parameters
Prefab Setup
When making prefabs of weapons it is recommended to inherit from one of the already existing prefabs located in Prefabs\Weapons\Core - those prefabs should have most of the necessary configuration for various kinds of weapons.
In this case we will use Rifle_Base.et as parent prefab. To do so, navigate in Resource Browser to Prefabs\Weapons\Core and locate Rifle_Base.et prefab.
Once you are there, click with right mouse button on that prefab and select Inherit in from context menu.
When asked about new name of prefab, consider calling this new prefab WeaponName_base - this might be especially useful when you plan to have multiple variants of weapon, since it will help you to keep your structure nice and clean. After new inherited prefab is created, relocate it to some more fitting location like the Prefabs/Weapons/Rifles directory.
After new prefab is created, it is possible to start modifying it. It can be done by either by opening prefab in Prefab Edit Mode button or by placing prefab manually in World Editor. In this tutorial Prefab Edit Mode was used to edit the SampleWeapon_01_base.et prefab.
Once prefab is loaded, first step would be assigning correct model - in this case it is SampleWeapon_01.xob - to MeshObject component.
If you inherited from core weapon type like Rifle_Base.et then you will need to add few components listed below. In case of duplication of existing prefab, it might be still worth to adjust data in those components before moving to next section of this tutorial, since some of the values might need to be adjusted, like for example damage in SCR_MeleeWeaponProperties.
- RigidBody - this component is responsible for all kind of collisions and without it will be impossible to pick up weapon.
- Once component is created it will be necessary to check Model Geometry parameter so its enabled
- SCR_MeleeWeaponProperties - this component defines how much damage does this weapon when its used in melee fight
- For rifles Damage value of 45 is a good starting point - for smaller weapon feel free to use lower value
Additional, it might be also worth adding another CaseEjectingEffectComponent to Muzzle Component, which is going to emit muzzle smoke. To do so, click with Right Mouse Button on MuzzleComponent and select from context menu option Add child component and select CaseEjectingEffectComponent from the list.
In component itself, following changes will be required:
- Assign fitting particle effect to Particle Effect field - i.e. Smoke_M16A2.ptc
- In Effect Position parameter click on set class button and pick EntitySlotInfo class and call it for instance Muzzle
- Inside Effect Position, change Pivot ID to barrel_muzzle
- Change Has Sound parameter to disabled state
Additionally, you might also want to adjust:
- What kind of cartridges are ejected by the weapon - this is defined in CaseEjectingEffectComponent - over here you can select from many particle effects like for instance Casing_556x45.ptc and assign them to Particle Effect property
- Muzzle effect of the weapon - this is controlled by Particle Effect parameter in SCR_MuzzleEffectComponent - again, you can pick from some existing effects like Muzzle_AK74.ptc or create your own effects like mentioned in Weapon Modding documentation
Inventory Configuration
In SCR_WeaponAttachmentsStorageComponent it is possible to adjust some of the basic item properties related to inventory but there is also one section which is used for defining weapon IK pose (RV veterans might find it similar to handAnims parameter). Animation IK pose is not going to be described in this paragraph though so let's move to inventory configuration.
When looking at SCR_WeaponAttachmentsStorageComponent, multiple Attributes can be observed:
- Item Display Name - as name suggest, here it is possible to change Name and Description (on-hover tool tip visible in in-game inventory)
- Item Phys Attributes - various physical attributes of the item like mass, volume, etc
- Item Animation Attributes - here are defined item IK poses defined
Besides these attributes, there are also Custom Attributes where it is possible to change e.g. Item Inspection Anim or the character's maximum speed when a given item is equipped, or PreviewRenderAttributes, which controls the weapon preview in the inventory menu - if your weapon has an odd size, it might be necessary to adjust the camera parameters there.
In Reforger, inventory system is no longer using pictures' to for model thumbnails but instead, 3D models are rendered inside inventorymenu. How this item is rendered inside inventory is controlled by PreviewRenderAttributes, where you have bunch of camera controls', and In case of SampleWeapon_01_base.et, some tweaks to will be required to the camera distance. Since this bullpup weapon is smaller than regular rifles, it looks quite small in inventory menu. To fix this, navigate to PreviewRenderAttributes class in Custom Attributes and change Camera Distance To Item parameter from 1 to 0.8.
This will put camera closer to the weapon so in inventory menu, weapon should fill whole tile it has available.
In Rifle_Base prefab, Item Phys Attributes is not configured and it is necessary to use "set class" button next to that property. Pressing this button will show additional section where you can freely change parameters.
For this Sample Weapon, the following changes were done:
- In Item Display Name section, Name property was changed to name of the weapon - in this case it is just "Sample Weapon"
- In Item Phys Attributes:
- Weight parameter was adjusted to somehow match the weight of real weapon without any accessories (including magazine). This parameter is using kilograms and in this example it was set to 4kg. Weight in game affects for instance character stamina.
- Size Setup Strategy was setup to Volume. This means that size of that object will be calculated using Item Volume.
- Item Volume (in cm3) defines how much space in inventory container takes that object. Containers like vest have their own definition how large object can fit in their pouches
- In this example it is set to 2500 just to showcase how it works, normally, 3000 is used for machine guns, while rifle like AK74 has this value set to 1500
Additionally, it will be also necessary to add one entry to Custom Attributes. This can be done by clicking on arrow icon (1) to the right of it and then selecting ItemOneHandAnimAttributes class. This class controls the behavior of the weapon when it is held with one hand only - i.e. when the gadget is equipped - and in most cases the default values are good enough for rifles.
Action Contexts Adjustment
Add New Action Context
Interactions with weapon in game world, like being able to take weapon from ground or performing some actions in inspect menu, are controlled by ActionsManagerComponent. Rifle_Base.et prefab should already have most of the Action Contexts and Additional Actions configured although if your weapon is capable of mounting some optic - like Sample Weapon - it might be necessary to add another context for handling optic-related actions it.
To do add new Action Context, simply click on plus icon next to it and then inside of it (by default it should be called UserActionContext), locate Context Name property and type in optic. After that click on set class button next to Position property and select PointInfo class - this will be used to adjust position where the action is located.
ActionsManagerComponent Debug
Once all contexts are in place, it will be most likely to do some adjustments to the context properties like tweaking position or radius where action is available. Typing in seemingly magic values and then checking it in play mode might be bit time consuming so that is why it is recommended to use some of the existing debugs to speed up configuration process.
After clicking on ActionManagerComponent with Right Mouse Button in Object Properties window, you should see multiple debugs listed in Custom section like:
- Draw context(s) diagnostics for selected entity only - toggle if debug should be available only for selected entity - mutual exclusive with below debug
- Draw context(s) diagnostics for all entities - toggle if debug should be available only for all entities in the world - mutual exclusive with above debug
- Toggle context(s) transform gizmo visualization - show little gizmos next to context action
- Toggle context(s) radius visualization - show radius of all action contexts
- Toggle context(s) visibility angle visualization - toggle angle visibility of actions. Only active for non Omnidirectional action contexts (can be used to have actions which are i.e. available from side of the weapon)
- Create user action context(s) from bones - small tool for creating multiple action contexts (see Car Creation documentation for more details)
In this case, it will be enough to enable contexts transform visualization. At later stage, it will be also handy to enable radius visualization when adjusting Radius parameter. Once it is enabled, World Editor viewport should look like this:
As you can notice, most of the actions are located at center of the model and need to be moved to more logical places.
Action Contexts Location Change
It might seem that adjusting of action contexts position is a tedious job but thankfully it is possible to adjust their position directly in viewport using gizmos. To do so, go to selected Action Context - in this case it will be firemode - and click once on one of the fields in Offset parameter. After that, you should see a gizmo snapped to this action context, which can be freely adjusted.
Additionally it is also possible to use Pivot ID to snap action to one of the bones or snap points. Even after Pivot ID is selected, it is still possible to do some tweaks manually using Offset parameter (including tweaking it in viewport).
After all Action Contexts are set, weapon in viewport should look like this:
Action Contexts Radius Adjustment
Last step will be adjusting radius of actions. Default action context is used for instance for picking up weapon from the ground so preferable it should cover the whole gun. Most of the actions which are inherited from Rifle_Base.et prefab have already reduced radius but since optic was created action context was created from scratch, it might still need some tweaking. Default value of Radius parameter on optic action context will cause that this action will fight for attention with all other actions and might also appear to early. To fix this, simply reducing Radius from 0.3 to 0.1 should effectively fix this issue.
Weapon Characteristics
Most of the weapon firing characteristic can be changed in MuzzleComponent which is child of WeaponComponent. Over there, it is possible to Fire Modes, Dispersion, Bullet Init Speed Coef, Magazines and others. In this segment, focus would be but on getting fire modes set correctly, which were already partially covered in the Weapon Modding tutorial.
Starting with Fire Modes, Rifle_Base prefab has by default fire modes - Safe & Single fire mode, therefore it is assumed that any rifle has a safe mode. If it is not the case for the asset that you are preparing, then it might be necessary to create new base prefab based of Weapon_Base prefab - this scenario is not going to be described here though.
For purpose of this tutorial, Sample Weapon is equipped with three fire modes - safe, single & full auto. Since parent prefab has only two fire modes, a new one has to be added through ➕ sign (1) on the right side of the Fire Modes property. Once it is there, it can be filled with proper data.
'BaseFireMode with MaxBurst set to 1 will work as single fire mode'. On newly added BaseFireMode, Max Burst should be set to -1 - this fire mode will work as full auto mode.
Burst fire weapons can be configured by setting Max Burst property to something above 1. In this case, new property will appear - Burst Type. Over there it is possible to select 3 types of burst fire:
- Uninterruptible - once player presses fire button, weapon will fire exactly the amount of shots defined in Max Burst (unless weapon runs out of ammo)
- Interruptible - burst fire will be interrupted once player release fire button. Burst memory is present (Burst Mode (weapons))
- InterruptibleAndReseting - same as above but without burst memory
Weapon Behaviour Configuration
Weapon recoil is in configured on of the sub classes of Weapon Aim Modifiers. Rifle_Base prefab is missing RecoilWeaponAimModifier & ZeroingWeaponAimModifier subclasses in Weapon Aim Modifiers, therefore those have to be added to it. While ZeroingWeaponAimModifier doesn't need any tweaks, RecoilWeaponAimModifier class will have to be set from scratch by hand. As reference, either pictures below or AK74 prefab can be used as reference.
When tweaking recoil values, following table might be useful to get general concept of what Linear, Angular & Turn Offset Data does. Tooltips above parameters should provide enough information on how to set data.
Recoil |
X |
Y |
Z |
---|---|---|---|
Linear
(1u = 1m) |
|||
Angular
(1u = 1°) |
|||
Offset
(1u = 1rad) |
not used, should be left to 0 |
Weapon Deployment Configuration
Weapon deployment feature allows you to rest your weapon on appropriate surface below defined deploy point, which reduces the weapon sway & recoil. System supports both resting on the weapon body and on bipod legs.
Deploying of weapon on the surfaces is control by parameters located in two components - SCR_WeaponAttachmentsStorageComponent + MuzzleComponent - and we will begin our configuration adventure with SCR_WeaponAttachmentsStorageComponent component.
Adding Deployment Points
SCR_WeaponAttachmentsStorageComponent contains deployment related parameters in AimingModifierAttributes class which is part of Custom Attributes. Over there it is possible to define Deployment Points for both weapon body (f.e. when resting rifle on front section of the weapon without any bipod attached whatsoever ) and for integrated bipod. Since Sample Weapon doesn't have integrated weapon, PKM setup will be used to explain this part.
Base Deployment
Starting with basic deployment, begin with adding new entry to Deployment Points array by clicking on + button on the right side of the parameter. This should add new PivotPointInfoItem to the list with some default parameters. Next, click on set class button next to Point Info parameter and type in some unique name like "deploy". Over here, you will be able to set a point which will be used as a pivot & snap point for weapon when its deployed.
Depending on your preferences, you can either create some slot in model and select it as Pivot ID or use Offset and in-game gizmo to place that in desired place. In case of the Sample Weapon, this point was placed at the front of the weapon as on picture below:
Make sure that System Identifier is set to 0 - this tells engine to use following PivotPointInfoItem when there is no bipod or bipod is folded.
Bipod Deployment
Weapons with integrated bipod need a special treatment. First of all, make sure that you have modeled bipod in deployed state and put additional bones for bipod legs folding animation - like bipod_l & bipod_r. Additionally, it is also possible to add new empty objects at the bipod legs ends, which are parented to bipod legs bones via Relations - this might be bit easier to do compared setting offsets in World Editor viewport.
In vanilla weapons, bipod is animated via weapon animation graph, which means you need to create new animation with 2 frames (where first frame represents folded bipod and second show unfolded bipod) and add new logic to animation graph from i.e. PKM.
Once model and animations are done, make sure that you still have PivotPointInfoItem defined when bipod is folded as described above and then perform following actions:
- Click again on + button next to Deployment Points array to add second element to the list
- Click on set class button next to Point Info in that new array element and place this point where bipod is supposed to pivot
- Change System Identifier parameter to 2 - this will tell engine to use that PivotPointInfoItem when bipod is unfolded
- Add two new elements to Stabilization Points array by clicking on + button and call it i.e. LeftLeg & RightLeg
- Set Pivot Info class and use Pivot ID to select empty object attached to bone leg previously created (bipod_l/r). If you didn't create empty socket for those points, use leg bones (i.e. w_bipodleg_left/right) and use Offset to place that point at the end of the leg. Watch out for the rotation of the bones!
- Optionally: tweak Stabilization Size parameter - this controls how large is the surface on which given stabilization point is resting. For bipod legs it might be useful to user bit lower values
Deployment IK Targets
Next thing on the list is setting of Deployment IK Targets in MuzzleComponent where it will be necessary to adjust 3 parameters - LEFT HAND TARGET, RIGHT HAND TARGET and BUTTSTOCK TRANSFORMATION.
- LEFT HAND TARGET - used to determine position of left hand when deployment is active. Use slot_magazine as Pivot ID
- RIGHT HAND TARGET - used to determine position of right hand when deployment is active. Use snap_hand_right as Pivot ID
- BUTTSTOCK TRANSFORMATION - used to snap weapon butt stock character shoulder. Use Offset to place this point at the end of the buttstock.
After setting those parameters it should be now possible to deploy the weapon in game and verify the results. If you encounter some issues, make sure to turn on Deployment diagnostics from Diag Menu.
Deployment Aim Modifiers
In most cases this step is completely optional, since default values should be fine for most of the weapons. If you want to have some non standard behavior (like even better recoil reduction when weapon is deployed) then it is possible to tweak it MuzzleComponent → Weapon Aim Modifiers → RecoilWeaponAimModifier section. By changing Deployment Multiplier and Bipod Deployment Multiplier parameters in Linear Data, Angular Data, Turn Offset Data you can achieve rather interesting results if you seek for some unusual experience. As it was mentioned before though, in most cases you should be fine with default values.
Zeroing
First, you need to setup SightsComponent and fill in Sights Ranges with desired zeroings of your weapon. The position of the camera when you aim down sights is controlled by Sights Position and if you have the eye snap point placed in the correct spot, then no further adjustments to it should be necessary.
Sample weapon setup is bit special since iron sights are mounted on RIS rail and are not integrated part of the weapon. They also have only one zeroing mod set to 300 meters so its not a good example to show how iron sights should be set.
Because of that, here is more general explanation how zeroing works using the game's AK74 as an example. Unlike in Arma 3, weapons in Arma Reforger are not using magic ballistic computer which is automatically adjusting angle of bullet which leaves the barrel but zeroing is working just like in real life. Bullets are affected by gravity and air friction, so if the target is a little farther away, it is necessary to aim higher if you still want to hit your target, and that's basically how mechanical iron sights work. In principle, iron sights are forcing you to look at certain angle which corresponds to ballistic curve of bullet.
Setting points for the proper rotation of iron sights would be a tedious process, but fortunately there is an automated way built into Workbench to assist you in this process.
To use it, following things has to be done:
- Click with
on SightsComponent and select Toggle sight point diag from context menu - this will show position of sights point which zeroing generator will use
- In SightsComponent, set class PointInfo (via set class) on Sights Point Front & Sights Point Rear parameters
- Adjust position of Sights Point Front so it sits on tip of front iron sight. You can use view port gizmo to do so after clicking on Offset parameter inside Sights Point Front. You can also use snap points and assign them in Pivot ID if you prefer to do so
- Adjust position of Sights Point Rear so it sits on tip of rear iron sight
- Make sure that both front & rear points are in one line
- In Zeroing Generator property in Sights Component, set class to BaseZeroingGenerator
Next on the list preparing a list of all available zeroing modes. AK74 iron sights can be zeroed between 100 & 1000 meters and first zeroing mode is a 'battle zero' — a fixed preset configured for a likely combat distance. By aiming at an enemy's center of mass, one may be certain that the trajectory of the projectile will make contact, neither overflying or falling short. This means that in total there are 11 zeroing modes.
Zeroing modes are listed inside of Sights Ranges array in SightsComponent. Using the ➕ button next to that parameter, add 11 entries in that array which will represent all available zeroing modes.
Each SightRangeInfo has Range parameter which need to be filled manually - and the Weapon Position class - which is generated by zeroing generator. In Range, X value represents animation source value & Y represents desired zeroing range in meters (note that this value is also shared by UI).
Zeroing animation (which is not going to be created yet) goes from 0 to 1, where first entry in Sights Range array is 0 and last one is 1. Since there are 11 zeroing modes, interval between each zeroing mode can be set to 0.1 - this was calculated by using following equation 1/(number of frames - 1).
This means that you should have following zeroing modes:
Animation Source Value | Range [m] |
---|---|
0 | 440 |
0.1 | 100 |
0.2 | 200 |
0.3 | 300 |
0.4 | 400 |
0.5 | 500 |
0.6 | 600 |
0.7 | 700 |
0.8 | 800 |
0.9 | 900 |
1.0 | 1000 |
Once you have filled Sights Ranges you can click with right mouse button on Sights Component & then select from context menu "Process zeroing data". Generator will ask which muzzle you want to process and in most cases first muzzle will be the only choice. After confirming selection, generator will automatically calculate necessary offsets for Weapon Positions and store those generated values the currently selected weapon entity. Therefore, it will be necessary to use Apply to prefab button and save current world afterwards.
At this stage we won't bother with animating iron sights and we will get back to it once there is animation graph set in.
Dispersion
Dispersion of the weapon is controlled by two parameters - Dispersion Diameter & Dispersion Range - located in MuzzleComponent of the weapon. Both of those parameters are measured in meters.
Quite often you might find weapon dispersion data being specified in MOA - in such case you can multiple MOA by 0.029 to get Dispersion Diameter value and set Dispersion Range to 100 meters.
For Sample Weapon, it is assumed that weapon has 2 MOA dispersion, which results in Dispersion Diameter value being equal to 0.058.
Additionally, dispersion is also affected by ammunition which is fired - you can read about it here.
Ammunition Creation
Ammo Configuration
Depending on the type of ammo are you preparing, there are few core prefabs for various types of ammunition located in Prefabs/Weapons/Core folder. In general, there are three suggested approaches:
- Creating new prefab inheriting from Ammo_Bullet_Base.et via Inherit in functionality
- Duplicating one of existing ammo prefabs via Duplicate in option - this might be useful for instance on rockets, if i.e. you don't want to use some of the components but still want to keep some of the configuration from it
- Inheriting from one of existing prefabs - this can be used if you are trying to do some variant of existing ammo. This method could be for example used when you 5.45x39 7N6 vanilla bullet if you would like to do newer variant of that bullet (for instance 7N10) with slightly changed characteristics
In this tutorial, Sample Weapon is supposed to use a variant of 6.5 Grendel ammo but unlike in A3, this round won't be caseless to show how to configure spent cartridge ejection. Because of that, inheriting from Ammo_Bullet_Base.et was selected for configuration of this new bullet.
When trying to configure a bullet that exists in real life, it is good to gather as much reference material as possible. The Arma 3 variant of the 6.5x39mm is a fictional bullet, so as an inspiration, PRVI PARTIZAN 6.5 mm Grendel FMJ BT 7.10 g with 6.5x39mm dimensions (instead of 6.5x38mm) was used, since there is a decent amount of information available for it.
After creating new inherited prefab called Ammo_65x39_FMJBT.et, first step will be creating Ammo folder in Prefabs/Weapons folder and then moving Ammo_65x39_FMJBT.et prefab from Prefabs/Weapons/Core to the Ammo folder.
Once prefab is in correct place, you can start editing it in World Editor by for example entering into Prefab Edit mode.
In Prefab itself, there are two things you will want to adjust before moving on to more complex topics. First one will be adjusting things in Projectile itself like changing following parameters:
- In Projectile Model assign model of the bullet itself - this model is visible after it is being fired
- In Cartridge Model assign model of the cartridge (bullet+case). Right now it is not being rendered in game though, unless loose bullet is placed in World Editor.
If you don't have models for neither Projectile or Cartridge Model , then you can use of the existing ones. In this case Bullet_762x51_M62.xob and Cartridge_762x51_M62.xob were used since they are closest thing which matches Lapua FMJ BT round.
Next, go to InventoryItemComponent and click on set class button next to Item Phys Attributes. Over there you will set inventory values which could be useful when i.e. taking single rounds (which normally in the game doesn't happen) try to tweak following parameters:
- Weight - weight of the cartridge in kilograms - in this case it was set to 22 grams - influences weight of the magazine
- Size Setup Strategy - change it to Volume
- Item Volume - set it up to your linking. 7 is a good starting point
- Size - change it to SLOT_1x1
Ballistic Properties
Formula
Bullets, just like in real life, are affected by air resistance. Simulating air resistance in a very realistic way is a very demanding task for the CPU - especially if you want to have firefights with hundreds of soldiers all with fully automatic weapons. Therefore, some compromises are necessary and the air drag in the game is calculated using the following formula:
where
- is the drag force
- is the (de)acceleration of bullet
- is the speed of the bullet
- is the mass of the bullet
Setting Air Drag Parameter
Since the acceleration value is usually nowhere to be seen, you can try to set the correct value for air drag by guessing the value and seeing if it matches the data you already have. In this case, it is quite obvious that your first task in setting up ballistic properties will be to look for references and hard data.
Try to match the bullet type and barrel length used for measurements to get the best results. In this case, Sample Weapon uses 14.5 inch barrel and there is limited ballistic data available on ammo producer website.
Range [m] |
0 | 50 | 100 | 150 | 200 | 250 | 300 |
---|---|---|---|---|---|---|---|
Velocity [m/s] |
840 | 802 | 765 | 730 | 695 | 661 | 628 |
On producer page you can also find information that this data was measured for 24inch barrel.
In some cases, you might even find for detailed ballistic charts like below one - in such case you can consider lucky and move ahead to filling data in table and try to fill Excel spreadsheet.
Quite often though, the only data that is available is ballistic coefficient, speed or time it takes bullet to reach certain range. If you don't have those but at least have muzzle velocity, weight and dimensions of the bullet, you can try to calculate ballistic coefficient yourself to get rough approximation of the value.
Ballistic Coefficient
First, lets start with establishing what Ballistic Coefficient is. As per Wikipedia:
In ballistics, the ballistic coefficient (BC, Cb) of a body is a measure of its ability to overcome air resistance in flight.
If there is some BC (ballistic coefficient) specified for bullet you are looking for, it will be most likely a G model value. Beside BC in G model, you would also need bullet weight, muzzle velocity and some ballistic calculator in order to prepare ballistic chart.
There are bunch of online calculators which are capable of creating ballistic tables like:
- Hornady ballistic calculator - provides quite good selection of customization
- Fedral ballistic calculator - bit more simple but it still provides good data
There is a lot of other calculators online too and you might already be using one of them. Above list though, contains calculators which are capable of providing data in metric system, which is quite handy when trying to match data game air drag.
Additionally, you can also try using Ballistics for Excel addon, which allows you to customize a lot of parameters.
Using G1 vs G7
Once you have decided which calculator you want to use, it is now necessary to decide which model should be used to create ballistic table, if i.e. both values for G1 and G7 are provided.
G1 and G7 refer both refer to aerodynamic drag models based on particular “standard projectile” shapes. The G1 shape looks like a flat-based bullet. The G7 shape is quite different, and better approximates the geometry of a modern long-range bullet. So, when choosing your drag model, G1 is preferable for flat-based bullets, while G7 is ordinarily a “better fit” for longer, boat-tailed bullets.
Creating Ballistic Table
Online Calculator
Assuming you have found G7 BC for your bullet, you can use previously mentioned Hornady ballistic calculator to generate ballistic tables. On that page, fill following information:
- Change unit system to metric
- Type in ballistic coefficient ( in this case G7 BC is equal to 0.204 )
- Change velocity so it matches your bullet velocity - in this case it was set to 840m/s
- Adjust weight parameter so it matches bullet weight. Keep in mind this value is in grains
- Change drag coefficient so it matches ballistic coefficient of your bullet. In this example G7 was used
Once its ready, you can click on Calculate button at the bottom of the page and after few seconds you should get ballistic table like one below.
Please note that Ballistic for Excel addon excel and i.e Hornady ballistic calculator are using different default values for atmospheric situation which influences how bullets are influenced by the air drag. Because of that, you can notice that different calculators can have different results even though they seem to use identical values.
BfX addon is using by default ICAO weather data where Hornady Ballistic Calculator utilizes US Army Standard Metro values.
Pressure | Temperature C | Humidity | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
unit |
Pascal |
mmHg |
inHg |
C |
F |
K |
% |
kg/m3 |
lb/ft3 | |
ICAO | 101324,6 | 760,00 | 29,92 | 15,00 | 59 | 288,15 | 0 | 1,22552 | 0,076506 | |
US Army Standard Metro | 99991,8 | 750,00 | 29,53 | 15,00 | 59 | 288,15 | 78 | 1,20333 | 0,075121 | |
Mayeveski Ingalls | 101591,7 | 762,00 | 30,00 | 15,56 | 60 | 288,71 | 67 | 1,22099 | 0,076224 |
Excel Addon
Alternatively, if you want to use Ballistics for Excel addon, air drag calculator contains small section which utilizes this addon and creates ballistic table based on selected ballistic model & coefficient. First, make sure that you have installed this addon as per instructions on this page and then download & open Weapons_Ballistic_Coefs.xlsm spreadsheet. This spreadsheet is using VBA macros to calculate air drag so when asked to enable them, please do so.
Once this spreadsheet is loaded, you would need to modify following fields:
- Muzzle velocity - in m/s
- Ballistic Model - plugin accepts model from G1 to G8
- Ballistic Coef - ballistic coefficient value in selected model
Optionally, you can also change interval at which data will be calculated by changing Interval parameter (in meters).
Air Drag Calculation
Once you have ballistic table, it will be time to utilize excel spreadsheet to guesstimate correct air drag value.
To do so, download & open spreadsheet Weapons_Ballistic_Coefs.xlsm and enable macros - this spreadsheet is using VBA script to calculate values of air drag at selected range.
After file is opened, start with typing basic data like Muzzle Velocity (in m/s) and Mass (in kg) of the bullet. Next, fill in data in data from firing tables columns according to what you have available at hand. You can also adjust Interval value to better match the source data.
Final step include tweaking of air drag value till somewhat matches the data from ballistic stables. Every time Air Drag parameter is changed, VBA script will recalculate values located in Data from game section. Below you will find two graphs showing the speed & time of bullet according to in-game algorithms and previously created ballistic tables.
Depending on the data that you have, you can try to match your ammo by speed or by its time of flight.
Since air friction works in bit simplified way compared to real world (or even G1 or G7 ballistic models) it will be necessary to do some compromises. Discrepancies between real life data and what can be achieved in game are especially visible for machine gun ammo above 1km. While it might not sound like a big problem for infantry used weapons, it can for instance prevent from using real life reticles on tanks or APCs, since discrepancy between their ballistic in-game and reticle will be noticeable.
After fiddling a little bit with Air Drag value you should get values matching firing tables. In this case Air Drag with value 0.00007 seems to match real life equivalent of the bullet quite nicely, therefore we will assign such number to Air Drag property in General section of ShellMoveComponent in bullet prefab.
Next, adjust the Mass parameter in the Movement Config section of the ShellMoveComponent and set it to match the weight of the bullet - in this case it was set to 0.0071 [kG].
Weapon ballistics data
Barrel Length vs Muzzle Velocity
Ballistic data for bullet that we picked was measured on weapon with 24 inch long barrel, while the Sample Weapon is using 14.5 inch barrel. In general, the shorter barrel is, the lower muzzle velocity is. Of course, this effect is not always linear and in case of some bullets, the muzzle velocity might slightly drop after reaching certain length so it is best to try gathering some source data for particular bullet type. For instance on Ballistic By The Inch page you can find data about many different calibers available on the market.
Getting back to 6.5 Grendel ammo, on following page - https://www.gunbuilders.com/blog/the-65-grendel-ar15-build-guide/ - you can find data for 6.5 Grendel 129 grain Hornady bullet.
Barrel length [inch] | Velocity [m/s] |
---|---|
14.5 | 682 |
16 | 704 |
20 | 728 |
24 | 752 |
As it is visible, around ~10% muzzle velocity loss when firing from 14.5 barrel compared to 24 inch one, which is quite plausible number. Since there is no concrete data for this particular bullet, we can have bit of freedom with setting the value and agree on 0.91 coefficient for 14.5 inch barrel
Now, there are two approaches how to set it in data:
- Reduce Init Speed in ShellMoveComponent of bullet itself by 9% (to 764m/s) and leave Muzzle Init Speed Coef in MuzzleComponent of weapon unchanged (1.0).
- Set Init Speed in ShellMoveComponent to value matching 24 inch barrel (840/ms) and reduce Muzzle Init Speed Coef in MuzzleComponent of weapon to 0.91, so bullet leaves this weapon with lower velocity (~764m/s).
Both solutions have pros and cons and its worth to think which weapon should be used as baseline for different barrel calculations. For instance M16A2 (20 inch barrel) is quite often used as baseline for 5.56 ballistic and because of that, it might be worth to use this as a base and i.e. reduce Muzzle Init Speed Coef on your 14.5 inch M4 rifle. If there are some community mods which could potentially use, then perhaps check if someone tried to establish some standards already.
Since in this case, it's rather unlikely anyone would use this semi fictional 6.5x39mm round and also because of the fact, that 14.5 inch barrel was also base line for 6.5x39 weapon in Arma 3, first method was picked and Init Speed
Since there is no concrete data about penetration of reference 6.5 Grendel bullet, M855A1 penetration properties are used as reference. By checking Wikipedia article about 5.56x45 ammunition, we can see that M855A1 can penetrate 9.5 mm of mild steel at 350 meter. Now, to translate this into game, few steps are necessary like:
- Checking density of target material and how it matches materials present in game
- Calculating speed of bullet at reference range (350 meters)
- Filling in data
Theory
When bullet hits for instance an metal plate in game, there are two major variables which influences whether bullet will pass through such object or not - its bullet penetration ability and material resistance.
Penetration ability of the bullet is configured in ShellMoveComponent and is calculated using the following formula:
After filling values in above parameters inside of ShellMoveComponent you click on that component with Right Mouse Button and select from context menu Show penetration config option. Once this is done, penetration ability of the bullet will be printed in Log Console window.
Material resistance on the other hand is linked to the collider & game material (which is described bit more in detail below) that is used on it. The following formula is used to calculate material resistance:
Now, if impact speed of bullet is larger than material resistance, then bullet will penetrate such object - otherwise it is assumed that projectile was stopped by the obstacle.
Game Materials
Game materials contain information about material density, their coefficient versus kinetic and chemical projectiles and sometimes they can also have thickness overrides inside of them.
If Thickness Override is set to None, then penetration is calculated by measuring actual thickness of the collider (including slope effect). If Thickness Override is enabled, then one of the following situations might happen depending on settings which was selected:
- Min - Thickness of the collider is used but it's capped to the value specified Thickness parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but Thickness is set 5mm, then game will use 5mm in material resistance calculations. In same situation but with collider being 2mm thick visually, game would use 2mm in material resistance calculations since this value is smaller from two values which are compared.
- Max - Thickness of the collider is used but minimal thickness of this object is equal to Thickness parameter. For instance if bullet impacts at 90 degrees at collider which is 25mm thick but Thickness is set 5mm, then game will use 25mm in material resistance calculations. In same situation but with collider being 2mm thick visually, game would use 5mm in material resistance calculations since this value is larger from two values which are compared.
- Clamp - Returns value clamped to the inclusive range of min and max
- Value - Game is using exact value as specified in Thickness in material resistance calculations
Material density of object affects how much resistance it will give to projectile which hits it.
Penetration Resistance coefficients like Kinetic Penetration Resistance or Chemical Penetration Resistance are used depending whether projectiles is a kinetic (like bullet) or chemical penetrator (f.e. HEAT jet). In game, Kinetic Penetration Resistance is also used to determine hardness of the material or its general capabilities to stop the bullet, since i.e. homogeneous armor (RHA) is much better at stopping bullets even though it doesn't seems to be the case when just looking at their density. Because of that, metal game material has 0.6 kinetic and CE coefficient. Penetration Resistance parameters influence final material resistance value.
Below is small table showing density and penetration resistance coefficients.
Material | Density [g/cm^3] | KE | CE |
---|---|---|---|
7.860 | 1 | 1 | |
7.870 | 0.6 | 0.6 | |
7.870 | 0.6 | 0.6 | |
2.700 | 0.5 | 0.5 | |
0.650 | 0.7 | 1 | |
1.922 | 0.8 | 0.8 | |
2.300 | 1 | 1 | |
2.6 | 1.4 | 1 | |
5.700 | 2 | 1 |
Penetration Data Calculation
Armor game material reflects rolled homogeneous armor and serves as a baseline for penetration calculation. Because of that, there are few approaches how to translate 9.5mm of mild steel into game value:
- Try to find a material which would fill description of mild steel that was used in such test
- Try to convert mild steel thickness into RHA
In this case we are going with second method which is trying to convert mild steel to RHA. Metal game materials can already be considered a kind of regular steel and it is using 0.6 coefficient compared to RHA material. Since we are using M855A1 as reference we will convert 9.5mm mild steel into RHA. After multiplying 9.5 by previously mentioned RHA coefficient - 0.6, we will get that 5.7mm of RHA is equivalent of 9.5mm mild steel plate.
Next, we need to calculate speed of the bullet at 350 meters which were mentioned on Wiki. Furthermore, we want to achieve 9.5mm at 350m performance when firing round from 14.5 inch barrel of Sample New Weapon.
To do so, we will adjust muzzle velocity in ballistic chart that we generated before and see what speed it has at 350 meters.
After ballistic chart is recalculated, it is possible to write down speed of the bullet - 538m/s. Now, we should have all the information to fill in Penetration section of ShelMoveComponent in Ammo_65x39_FMJBT prefab :
- Penetration Depth should be set to 5.7 [mm]
- Penetration Density should be set to 7.860 [g/cm^3] - this is the density of RHA material - armor.gamemat
- Penetration Speed should bet set to 538 [m/s] - at this speed bullet will penetrate 5.7mm of RHA plate
If everything went fine, you could verify penetration of your weapon on some test map and check how it performs versus various target with Game Code → Projectiles → Show shell trajectory debug turned on. One of the Grendel advantages is its good performance at higher ranger compared to i.e. 5.56x45 round and this should be quite visible in game too.
Extra Things
Init Speed Variation - in real life bullets are not leaving barrel at precisely same speed and there is some variation with than. For rifles, usually difference is +/- 10m/s and as can it be seen with AK74, where most sources are claiming muzzle velocity of 880m/s and Soviet official ballistic firing tables are calculated for 900m/s. In this case, truth most likely lies in between and 880m/s is minimal observed muzzle velocity and 900m/s is maximal one. In this case, you should set Init Speed to middle value (890m/s) and configure Init Speed Variation to 10m/s
Dispersion Multiplier - this parameter controls dispersion of the bullet living the barrel and can be for example used to simulate precision munition variants like 7.62x54R 7N1 rounds, which are more precise variants of 7.62x54R When trying to simulate more precise ammunition, it is good to combine Dispersion Multiplier parameter with reduced Init Speed Variation.
Tracer Projectiles
Tracer projectiles can be created in 3 ways:
- Creating new TracerProjectile entity via Create tab in World Editor and filling all the data manually
- Creating inherited prefab from Ammo_BulletTracer_Base.et
- Inheriting from some existing bullet prefab and changing entity type in text editor
First method is not really recommended since it most likely will be quite difficult to maintain such file. There might be some use cases for it though, if you are creating Sci-fi equipment.
Base Tracer Prefab Inheritance
Second method is recommended method although it might require setting some parameters again, like Init Speed, Air Drag, penetration and so on. Tracer bullets are quite often designed in a way, that they have very similar ballistic properties to regular bullets of selected rifle, so they can be used with same optics or iron sights.
To create such prefab, simply use Inherit in option on Ammo_BulletTracer_Base.et and call that new bullet i.e. Ammo_65x39_FMJBT_Tracer.et. If you are using this method, you can skip to tracer projectile configuration chapter.
Entity Type Change
The third method is used on most vanilla bullets and while in this method, you just inherit all ballistic properties of standard bullet, it requires tinkering with text editor outside of Workbench.
First, start by creating new inherited prefab from basic round of your choice - in this case it would be Ammo_65x39_FMJBT prefab.
Tracer Projectile Configuration
Once you have tracer prefab prepared, there will be still few parameters to configure like
- Tracer Burn Start After - type here time in seconds when tracer is supposed to start burning. Quite often specs of the bullet are starting distance, instead of time, but using spreadsheet from air drag calculations chapter, you can estimate roughly estimate that time.
- Tracer Burn Time - duration in seconds when tracer should be burning.
- Projectile Model - model of the tracer. There are already few models of tracers available - all of them with different color - which can be used here:
If you want and have available data, you can also type specific values for tracer bullet like different init speed, mass or penetrability.
Damage
Kinetic damage is currently automatically calculated via following formula:
where Penetration Ability is bullet penetration ability (described in penetration segment), Diameter is a parameter inside ShellMoveComponent inside General section & Init Speed is initial speed of the bullet. This value can be previewed by using Show penetration config available in context menu after clicking with RMB on ShellMoveComponent.
Example output Show penetration config 6.5x39mm FMJBT bullet
DEFAULT : PenetrationDepth: 5.700
DEFAULT : PenetrationDensity: 7.860
DEFAULT : PenetrationSpeed: 538.000
DEFAULT : PenetrationAbility: 0.083
DEFAULT : DamageValue: 114.049
AI Target Selection
AI relies on AICombatPropertiesComponent to select a target and the weapon. Not having this on equipment will prevent AI from using that equipment.
Usage
AICombatPropertiesComponent must be attached to:
- Magazine prefabs
- Grenade prefabs - it is only relevant for grenades which can be used by AI to attack a target - e.g smoke grenades don't require it
- UGL grenade prefabs
- Rocket prefabs
Note that weapons do not need the AICombatProperties component except for throwable grenades.
Most likely base prefabs of such equipment already have this component.
Weapon & Target Selection
AI weapon & target selection algorithm evaluates all known targets and all available weapons and magazines available to an AI soldier. Then it selects best target, weapon and magazine for attack.
This evaluation takes into account multiple parameters of target and weapon.
- Target parameters: distance to target, target type, target priority, is target aiming at us, is target in cover.
- Weapon parameters: can this be used against that target type, priority of this weapon compared to other available weapons, min range of the weapon (relevant for rockets and grenades).
Also AI separate their targets into those which they can attack directly and those which they can attack indirectly. Indirect attack means that we don't have to hit the target precisely to cause damage, for instance think of a frag grenade or rocket. Targets available for indirect attack are currently those which we have lost behind cover, but didn't totally forget about. The Direct attack means that we see the target and can shoot it directly.
Properties
- Used Against - most important property. It specifies against which target types this equipment can be used. Example: AK-74 magazine is configured to be used against infantry and unarmored vehicles.
- Priority - priority value of this equipment. If all other properties are same, AI will choose the equipment with highest priority.
- Priority Against Vehicles - priority of this equipment against vehicles. If the default value is used, it will have same priority against vehicles as against infantry.
- Indirectly Used Against - specifies against which target types AI will prefer to use the weapon for indirect attacks. Example: grenades are configured to be used indirectly against infantry.
Priority Values
The minimal requirement is that priority values must make sense for all equipment combinations available for AI in generic case. For example, if in our faction we don't have an AI soldier carrying both PKP and M249 at the same time, it makes no sense to think which one the AI should use first, and which one should have higher priority. But it makes sense to think of a the real AI soldier configuration in the faction: he has a handgun and some rifle, therefore most likely handgun magazines should have lower priority than rifle magazines, so that the soldier uses rifle first.
Another thing which must be thought is priority of equipment in turrets, if such turrets have multiple weapons, for example the BTR-70 turret.
Priority does not always mean higher damage. For instance, a weapon might have high single shot damage but huge reload time, so that it is less practical than a generic rifle. A turret might have two machineguns, an HMG and an LMG, and we might want AI to use LMG against infantry first, and save HMG for vehicles.
If you do not know what priority value to use, please refer to values on existing comparable magazine/weapon prefabs. We can't quote recommended values here because they might change.
Examples
Type | Prefab | Comment |
---|---|---|
Generic Rifle Magazine | ||
Frag Grenade | It has a small priority, it is configured to be used for indirect attacks. AI decides to use the grenade against targets which hide behind cover. | |
UGL Grenade | It also has small priority, but higher than normal grenade. It has higher priority against vehicles. Like the frag grenade, it's configured for indirect attacks, but only against infantry. | |
Armor-Piercing Rocket | ||
LMG/HMG APC turret ammo | HMG magazine priority against infantry is smaller than LMG magazine priority to make AI prefer LMG against infantry. |
AI Ballistic Tables
As describe in Weapon Modding tutorial, there is still one important thing to do when creating new ammo type - generation of AI Ballistic Tables. Those tables are used by AI soldiers to estimate how much they need to adjust their weapon to hit desired target. Details of the setting AI tables are described on previously mentioned Weapon Modding tutorial so here is short version of what is necessary to create and configure such tables:
- Create new AI Ballistic Table in Resource Browser (recommended location - Config →Weapons →AIBallisticTables folder) by clicking Create button and then selecting from the context menu Config file option
- When asked about type of config, select BallisticTableArray
- It is recommended to use AIBT_nameOfAmmoPrefab.conf name for ballistic tables - i.e. AIBT_65x39_FMJBT.conf
- Open ammo prefab and in ShellMoveComponent locate Ballistic Table Config parameter in Ballisitc Tables section
- Assign AIBT (AIBT_65x39_FMJBT.conf) config to Ballistic Table Config proper & save prefab
- Click on ShellMoveComponent with Right Mouse Button and from context menu select Generate ballistic tables option
- Whole process might take few seconds depending on air drag value of the bullet - higher values tend to result in higher computing times
- Once process is complete, save changes in World Editor by i.e. Ctrl + S combo
Magazine Well
Magazine wells are classes which help to establish multi weapon (and mods) magazine compatibility. Any magazine which is using the selected class will be usable in any other weapon, which is using exactly the same magazine well.
In Arma Reforger, there are already plenty of magazine wells available but since this sample weapon is using rather unique magazine well, a new one has to be created.
A new magazine well can be added to the list by creating a new script file in one of the game script folders (f.e. Scripts/Game/Weapon folder can be used - if you don't have such folder, then you need to create it manually). There are no requirements to the name of the script file but it is suggested to use the TAG_MagazineWell_ prefix naming convention. Such setup is sort of necessary since unlike models or prefabs, scripts don't use metafiles, and they can be replaced by placing file with exact name and relative location as original one. Once the script file is created and opened in Script Editor, the only remaining thing is to create a new class which inherits from BaseMagazineWell.
In example above, new magazine well is called MagazineWell65x39C_SampleWeapon.
After magazine well is created, it will be necessary to recompile all game scripts via either Compile and Reload Scripts (⇧ Shift + F7) option in Script Editor or Reload Game Scripts (Ctrl + R) in World Editor.
Once scripts are compiled it should be possible to assign that class in Magazine Well property found both in MagazineComponent of magazine and MuzzleComponent of weapon. If there is already some class assigned in the Magazine Well property, then you can still change it by a right-click on it and selecting change class option from the context menu.
Magazine Prefab Setup
New magazine prefab can be easily created by inheriting from Magazine_Base.et prefab. Once new prefab inheriting from Magazine_Base.et is prepared, it is possible to assign magazine model in MeshObject.
Next step will be modification of magazine related properties in MagazineComponent. Over there, it is possible to set things like ammo which is used or capacity of magazine.
In InventoryItemComponent, similar to main weapon, it is possible to change inventory related properties like name or weight. In this example, values were set as on picture below.
Tracer Magazine Setup
Crate Filling
Once weapon and magazine are ready, it is possible to add those to crates, so they can be picked up either in Conflict armory or during Game Master sessions. In principle, there are two types of crates available in game:
- Arsenal crates - those can be either unlimited or be single use. Closely tied to playable Factions. It is impossible to precisely specify the amount of available items.
- Regular storage crates - using standard storage system, where creator defines exact amount of items, which are available inside of the crate.
Arsenal Crates
Content of Arsenal Crates is closely tied with faction configs and Faction Manager. If for instance given faction is not present in currently present game mode, then such faction specific will be empty in game. Content of those crates is defined through Entity Catalogs which are placed inside of faction configs.
![](/wikidata/images/thumb/c/c3/armareforger-new-weapon-adding-weapon-to-arsenal.png/553px-armareforger-new-weapon-adding-weapon-to-arsenal.png)
Adding to existing crates
Adding new items to existing Faction Arsenals crates involves the following steps:
- Creating override of existing Arsenal config - either US_InventoryItems.conf (used by US Army), FIA_InventoryItems.conf (used by FIA) or USSR_InventoryItems.conf (used by the USSR faction) - by using Override in "addon name" functionality
- Open overridden file and add new element to one of the sub containers in Multi Lists array.
- For instance, if you want to add new weapon, then click on plus + arrow (1) on the right side of Multi Lists → Weapons and add new element of SCR_EntityCatalogInventoryItem.
- Assigning prefab of item, which is supposed to be visible in Arsenal crate, to Entity Prefab property. This can be done either by clicking on button with two dots or by dragging and dropping prefab on this field
- In Entity Data List property, add new SCR_ArsenalItem element to the list by clicking on plus button (2)
- In Arsenal Data entry added in previous step, select proper Item Type & Item Mode from the drop down menu
- For rifles, Item Type can be set to RIFLE and Item Mode to WEAPON
- For rifle magazines, Item Type can be set to RIFLE and Item Mode to AMMUNITION
- If you want to have your item visible in Racks (like E_WeaponRackCabinetArsenal_FIA.et or one visible in Conflict armory), then it is also necessary to add entry (3) to Arsenal Display Data
- Over there, fill in Item Offset & Item Rotation Values so item is correctly displayed on weapon rack
- Repeat above steps until you have added all items which you wish to have in Arsenal.
Creating new faction-less crates
Alternative to adding items to one of the existing arsenal crates is creating a new, faction less variant. This is possible by using Arsenal Override Config located in SCR_ArsenalComponent of Arsenal crate prefab.
- Duplicate one of the existing crates or inherit from ArsenalBox_Base.et if you want to create new crate from scratch
- In case of Sample New Weapon, ArsenalBox_USSR.et was duplicated using "Duplicate to" functionality.
Once box is ready, it is time to prepare content of the crate itself. First step towards it will be preparing of alternative arsenal config - unfortunately config prepared for Entity Catalog is not compatible with override config, so it is necessary to create new one. To do so, create a new config file of SCR_ArsenalItemListConfig type in Configs→ Arsenal folder - in this example it is called ArsenalConfig_SampleNewWeapon.conf. Once config file is created, you should be greeted with somehow familiar parameters that previously found in Entity Catalog configuration.
After filling ArsenalConfig_SampleNewWeapon.conf with all the data, the config should be ready to be used. To do so, open previously prepared Arsenal Box in i.e. Prefab Edit Mode and assign arsenal config to Overwrite Arsenal Config in SCR_ArsenalComponent. Once that ready, don't forget to save prefab - at this stage this box should be testable in any World Editor scenario - even if there are no factions defined.
Once all steps completed, you might wish to make this prefab visible in Game Master, to do so, you would need to make editable variant of Arsenal Box via instructions mentioned on Editable Entities Configuration page and then follow the steps mentioned on Asset Browser Mod Integration page to register it in Game Master itself.
Regular Crates
If it is desired to have some specific amount of items, then it is possible to use UniversalInventoryStorageComponent (or its SCR_ equivalent) which can be added to basically to any entity with physics enabled.
First step is to locate the prefab where the new item should be stored. In this tutorial AmmoBox_545x39_2160rnd.et was duplicated to addon as AmmoBox_SampleWeaponMagazines.et and then used as an example on how to add new magazines to it. Once that duplicated prefab is present in target addon, following things have to be done:
- Navigate to SCR_UniversalInventoryStorageComponent
- Add new entry to Multi Slots array
- Set Slot Template to InventoryStorageSlot and assign to it some unique name, i.e. Magazines
- Assign magazine prefab to Prefab slot in this newly created Slot Template
- Change number of items present in this slot by modifying Num Slots value (f.e. it can be set to 25)
After that, this crate should have 25 magazines of your choice inside.