Competitive Recoil | Technical Documentation

Thank you for taking the time to check out Competitive Recoil. On this page you’ll find a breakdown of each of the Blueprints contained within the project, how they’re intended to be used, and how you can integrate them into your own game.

Example
Need help?

If you have any questions or concerns you may find them addressed in the Frequently Asked Questions section at the bottom of this page. If you don’t find what you’re looking for, you can reach me at nick@techarthub.com and in the techarthub Community Discord server.

If you’re looking for the documentation for previous versions of Competitive Recoil, you can find them here.

Table of Contents

BP_RecoilComponent

The Recoil Component contains the logic for equipping, shooting, and reloading weapons, as well as for calculating shot trajectory and animating the camera to simulate the recoil. As you can imagine, this one does most of the heavy lifting.

Intended to be added to a Pawn with a Camera Component, this Blueprint won’t activate unless Initialized with valid Weapon, Recoil, and Crosshair settings. Each of these is contained with their own Data Asset, making it very easy to create a wide range of weapons with different recoil parameters.

The project includes a number of sample weapons/recoil configurations to get you started.

Initializing the Recoil Component with one of the sample weapons.
Parenting to a Spring Arm Component is optional but recommended!

This Blueprint adds several additional Components to your Pawn and places them in a specific hierarchy to assist with the recoil animation:

  • DummyComponent (a dummy Scene Component, it always helps to have an extra transform!)
    • KickbackComponent (handles the kickback part of the recoil animation)
      • PatternComponent (handles the pattern part of the recoil animation)
  • FullAutoSound (an Audio Component that plays a looping sound when firing your weapon on full auto)
Example
Side note

I decided to keep the Weapon and Recoil settings in separate Data Assets because I anticipate you have your own weapon setup that you’d like to integrate into Competitive Recoil. It shouldn’t be difficult to replace any or all weapon values with your own logic without affecting recoil calculation.

Sample Curves

NameDescription
Curve_AR_VectorSample recoil pattern (Assault Rifle)
Curve_LMG_VectorSample recoil pattern (Light Machine Gun)
Curve_SG_VectorSample recoil pattern (Shotgun)
Curve_HeavyKickback_FloatAn animation curve for heavy kickback with some oscillation
Curve_LightKickback_FloatAn animation curve for light kickback, best used with rapid-fire guns

Settings

All of Competitive Recoil’s functions and variables have been given internal descriptions, but if something doesn’t make sense you’re probably not the only one, so please let me know!

Weapon

NameDescription
NiceNameThe name of the weapon that’s presented in the interface
MaximumRangeThe maximum distance for impact calculation
bIsAutomaticWill this gun keep firing if you hold the trigger down?
FireRateHow many times this gun shoots per second
MagazineSizeThe maximum number of times this gun can shoot before needing to be reloaded
NumberOfProjectilesPerShotHow many projectiles are fired with each shot
bUseSeedForPerProjectileDeviationShould the random seed be used when calculating shot spread? If false the outcome will not be reproducible between shots.
MaximumPerProjectileDeviationThe maximum random deviation for each fired projectile. Only useful for guns that shoot multiple projectiles per shot.
ReloadTimeHow long in seconds this weapon takes to reload
CrosshairOffsetA per-gun crosshair offset to help differentiate between more and less accurate weapons
EquipCueThe sound that plays when this gun is equipped
SingleShotCueThe sound that plays when this gun is fired once
FullAutoCueThe looping sound that plays when this gun is being fired on full auto
TailCueThe sound that plays when the gun stops firing on full auto
DryfireCueThe sound that plays when the gun is fired and the magazine is empty
ReloadCueThe sound that plays when the gun has finished reloading

Recoil

