XCOM 2
0 of 0

File information

Last updated

Original upload

Created by

aggies11

Uploaded by

aggies11

Virus scan

Safe to use

About this mod

Alters the Random Number Generator used to determine if shots hit or miss, making it feel more "fair" to the player.

Permissions and credits

Fair RNG Mod


-by aggies11

PURPOSE



Ever do all the work getting your soldiers into position, flanking the enemy, making all the right moves to set up the perfect shot, one your soldiers just can't miss then BAM, that 95% chance to hit misses wide? But no big deal, you planned for this and still have another shot, except, holy crap the next 90% shot also misses! You played perfectly, made all the right decisions but now you are out of actions, your turn ends and the enemy precedes to wipe your entire squad on their turn. That's it, mission failed, all that work for nothing. How UNFAIR does that feel?


Well then this mod is for you! To put it simply, it aims to make the Random Number Generator and the resulting combat rolls "FEEL" more fair. You're going to miss those 95% shots less often, about as much as you'd naturally expect. Double-extremely-low-chance misses should come up so rarely that you hopefully won't be as upset by them. Basically this mod aims to change the RNG to make it feel and play much more FUN!

**Disclaimer: "But that's NOT X-COM Baby!". If you aren't the type of person that the above resonates with, that's fine, everyone has their own tastes and this mod probably isn't for you. This mod is an experiment as whenever one of these games comes out, you see the above sort of sentiment mentioned over and over. So I want to see if changing the RNG actually makes the experience better.



REASONING


OK, first of all I'll address the obvious, the RNG in XCOM is already fair, it's been proven to be mathematically accurate many times.  So why this mod and why this name?

For many people who have played this game and previous in the serious, you quickly realize that despite the mathematical assurances, it sure doesn't FEEL fair. Missing a 90% shot twice in a row, is like a punch to the gut, especially after all the work maneuvering to set it up in the first place. And depending on the difficulty level(especially in this sequel XCOM 2, which seems more punishing), what those key misses might mean to the missions success/failure. Yeah sure, it's technically accurate, it's "Good" mathematics and statistics, but it's also BAD* game design. (Obviously I'm a modder, not a game designer, so it's a bit hyperbolic for me to be making this claim. But this mod/experiment then is an attempt to put my money where my mouth is, so to speak)

A bit of background (if  you aren't interested that's fine, just skip to the GOALS/INSTRUCTIONS section detailing how the mod works).  It is my personal theory that above sense of unfairness of RNGs is actually just a quirk of human psychology. It's often been shown we are just plain bad at accurately guessing probability outcomes and chance etc. It's just not intuitive. Chalk it up to our natural pattern matching tendencies of the brain (great for survival out in the wild!) or whatever, the reason doesn't matter, we are just plain not good at it.  A 95% chance to hit shot, means it's going to miss 5% of the time. In the long run, that's about 1/20 shots. The chances of that happening twice in a row is however, like 1/400 (from 5% to 0.25%), which seems pretty low at face value, except when you realize how many shots you end up taking in a typical game. Sure the chances are low, but when you "roll" long enough, eventually even those low chance items come up. And when they do it always seems to happen way more than it feels like it "should".

Now we can't change human psychology (no matter how hard we try) and so it might seem odd that if RNGs often feel unfair to players, why do game designers keep using them? My personal answer is: they shouldn't, it's just a left-over quirk from pre-computer (board and table top style) games. If we look at what the goal of a RNG or "randomness" is in a game, they are typically used as a source of "variety". Games would be boring if the same things always happened over and over, you'd never want to play them again. So we need a way to shuffle things up so they don't play out the same.  However if there was an obvious pattern to the shuffling, then even that variety would become predictable and feel "stale". So make it based on some sort of random roll (eg. a six sided die(dice), or the big daddy d20 20 sized die often found in D&D style Role playing games).

