CombatExtended-Continued / CombatExtended

Combat Extended mod for RimWorld
372 stars 252 forks source link

[Discussion]: Allowing pawns to reload turrets with very high ammo capacities #174

Closed sumghai closed 4 years ago

sumghai commented 4 years ago

Premise

Most machine gun turrets in CE have their ammo capacity capped below 600 rounds, which is appropriate for their rate of fire.

For miniguns, rotary cannons and other machine guns with very high rates of fire, this 600 round limit means they require much more frequent reloads than their real-life versions, even when taking into account that turrets in RimWorld are (typically) used against human-sized targets:

Weapon Source Mod Caliber Cyclic RPM Theoretical CE snap/aimed burst shot count Actual CE snap/aimed burst shot count Magazine size
(real life)
Magazine size
(CE)
M134 Minigun Defensive Machine Gun Turret Pack 7.62×51mm NATO ~6000 300 / 150 100 / 50 3000~40001 rds 500 rds
Avenger Turret
(GAU-8 Avenger)
Turret Collection 30×173 mm 3900 100 / 50 20 / 10 13502 rds 100 rds
Gatling Gun Turret
(M61 Vulcan)
Turret Collection 20×102 mm 6000 200 / 100 40 / 20 11003~15504 rds 200 rds

1Typical ammunition box sizes for air/surface applications offered by Dillon Aero, which manufactures the M134 Minigun 2A-10 Thunderbolt II 3M163 Vulcan Air Defense System (VADS) armored vehicle 4Phalanx CIWS or Land-Based Phalanx Weapon System

Current Issue

As of CE v2.2.1, if a turret has a capacity above 600 rounds, pawns will often get stuck in a loop trying to reload said turrets.

I suspect that this issue arises from the current behavior behind turret loading in CE - namely, every time a partially-depleted turret is reloaded, the pawn removes the existing ammo first, then (if the existing ammo is the same type as the ammo carried by the pawn) the stacks are merged in the pawn's inventory before being fully reloaded back into the turret. It seems that if the merged stack is greater than the pawn's intrinsic bulk / mass capacity, the pawn is unable to perform a full reload, causing the loop.

To compensate for this turret loading limitation, minigun weapon patches have been forced to use lower burst shot count and magazine capacity values than what is theoretically calculated using the standardized CE spreadsheets.

Possible Solutions

LockdownX7 commented 4 years ago

It's not CE's mass/bulk limits causing the issue (those only apply for inventory storage), but rather Core's carrying capacity stat. Modifying that stat's behaviour to accomodate turret reloads would take a fair bit of work, on top of feeling strange for the player (why do colonists suddenly carry way more bullets than normal while hauling to turrets?), so let's go with incremental reloads for turrets, which lets us fix this entirely on CE's side without patching Core.

Handling ammo type changes is straightforward, as you mentioned. One other point is that since we no longer clear the turret magazine when starting a reload, it'll keep shooting at targets within range while there are rounds left in the mag, allowing for a turret to potentially keep firing for long periods without downtime if there's a colonist and ammo nearby to keep it topped up. A minor change needs to be made to turrets to stop them from attacking while the reload is in progress.

I have made the necessary changes in #179, give it a try and let me know if that works well for the turrets you have in mind.

sumghai commented 4 years ago

It's not CE's mass/bulk limits causing the issue (those only apply for inventory storage), but rather Core's carrying capacity stat.

Ooh, I see.

Modifying that stat's behaviour to accomodate turret reloads would take a fair bit of work, on top of feeling strange for the player (why do colonists suddenly carry way more bullets than normal while hauling to turrets?), so let's go with incremental reloads for turrets, which lets us fix this entirely on CE's side without patching Core.

I definitely preferred incremental reloading at the outset, but I wasn't sure at the time whether it was harder to implement compared with the first option. Good thing it actually turned out to be easier.

One other point is that since we no longer clear the turret magazine when starting a reload, it'll keep shooting at targets within range while there are rounds left in the mag, allowing for a turret to potentially keep firing for long periods without downtime if there's a colonist and ammo nearby to keep it topped up. A minor change needs to be made to turrets to stop them from attacking while the reload is in progress.

Makes perfect sense!

I've done some playtesting, and I'll submit my full feedback in a moment, but in short it's working quite well.