NameDescription
KickbackCurveThe name of the weapon that’s presented in the interface
KickbackStrengthThe strength of this gun’s kickback animation. This is reflected in the intensity of the camera movement.
KickbackDurationThe duration of this gun’s kickback animation
bUseSeedForPatternSpreadShould the random seed be used when calculating pattern spread? If false, the random pattern spread will be different each time.
PatternCurveThe maximum random deviation while firing in a pattern. This gets more pronounced the longer you fire.
PatternDeviationHow many projectiles are fired with each shot
PatternResetDurationHow long before the recoil pattern resets after we stop shooting
bUseSeedForMovementSpreadShould the random seed be used when calculating movement spread?
MovementDeviationWalkingThe maximum random deviation while moving
MovementDeviationJumpingThe maximum random deviation while jumping/in midair
CameraTrackingMultiplierHow much the camera should follow the recoil pattern. Too little and the gun doesn’t feel powerful, but too much and your camera goes all over the place!

WBP_Crosshair

This Widget Blueprint contains the elements that make up the Crosshair. It draws its values from a Crosshair Settings Data Asset, making it highly customizable.

By default it looks like this!

Settings

Crosshair

NameDescription
bUseCenterDotEnable the Center Dot?
bFadeCenterDotWhenFiringShould the Center Dot fade out while firing?
bCenterDotMovesWithFireErrorShould the Center Dot animate with vertical fire error?
CenterDotColorThe color of the Center Dot
CenterDotThicknessThe size of the Center Dot in pixels
bUseInnerLinesEnable the Inner Lines?
InnerLineColorThe color of the Inner Lines
InnerLineLengthThe length of the Inner Lines in pixels
InnerLineThicknessThe width of the Inner Lines in pixels
InnerLineOffsetThe distance from the center in pixels at which the Inner Lines start
bInnerLinesUseMovementErrorShould the Inner Lines animate with player movement?
bInnerLinesUseFiringErrorShould the Inner Lines animate with gun recoil?
bUseOuterLinesEnable the Outer Lines?
OuterLineColorThe color of the Outer Lines
OuterLineLengthThe length of the Outer Lines in pixels
OuterLineThicknessThe width of the Outer Lines in pixels
OuterLineOffsetThe distance from the center in pixels at which the Outer Lines start
bOuterLinesUseMovementErrorShould the Outer Lines animate with player movement?
bOuterLinesUseFiringErrorShould the Outer Lines animate with gun recoil?
bUseOutlinesEnable Outlines?
OutlineColorThe color of the Outlines
OutlineThicknessThe thickness of the Outlines in pixels
MovementErrorMultiplierThe amount of movement when the player moves
MovementErrorSpeedThe speed of the movement when the player moves
KickbackMultiplierThe strength of the kickback movement
FireErrorMultiplierThe intensity of the recoil pattern movement
FireErrorSpeedThe speed of the recoil pattern movement
FireErrorStartFadeThe distance from the center at which the topmost line starts to fade out
FireErrorEndFadeThe distance from the center at which the topmost line has fully faded out
FireErrorMaxiumumHorizontalHow far the fire error will move the Crosshair horizontally. Reduce this value if crosshair movement is a little too wild when the recoil makes it move back and forth.

Frequently Asked Questions

Does it support multiplayer?

Absolutely. At the moment the client handles most of the recoil calculation, informing the server as to where to trace the trajectory of each projectile. If you’d like to add additional anti-cheat protection or gameplay effects look for where the decals are placed as a good starting place.

Does it work in VR?

I don’t see why not, but I’ve not tested it. If you’d like me to confirm before you purchase, let me know!

Why does my Crosshair get weird when I change my project’s DPI Scaling settings?

By default Unreal will try to scale your interface elements using a DPI Curve to ensure that their relative scale is consistent across a broad range of resolutions and aspect ratios. The weirdness you are seeing may be because your Crosshair is really thin (between 1-2 pixels) and as the engine tries to scale the Widget it ends up being spread across ‘half’ a pixel, making things look a little lopsided.

In the demo project I’ve solved this issue by turning DPI Scaling off entirely. This is great for me, but its a global setting so it may not be desirable if you have other interface elements that rely on it.

This is a tricky situation, and the solution may be to tweak the DPI Curve until your Crosshair looks as you expect. If that isn’t working out you may need to have multiple crosshairs for each of your target resolutions, or add some additional logic so WBP_Crosshair automatically adapts to different resolutions.

I am a technical artist from Adelaide, Australia. I created techarthub to share my knowledge and love for this industry. I hope you feel it too!

Scroll to Top