Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Morrandir

Pages: [1]
1
OXCE Suggestions Abandoned / Extended reaction fire
« on: May 22, 2017, 11:56:20 am »
Hi all,

(Updated June 17 2017. Fixes + added the possibility to exclude fire modes from reactions in the battlescape.)

TL;DR: Extended Reaction Fire allows for aimed & auto reaction shots. Balances to reaction score calculations: small penalty to reactions for slow weapons (<20%), small bonus for fast weapons (<6%). Each fire mode can be individually disabled for weapons in the rule set; they are all enabled by default. The choice of reaction fire type is automatic based on distance but can be manually controlled: right click on the corresponding reserve TUs button sets the fire mode as preferred, middle click excludes the mode from reaction fire.

The mod is built on Meridian's OpenXCom Extended+ 3.5 and can be found here: https://github.com/Morrandir-X/OpenXcom/tree/oxce3.5-plus-proto
(Thanks Meridian for help!)

You also should add the following lines to Piratez_lang.rul so that the option is correctly shown:
Code: [Select]
STR_EXTENDED_REACTION_FIRE: "Extended Reaction Fire"
STR_EXTENDED_REACTION_FIRE_DESC: "If enabled, reaction fire uses aimed and auto shots, not just snap shots. Automatic choice based on distance. Right click reserve TUs button for manual preference, middle click to exclude fire modes."

In a nut-shell:
– When enabled from Advanced options (under Extended), ERF allows units to choose aimed, auto, snap shot (and melee of course).
– The mode is automatically selected based on distance, preferring melee, then auto, snap, and aimed shot. The automatic choice can be overridden by manual selection – simply right click the Reserve TUs button and the shooting figure turns golden to mark the selection. Middle click on the button to exclude that type of reaction (the figure in the button disappears to mark the exclusion).
– Each mode can be disabled by setting canReactAimed, canReactAuto, canReactSnap, and canReactMelee flag to false for the weapon in the ruleset.
– For balance purposes, the reaction score calculation has been tweaked to take into account the TUs required for taking the action, lowering the score for slower weapons and making it higher for faster weapons. Disabling the mod reverts the calculation to the standard.

The long story:
One thing that has always bothered me in X-Com is that reaction shots can only be snap shots. The way I see it is that on your turn, you can either opt to act or wait and react (or a combination of the two). Say a sniper is overseeing the battle field. He can decide to shoot any visible units actively or wait for an enemy to move into the open (makes all the more sense if the sniper knows that the enemy is hiding behind cover). Since the time used in both cases is the same, he should be able to make an aimed shot just like when actively engaging. Things get even stranger with someone walking around with a machine gun that only shoots auto: the gunner will just freeze if an opponent comes at him! The role of a gunner is typically to provide cover in the battle field by shooting at whatever moves – an impossibility with the current reaction fire system. (I understand that modders have balanced their mods around this restriction, but further down I suggest another way to keep those balances and still allow for greater variety of reaction fire.)

So, I decided to make new reaction fire rules, call them extended reaction fire. The unit now simply chooses which of the available fire modes to use based on distance or by manual selection, defaulting to the best available shot if the target is beyond accurate firing range.

This change alone would have weird consequences, though. For instance, consider the sniper whose aimed shot takes 95% of his time units, reflecting the time required for aiming and for setting up the gun. If the sniper reserves all its time units, it would be able to react VERY fast – as fast as anyone else – although the point of the high TU cost is the slowness of the weapon. This is because reactions currently depend only on remaining time units and the static reactions stat – how much TUs the shot costs has no bearing on how fast it is taken. Not only would this not make sense, it would overpower reaction fire from slow but accurate/deadly weapons, either sniping shots or auto fire from heavy machine guns. For this reason, the reaction fire calculations require some balancing.

I made the reaction score depend not only on remaining TUs but also on the TU cost of the weapon in the chosen fire mode. The basic idea is that the TUs required for the shot are subtracted from the remaining/reserved TUs used in the calculations. The unit effectively has less TUs reserved as far as reaction fire calculations go. Thus, the slower the gun is to operate, the slower the unit is to react, reflecting better the idea that using 95% of TUs is not done lightning fast but slow. I then made two further tweaks.

1. The subtracted TUs is equal only to HALF of the TUs required by the shot. This I think is a reasonable approximation of when the shot itself is taken (the rest of the TUs include aiming, setting up, and doing any post-shot actions). Balance-wise it makes it feasible to actually fire high-cost aimed and auto shots, which otherwise would require the target to exhaust almost all of its TUs or have really awful reactions.

