Skip to Content
Shotgun Reloading

Shotgun Reloading

Shotgun reloading is little more complex than regular reloading.

Why?

Because the character inserts bullets one at a time, and the amount they insert depends on how full the gun is. Shotgun reloading logic can also be applied to bolt-action rifles where the character inserts one bullet at a time.

Hence, shotgun reloading is handled in three stages:

Stage 1: Prepare

Stage 2: Reloading

Stage 3: Completing

Shotgun reloading can get more complex once you try making it more realistic as well (alternate animations playing on different conditions).

For now, we’ll look at a simpler version:

"phasedReloads": [ { "phase": "PREPARING", "condition": "reloadIterationIndex == -1", "duration": 480, "animation": "animation.model.prepare" }, { "phase": "RELOADING", "condition": "reloadIterationIndex >= 0", "duration": 480, "animation": "animation.model.iterativeload" }, { "phase": "COMPLETETING", "condition": "reloadIterationIndex >= 0", "duration": 670, "animation": "animation.model.finish" } ]

This example has three animations, one for each stage. The animation is assigned a stage via "phase".

So the first animation listed plays the “prepare” animation during the "PREPARING" stage at condition: “reloadIterationIndex == -1”

The condition “reloadIterationIndex == -1” means ‘if the gun is empty’ but since it’s not == 0, that can be confusing. Nonetheless, for the prepare stage, this is correct. Don’t use this condition in other places.

The second animation listed plays the “iterativeload” animation during the "RELOADING" stage. This is more familiar. The condition also makes sense. It plays the ‘iterativeload’ animation if the gun has greater than or equal to zero ammo.

The last animation listed plays the “finish” animation during the "COMPLETETING" stage (yes, this is a typo, but keep it like this), with the same condition as ‘iterativeload’ for flexibility (without much regard for how much ammo the gun has).

A realistic shotgun reload looks like this:

"phasedReloads": [ { "phase": "PREPARING", "condition": "reloadIterationIndex == -1", "duration": 480, "animation": "animation.model.preparealt" }, { "phase": "PREPARING", "condition": "reloadIterationIndex >= 0", "duration": 480, "animation": "animation.model.prepare" }, { "phase": "RELOADING", "condition": "reloadIterationIndex == 0", "duration": 1000, "animation": "animation.model.loadfirst" }, { "phase": "RELOADING", "condition": "reloadIterationIndex > 0", "duration": 480, "animation": "animation.model.iterativeload" }, { "phase": "COMPLETETING", "condition": "reloadIterationIndex >= 0", "duration": 670, "animation": "animation.model.finish" } ]

Here, the ‘prepare’ stage and the ‘reloading’ stage have more than one animation, playing in different conditions.

It works the same as alternating reload animations for the examples in animations, but since there are multiple stages, there are naturally more animations.

The realistic logic accounts for putting in the first shotgun shell via the chamber directly, and then switching the animations to insert shells from below.

Last updated on