This in of itself isn't a bad goal. Variety is good. And if you are making a traditional style old board or tabletop game, since the players end of being the "computer" and are the ones that have to actually carry out all the rules, you can't make things too complicated for them. Rolling a die, flipping a coin etc are fairly simple things to expect the player to do. So they are used as a compromise.  The problem is, when we switched to computer based games, we now had a machine able to execute arbitrarily complicated rules in only the blink of an eye without any extra burden on the player. And yet this trend of using naked die/RNG "rolls" was inherited from our old board/table games. Essentially we are using an incredibly primitive and limited style of "ruleset" to generate variety and unpredictability, even though we don't have to. It's easy to see why this happened, as many early computer games would end up being little more than literal translations of their board/table game counterparts. But for whatever reason (inertia, "lazyness" ;) etc) this trend has continued to modern day.

So the answer should be to come up with better rules, ones that don't just use naked probability (which we know our players don't always have a good time with) and instead make things better. You hear every once and a while about small ideas along this way to "cheat" the RNG system.  Eg. If you roll a miss on a 95% hit, well then the next roll should make it much harder to miss again. (In fact, upon digging into the internals, XCOM 2 has a bit of this going on, under "aim assist", however it's still rather crude).  Essentially the goal should be to still use randomness at the core of your rules to "generate variety", but you have to augment them in such a way to take into account human psychology and make the game feel "fair" and fun to your players.

Now with all the above being said, this mod could end up being a crazy complete rewrite of the game rules, but honestly, it's not going to be. That sort of scope is for the game designers themselves, and it would likely require cooperation from the game's other systems (you'd have to design the entire game from the ground up around it and tweak everything else to make it work).  While the tools in this game might be there, this simple mod author's ambitions are not.


GOALS


So now onto this mod: Here we are at XCOM 2, actual mod support and tools which should make the goals from above a reality. Initially I'm probably going to start with the crude uniform distribution approximation (average sum of two rolls). It's an incredibly simple change and will allow for extremely fast release. (Edit: This was written before I started work on the mod, about a month ago. While the change is simple, the game is more complicated and so it ended up being MUCH more involved). Based on how this plays out though, since the tools are more robust this time around, we have way more freedom to change the probabilities.

I'll likely not change the underlying rules, especially about independence of rolls, but I may decide to tinker with the probability distribution itself. Basically there is nothing saying that we have to use the standard 1-100, each number having the same chance of coming up as any other. There are many curves out there to choose from, and nothing really stopping us from using a completely custom one. But if the crude one works well enough, it might not even need further tweaking. Either way I'm super curious to see how it actually plays and feels.

Disclaimer: A quick word here. While i'm definitely playing armchair game designer (as most modders do by nature) I am not actually a game developer. I also don't presume to be the first person to come up with any of these ideas.  This isn't a simple case of me saying "lazy game devs" etc.  Designing good rules for variety without using naked RNG rolls is actually quite hard, especially if you still want it to feel organic and not obvious what the "pattern" is.  (The simple example of missing a 95% shot meaning that the next shout should not be able to miss again (and avoid pissing off the player) is an easy suggestion, but it falls down when you consider players figuring out this rule and then using it (seeing the pattern) to their advantage: missing a 95% shot, then take your next shot as a 10% hail mary, because you know the game is not going to let you miss etc). Such rules require careful consideration and a willingness to adjust the entire game design to fit with them. This is a tricky thing to do in modern game production realities, and I understand that.  All that being said I do still think it's a worthy goal and so this mod is a tiny step in that direction.


WHAT'S ACTUALLY CHANGED


While we want to change the RNG, we don't actually want to change it everywhere. This mod only adjusts the RNG inside the Tactical game (on the battlefield) and specifically only for the player's actions. We don't mess with the AI when it's taking it's turn, as it doesn't have any feelings and hopefully doesn't care if it misses 3 easy shots in a row. This is about player psychology and so we only change the players actions. Essentially this mod can be boiled down to affecting the player shot %, so that we miss less on the high % shots. Note we aren't changing the reported shot % in the UI as that would defeat the whole purpose (eg. being that an 85% shot feels like it misses way more than it should). Also worth noting is that due to it being a probability distribution (has to add up to 100) if we make high % shots "easier", then to balance it out, the low % shots will also be made "harder". So shots below 50% will actually miss MORE then they should. But I don't imagine this being an issues as I'm guessing most people don't really bother taking low % shots (which is another reason why using naked probability is tricky. The "unlikely hits" that balance out the "unlikely misses" are rarely experienced since they aren't taken that often).  It can be best illustrated by the following table:




WHAT'S NOT CHANGED


As mentioned previously, this mod does not attempt to mod every RNG roll the game makes. While changes only affect the tactical game, and the players rolls, we really want to only change the rolls that need it/make sense. Essentially any rolls that happen that aren't directly about making an attack (eg. hacking, panic, stat checks) are left alone in their vanilla form. Further we leave the rolls for damage calculation, and hit type (crit, graze, regular hit) also alone.  So this mod does not change damage amounts or the distribution of hit types. It really boils down to just rolls where you see a %Aim chance and have to decide to attack an enemy or not.


INSTRUCTIONS


Typical XCOM 2 mod installation. Extract the zip file contents (everything contained in a FairRNGMod folder) to your XCOM 2 mod folder (XCOM 2\XComGame\Mods). Then enable the FairRNGMod from the launcher. In the Mod's config folder (XCOM 2\XComGame\Mods\FairRNG\Config) there is an XComFairRNGMod.ini file where some configuration options can be changed. This is mostly for testing purposes and does not need to be adjusted for regular play, however it allows for some tweaking to the RNG Distribution used and some settings for mod compatibility).


REMOVAL


As per usual mod removal, the game will complain if you load a save that was made with the mod installed, and will refuse to load
without it. Thankfully everything this mod changes is completely safe and doesn't stick around in save files, so the usual methods of getting around this (eg. Ignore Missing DLC fix) should work fine.


COMPATIBILITY


This mod uses 3 class overrides (X2AbilitytoHitCalc_StandardAim, X2AbilitytoHitCalcStandardMelee, X2AbilitytoHitCalcStasisLance), so unfortunately any mod that also overrides any of these classes/files will conflict. These conflicts shouldn't cause any problems, only that 1 mods changes will be take effect in the game at one time.  If for some reason you have a conflict and you want FairRNGMod to take precedence over the conflict (without wanting to remove/disable the conflicting other mod) there is a setting in the INI file for this that will tell the mod to try and force it's appearance. Hopefully that' won't be necessary. Additionally, these mod contains a "fix" for a few vanilla abilities that incorrectly have their toHitCalc object specified. (Without this fix overrides to toHitCalc won't work for most attacks in the game). This doesn't require any overrides and simply modifies a few ability templates 'StandardShot', 'PistolStandardShot', 'SniperStandardFire', 'LightningHands' and 'AnimaGate') at runtime in a presumably safe way. This shouldn't conflict with any other mods as at worst we'd just be duplicating each others efforts.



TECHNICAL DETAILS


We are interested in modding the "Random Rolls" involved in attacks in the tactical game. All attacks are represented by "Abilities" in the game, and abilities use X2AbilityToHitCalc objects to perform the "to hit" calculations when an attack is made. Essentially this mod replaces part of the toHit Calculation in these objects (overriding X2AbilitytoHitCalc_StandardAim, X2AbilitytoHitCalcStandardMelee, X2AbilitytoHitCalcStasisLance) replacing the internalRollForAbilityHit() function. Basically we just replace the standard RNG Roll (generates a number between 0-100) with our modified one, that also generates a number from 0-100, but with different probabilities (distribution) to get the %'s we want. Our first attempt is using an "average sum of 2 rolls" (type of Irwin-Hall distribution). There is one small catch in that the vanilla game uses the same roll for hit/miss, to determine the type of hit (crit/graze/regular). So in order for our new distribution to not mess up the vanilla hit-type ratios, we actually introduce a second roll using the standard uniform distribution to determine hit type, so everything works out nicely.


HISTORY


I originally conceived of this mod for the previous XCOM 2012. With no official mod support (and many deterrents) I had to keep my aims as small as possible. What I wanted to do was a simple tweak to the probability distribution curve. Going from a uniform distribution (where each "roll" is just as likely as any other. Ie. Typical RNG, dice rolls, coin flips etc) to a crude approximation of a "normal distribution" (both the high and low rolls at the extremes are actually less likely than more "average" rolls near the middle). The idea being that the most unlikely events (extreme misses, extreme hits) are the ones that often feel the most unfair, and so this would allow us to tweak them so that they aren't as frequent). The crude approximation was actually just going to replace a single "roll" with the average sum of two rolls (instead of rolling once, roll twice, add them together and then divide by two). The aim being that this was a hopefully small enough change to making the modding easy, as it required replacing only a single line.  Unfortunately due to failed attempts at assembly injecting, and the script editing process being an absolute nightmare, this just didn't work out at the time. However it seems XCOM EU modding has come a long way since then, and this mod for the previous game might actually be possible now (and based on how much work THIS version's modding was, it might actually be easier!). So this mod continues the spirit of the past idea and to be as simple as possible, initially is keeping the "average sum" method of rolling. However XCOM 2 mod tools, while extremely powerful, meant this simple mod actually ended up being much more involved. So since I had to do all the ground work getting it up and running, it's possible now that I might investigate other choices for how to do the rolls to give better control over the probability distirbution.


FUTURE PLANS


As we have already mentioned, the purpose of this mod is an experiment: to see if changing the RNG distribution has a positive effect on players experience with the game. If the shots hit/miss more like the player expects, will that make the game more fun?  In the interesting of getting this mod out as quick as possible, the first version is using a simple/crude approximation to a normal distribution (the average sum of 2 rolls), which seems to provide a nice change to the percentages in that extreme misses are less likely and more "average" rolls in the middle become more common. If you look at the table, you can see that all shots above 50% aim are improved in this distribution (although the lower the Aim %, the less improvement).  Personally I think the most "unfair" results in XCOM come from much higher percentage shots. So ideally a better distribution would allow us to affect the high % shots more and leave the lower percentage shots mostly unchanged. Hidden in this mods config/ini file are some settings for prototype support for a different distribution, specifically an actual normal distribution rather than a crude (and rather linear) approximation of the average sum. I have them in there mostly for testing purposes (which I haven't had time for yet) for future improvements to the mod. But those mathematically inclined and/or curious way wish to tinker with them. Turning useAverageSum= False and useGaussian=True should enable the use of the gaussian/normal distribution. You can then further specify parameters for the distribution (Standard Deviation and Mean) to tweak the shape of the curve. By default I've provided some interesting values that I'm testing, that while still improving the high % shots, actually improve the lower % shots much less, and fall back in line with vanilla as you get to 65% aim (which conveniently is the Rookie default Shot %).  So rookie shots would play out as normal and it's only once you start to get over 80% and higher that you feel a noticeable improvement in successful hits. Again this feature is largely untested so use at your own risk, but nothing in this mod should adversely affect any save game so if anything goes wonky just disabling it should be fine.


UPDATES



V1.0 Initial Release
  • March 2016 patch - This mod was developed on the initial release version of the game. It hasn't thoroughly been tested on the March Update version of the game. From what I can gather doing preliminary checks, everything seems to work fine. The only change that might affect this mod is the patchfix to greater than 100% Aim shots and how they impact the crit/regular hit ratio. But even then I think this mod shouldn't factor in as the inherent way we have to do the toHit Calculations eliminates this problem in the first place.



=====================================
Redistribution, Licence & Disclaimer:
=====================================

Modifications of this script are allowed only where this notice is included, the author's
copyright is acknowledged and credit is given to the original author of the script (aggies11).

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.