2. I set a default TU cost, modelling it on the snap shot of an assault rifle, namely 25% of TUs. That is, if the reaction shot is 25% of TUs, the standard formula applies (reactions x remaining TUs / all TUs); if it is more or less than 25%, the reactions are slower or faster. (With 95% aimed shot for a unit with 100 /100 TUs left, for reaction calculations the unit would have 100 - (95 - 25) / 2 = 65 / 100 TUs left.) Note that this only applies to the actor: the target’s reactions are calculated always with the standard formula so that defensive use of reactions does not depend on how fast a gun the target wields.

The end result is, I think, pretty satisfactory. Now whenever a reaction fire check is made, it includes a check on which fire mode is reasonable. I made this to be as simple as possible: within accurate auto fire range, auto fire is used, within accurate snap shot range, snap shot, and finally aimed shot is used outside both ranges. This selection can be overridden with a manual selection, by a combination of setting a preferred fire mode that will be checked first (if the reaction fails, another shot is taken) and excluding fire modes from reactions. Unless all fire modes are excluded, one of the available shooting modes WILL be used: a snap shot will be fired even outside its accurate range if an aimed shot is not available; if the selected firing mode is not feasible (e.g. auto shot would have 0% chance to hit), another is automatically chosen. And yes, a unit can shoot auto/aimed shots and finish off with a snap shot when TUs are just enough for that. With the tweaks in the calculations, an aimed or auto shot is a little slower than a snap shot, but still reasonable (a 90% aimed shot allows the opponent to use 15% more TUs before the shot is taken than in the standard case of 25%; close to the standard the deviation from the current calculations is minimal: within 15%-35% range is is <2.5%).

Finally, since some weapons are incapable of reaction fire by design (e.g. X-Piratez's Long Bow that has aimed shot exactly so that it can't be used for reaction fire), I have added the possibility for disabling reaction fire of any type for any weapons in the ruleset. (The case could be made that e.g. a mortar cannot effectively be used for reaction fire and that some weapons are too dangerous to be used in that fashion (though in X-Piratez reaction fire baby nukes are a thing, so…). This actually results in more possibilities for modders: now reaction fire is no longer dependent on the fire mode and the two can be combined at will.

ERF makes it possible e.g. to:
a)   Set up a gunner with heavy auto fire (e.g. X-Piratez's Heavy Machine Gun) to fire upon enemies in their turn,
b)   Set up a sniper that shoots aimed shots instead of snap shots,
c)   Have auto-only gun wielding soldier take reaction shots (e.g. X-Piratez's Machine Gun),
d)   Have assault rifle wielding units shoot auto when the enemy turns around a corner in close range or fire one accurate aimed shot when an enemy is far away, making these weapons truly versatile,
e)     Have one assault rifle wielding unit overwatch with aimed shots for precision and one with auto shot for more mayhem,
f)     Choose manually two 25% snap shots over one 50% aimed shot, or vice versa, depending on the situation.
g)   Have SMG wielding or fast melee units react to an opponent faster: one can effectively increase one’s reactions stat by using a fast weapon,
h)     Give snap shot to a weapon not meant for reaction fire (e.g. X-Piratez's Long Bow), in addition to aimed shot,
i)      Have weapons that can only use some of its fire modes for reaction fire, including disallowing melee while allowing firing reactions, or vice versa,
j)     Have any sort of combination of excluded and preferred fire modes, e.g. a sniper that never snap shots or a soldier with assault rifle that only shoots auto when units are close enough and does not react otherwise, or a unit that only uses melee for reactions (e.g. stun weapon) even though it has a ranged weapon.

For further development:
– Perhaps it is possible to add a special reaction fire mode that cannot be actively used on player's turn but is used for reaction shots, with e.g. lower accuracy or higher TU cost.
[ *** DONE AND DONE *** – One issue is that sometimes one prefers three snap shots over one aimed shot, and apart from distance, there is no way that can be enforced now. I think such issues are minor compared to all the issues in the existing system (no machine gun reaction fire…!). One might consider a bigger change in the game mechanics to solve this: make the “reserve TUs for x shot” buttons work the way I used to think they did, namely if you have “reserve TUs for aimed shot” on when you move the unit, it would reaction fire with aimed shot EVEN when within accurate snap / auto shot range, and if you have “reserve TUs for snap shot” on, then snap shots would be used. I am unsure if this change is possible and how difficult it would be, however.]
– A known issue is that currently the choice of reaction fire weapon in dual wielding situations is a bit wobbly. For instance currently if the active weapon cannot react with a fire mode, the system does not check if the inactive weapon could (it's complicated to make it switch between checking both weapons for each instance).

It would be great to hear what the community thinks of this, the idea and the implementation.

(The extended reaction fire is probably compatible with vanilla OpenXCom too but has not yet been made to work with it.)

Thanks!

~M~

Pages: [1]