OpenXcom Forum

Modding => OpenXcom Extended => OXCE Suggestions DONE => Topic started by: Buscher on March 28, 2022, 10:40:42 pm

Title: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Buscher on March 28, 2022, 10:40:42 pm
Edit by Meridian: original title was: [Suggestion] Add 'reloadingDisabled' to Craft Weapons

Motivation:
When using craft weapons that use clips (for example STR_CANNON using clips with 50 shots), entire clips will be reloaded even if only one shot has been fired. For example ammo count 199 will turn to 200 using a x50 item. Currently it's possible to click on the weapon in the craft screen to disable a weapon. This will do two things: It will disable the weapon by default for dogfighting and needs to be enabled on a per dogfight basis. Also it will stop the weapon from reloading. This suggestion is about turning the disabled state for weapons in dogfights as well as the reloading part into two different things.

---

Proposed Solution:
By adding a bool called 'reloadingDisabled' the currently existing bool 'disabled' will be limited to enable/disable weapons in the dogfight screen. Similar to the dogfight screen the weapon icon will change its palette (preferably looking 'inverted' or better said as it looks in the dogfighting screen). The 'reloadingDisabled' flag will take care of the reloading part and use the already existing *.

This will create four states:
Load in Base and Enabled for Dogfight (Standard Behaviour - * is not shown & Icon is not swapped)
Load and Disabled (Preferred use case for Missiles - * is not shown & Icon is swapped)
Don't load and Enabled (Preferred use case for Cannons with ammo packs x50 or other numbers - * is shown & Icon is not swapped
Don't load and Disabled (Previous second Behaviour - * is shown & Icon is swapped)

I have tried to implement this. See the commit (https://github.com/BeatAroundTheBuscher/OpenXcom/commit/a430441092c73c9124b7ede2ac97e3e03bafe4ee).
The palette swap does not use the correct palette/color combination as of now. Maybe you know which one to use. If not I can play around with the values.

The commit will turn the single clicking action into a left and a right click. Left click alters the disabled bool, right click the reloadingDisabled one.

I have played with it for a few days and it seems to work alright and as intended.
As a side effect the window "Not enough {ammo} to rearm {craft} at {base}" will not pop up, if one decides to keep the base inventory empty to prevent reloads.
Another side effect is that special missiles can be disabled by default and only used against specific UFOs. The player will not have to remember reloading the special missile weapon assuming they use the 'disabled' flag. Of course the player will have to remember the reload of the cannons.

---

Alternative solution would probably to only load full clips or keep the remainder stored as information in each base for each ammo type.
Title: Re: [Suggestion] Add 'reloadingDisabled' to Craft Weapons
Post by: Delian on March 29, 2022, 12:06:56 am
Why not just make reloading chance-based? If you have 199/200 ammo and x50 pack, then you would have a 98% chance to not consume the pack when rearming.
Title: Re: [Suggestion] Add 'reloadingDisabled' to Craft Weapons
Post by: Buscher on April 03, 2022, 07:31:29 pm
Why not just make reloading chance-based? If you have 199/200 ammo and x50 pack, then you would have a 98% chance to not consume the pack when rearming.

Yes, 'statisticalBulletConservation' could also work well with craft weapons. For my game the implementation above is good enough. From the player's side the statisticalBulletConservation for craft weapons would probably be a good solution as you wouldn't have to do anything. If the game rolls a bit badly on the chance, the player might be negatively surprised. But it seems to be a viable way. The 'disabled' flag would have to be removed from the reloading logic next to adding the chance logic.
Title: Re: [Suggestion] Add 'reloadingDisabled' to Craft Weapons
Post by: Meridian on July 25, 2022, 12:03:19 pm
bump
Title: Re: [Suggestion] Add 'reloadingDisabled' to Craft Weapons
Post by: Delian on July 25, 2022, 09:02:51 pm
The original suggestion tries to address two problems:
1. having to constantly enable / disable craft weapons
2. craft weapon ammo waste

Would the new states solve problem #1?
For cannons, you wouldn't have to disable them at the end of the dogfight anymore, but you'd still have to micromanage the rearming. You'd still have to manually enable rearming when you notice that your ammo is 149/200, but then be careful to only fill it to 199/200 so that you don't waste ammo.
For missiles, the amount of micromanagement is the same. In both cases you need two clicks.
Original 1 (keeping missiles disabled): 1 click to enable missiles during dogfight, fire missiles, return to base and rearm missiles, 1 click to disable missiles at the beginning of the next dogfight
Original 2 (keeping missiles enabled): 1 click to disable missiles during dogfight (if you don't need them), 1 click to enable missiles at the end of the dogfight.
Suggested: 1 click to enable missiles during dogfight, fire missiles, 1 click to disable missiles, return to base and rearm missiles

I think that most players don't keep their missiles disabled tho... so my opinion is that, the original behavior, even when micromanaging missiles during battles, isn't really improved here. OP says that "disabling the weapon in base disables the weapon by default in dogfights", but that's false. There is no "default" weapon behavior and it doesn't matter whether you toggle it in base or during a dogfight.

Would the new states solve problem #2?
No. Just decreases your chance of fucking up and wasting ammo.

Would statisticalBulletConservation solve problem #1?
For cannons, you wouldn't have to disable them at the end of dogfight anymore, and you also wouldn't have to micromanage the reaming anymore.
For missiles, the amount of micromanagement is the same.

Would statisticalBulletConservation solve problem #2?
Yes.

I should also note that players usually like to keep their weapons fully armed (in some cases, you need all the ammo to down enemy craft anyway).
So in general I think that statisticalBulletConservation (or whatever you wanna call it) for craft ammo is a simpler and better solution.
Title: Re: [Suggestion] Add 'reloadingDisabled' to Craft Weapons
Post by: Meridian on August 08, 2022, 05:49:13 pm
Anyone seen Buscher around?
Title: Re: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Meridian on August 12, 2022, 08:08:36 pm
Added the statistical bullet saving.

Code: [Select]
craftWeapons:
  - type: STR_CANNON_UC
    ammoMax: 200
    rearmRate: 100
    bulletSaving: true    # default false
    launcher: STR_CANNON
    clip: STR_CANNON_ROUNDS_X50
Title: Re: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Solarius Scorch on August 12, 2022, 08:36:07 pm
(https://static1.srcdn.com/wordpress/wp-content/uploads/2020/06/a-surprise-to-be-sure-but-a-welcome-one-when-55157418.png?q=50&fit=contain&w=1500&h=&dpr=1.5)
Title: Re: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Buscher on January 04, 2023, 07:14:53 pm
Thanks for picking up the suggestion. The solution looks great. Thank you.
Title: Re: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Meridian on January 05, 2023, 03:39:15 pm
Nice to see you back Buscher.
We missed you.
Title: Re: [DONE][Suggestion] Statistical bullet saving for craft weapons
Post by: Buscher on January 06, 2023, 01:06:25 am
Thank you for the kind words.
It's nice to be back and contributing again. I will try not to become a stranger another time  ;).