Author Topic: [OLD] Old OXCE discussion thread  (Read 674628 times)

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: OpenXcom Extended
« Reply #90 on: September 28, 2014, 09:17:50 pm »
I'm starting to think we're talking about different things.

From the code, it does seem like the dropoff is taken into account, so your accuracy (the % to hit displayed on top of your cursor) depends on: Firing accuracy, weapon accuracy and the distance beyond max range * dropoff. Basically, chance to hit = FiringAccuracy * WeaponAccuracy - (DistanceOverMax * DropOff).

Now if that value drops to zero or lower, it is set to 0. Afterall, you can't have less than a 0% chance to hit. What happens when it is 0% is beyond me from a code perspective, but game wise, you miss, which is as expected.

I was talking about the period during which accuracy is above 0% and how that value decreases. I am guessing you are talking of when it hits 0% and beyond? And/Or about what happens when you have above 0% but miss the shot? In those cases, where the shot goes can indeed be really weird (and usually tends to be towards a fellow operative, or a civilian ;)). That could (should?) indeed be improved upon so I guess.. we agree on that?

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #91 on: September 28, 2014, 09:22:46 pm »
@redv
Let's take 2 instances of MC attempt. In the first one, I am increasing alien's Psi strength by +10. In the other, I am increasing Distance factor by a factor of 2.

Each of these 2 instances will be cacled for ranges 10, 20 and 30. Let's assume Psi Str attacker = 100, Skill = 50 and basic Psi Str of an alien = 30

So, AS is constant (5000/50 = 100) while DS is 30 in the first case, 40 in the second case.


1.
A%@dist 10 = 0.56*(25+100-40-10) = 0.56*75 = 42
A%@dist 20 = 0.56*(25+100-40-20) = 0.56*65 = 36.4
A%@dist 30 = 0.56*(25+100-40-30) = 0.56*55 = 30.8

2.
A%@dist 10 = 0.56*(25+100-30-20) = 0.56*75 = 42
A%@dist 20 = 0.56*(25+100-30-40) = 0.56*55 = 30.8
A%@dist 30 = 0.56*(25+100-30-60) = 0.56*35 = 19.6

As you can see, while it is possible to balance with enemy's Psi Str on a given distance, the results are quite different for different distances. And I don't quite get what "artificial solution" means and what does it all have to do with projectile cones and angles.

EDIT: but I think you're saying that instead of an artificial % chance, the effective accuracy@range should effect the deviation of a bullet, thus rendering UFO's current accuracy formulas useless.

EDIT2: to be more clear, the current accuracy operator is "a chance to pick the perfect trajectory"; in your approach, this would be irrelevant, as accuracy operator would be "the tighteness of Gaussian cone of possible deviation angles". Am I right?
« Last Edit: September 28, 2014, 09:34:11 pm by Dioxine »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: OpenXcom Extended
« Reply #92 on: September 28, 2014, 09:57:52 pm »
Now if that value drops to zero or lower, it is set to 0. Afterall, you can't have less than a 0% chance to hit. What happens when it is 0% is beyond me from a code perspective, but game wise, you miss, which is as expected.

I was talking about the period during which accuracy is above 0% and how that value decreases. I am guessing you are talking of when it hits 0% and beyond? And/Or about what happens when you have above 0% but miss the shot? In those cases, where the shot goes can indeed be really weird (and usually tends to be towards a fellow operative, or a civilian ;)). That could (should?) indeed be improved upon so I guess.. we agree on that?

I talking about chance to hit 50% (for instance) in vanilla Xcom meaning.
But in UFO extender, after threshold accuracy sets to 0.
Actually the game is 3D. You can press F10 in battlescape and see a 3D screenshot.
Therefore even if accuracy = 0 (after threshold) you still have chance to hit in 3D space. But the angle is hardcoded.

In my opinion this behavior just workaround. True range based accuracy will be work better and will be logically in 3D.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #93 on: September 29, 2014, 02:04:08 am »
50% hit chance in vanilla means there's a 50% chance of "autoaim" kicking in and the bullet following a trajectry that the game calculates as a true shot; and 50% of it going randomly astray.

Let's start calling your system "angle-based accuracy" because the XComUtil system is also based on range (as opposed to binary accuracy in vanilla), so your monicker "range-based accuracy" is either sloppy or consciously misleading.

However I am not sure if it will work. For starters, we assume the formula is not cheating and calculates deviation without any secret modifiers. Therefore the hit chances drop geometrically: if at 10 tiles away a target has a cross-section, for example, 20 units, it will only have a cross-section of 5 at 40 tiles away. A 100% hit chance at 10 tiles turns into 50% chance at 20 tiles, 25% hit chance at 40 tiles and so on. While this would work for a game with real ranges involved, I am not 100% sure it will work for much more abstract XCom.

Perhaps more sensible will be adding a better Gaussian formula to the current system, which would kick in when the shot misses; so it doesn't miss randomly but in a flexible cone dependant on the original to-hit chances. However if the cone is too tight, much of the dice-rolled misses would hit anyway, so it wouldn't be any good.
« Last Edit: September 29, 2014, 02:09:31 am by Dioxine »

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXcom Extended
« Reply #94 on: September 29, 2014, 02:13:33 am »
i made an image that shows the drop of accuracy using pure "angle" based accuracy
i defined 100% accuracy as always hits ethereal sized unit from 6 tiles away (if no obstacle)
one can of course change the distance (6) part but the geometrical loss of accuracy always leads to "use the best accuracy weapon"-strategy in all cases :/

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #95 on: September 29, 2014, 02:23:20 am »
the geometrical loss of accuracy always leads to "use the best accuracy weapon"-strategy in all cases :/

Even worse, it defeats the purpose of three separate firing modes - with just 2 positive variables (accuracy, TU%), either all three modes are perfectly balanced to deliver exact same DPS, or they're not which makes one mode default and the other 2 modes inferior and probably never used. Further mechanics would have to be introduced (like recoil etc.) to fix that crudeness.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: OpenXcom Extended
« Reply #96 on: September 29, 2014, 02:30:33 am »
Nice work Falko!

One thing we see is that accuracy drops faster and faster as distance increase (fixed cross-section compared to the sherical area which grows as r^2) and means you better be standing right in the face of something to hit it. This explains why it's so hard to hit things in real life (a small deviation in aim means you're missing by a huge amount with some distance), but wouldn't be much fun in XCom, except maybe for a Really Up Close and Personal where you mostly use melee and don't bother shooting outside of a few tiles.

Perhaps more sensible will be adding a better Gaussian formula to the current system, which would kick in when the shot misses; so it doesn't miss randomly but in a flexible cone dependant on the original to-hit chances. However if the cone is too tight, much of the dice-rolled misses would hit anyway, so it wouldn't be any good.

YES! Please! Get rid of "sniper hits 95% of the time, but boy, when he misses, the shot actually goes sideways!". And maybe tighten the gaussian depending on the shot type? From autoshot being pretty wide to aimed shot being pretty tight?

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #97 on: September 29, 2014, 03:39:45 am »
A gaussian dice roll, and a formula that only improves upon the current model, instead of throwing it out of the window. The % value calced by Xcomutil Extender still holds true... *in lab environment*. For a standard-sized target. Suddenly though, 100% shots start to miss when there is some cover involved, or the target is small. Conversely, a dice roll that would normally be a few points short of the target value and go completely astray (like that 95% sniper) could still reliably hit a HWP or even a big powered armor with a large Loftemps cross-section defined (you may not know that, but 1-tile units have 5 or 6 varied thickness cyllinders to represent them in 3d space). Accuracy values of over 100% would finally be of use to defeat cover; and most importantly for myself, kneeling behind a rock or shooting from a window would make you really less likely to be hit.





« Last Edit: September 29, 2014, 03:41:54 am by Dioxine »

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXcom Extended
« Reply #98 on: September 29, 2014, 03:50:51 am »
a solution to counteract the geometrical loss of accuracy:
instead of randomly shooting within the cone of fire we would shoot more frequently in the middle and less frequently on the edges of the cone
see image
lets say " [snap,auto,aim]Range" defines the distance where shot on ethereal sized unit hits 50% of the time (without obstacles) so " [snap,auto,aim]Range" defines the maximal size of the cone(angle)
and accuracy defines the angle distribution so high accuracy soldier + high accuracy weapon = very high likelihood to hit exactly in center and hopefully avoid obstacles or hit targets further away
it makes hitting 4tile units easier then now
i think it makes  close combat more realistic
it makes use out of accuracy values >100%
[not sure how exactly shotguns work so no idea how it would integrate into this]

enabling angle based accuracy would need to lower the aimrange default value to ~40 so we can calculate a realistic sized cone for each shot type that does not overpower the aimshot

« Last Edit: September 29, 2014, 03:52:55 am by Falko »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: OpenXcom Extended
« Reply #99 on: September 29, 2014, 04:30:39 am »
Let's start calling your system "angle-based accuracy" because the XComUtil system is also based on range (as opposed to binary accuracy in vanilla), so your monicker "range-based accuracy" is either sloppy or consciously misleading.

However I am not sure if it will work. For starters, we assume the formula is not cheating and calculates deviation without any secret modifiers. Therefore the hit chances drop geometrically: if at 10 tiles away a target has a cross-section, for example, 20 units, it will only have a cross-section of 5 at 40 tiles away. A 100% hit chance at 10 tiles turns into 50% chance at 20 tiles, 25% hit chance at 40 tiles and so on. While this would work for a game with real ranges involved, I am not 100% sure it will work for much more abstract XCom.

Perhaps more sensible will be adding a better Gaussian formula to the current system, which would kick in when the shot misses; so it doesn't miss randomly but in a flexible cone dependant on the original to-hit chances. However if the cone is too tight, much of the dice-rolled misses would hit anyway, so it wouldn't be any good.

I don't understand what do you mean about "angle based" because if you use normal distribution, then angle = 360 degree.

Range based accuracy was a part of OpenXcom long time ago.
Latest working code: https://github.com/redv/OpenXcom/blob/rigth_shot_chance_view/src/Battlescape/Projectile.cpp#L314

Advantages:
- true calculation based on normal distribution;
- taken into account shades on the target;
- if unit on the knee, then chance to hit them reduced;
- taken into account smoke between shooter and target;
- recoil. next shot of autoshot reduces accuracy.

Disadvantages:
- unsupported latest changes in code.

I mean this range-based accuracy.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #100 on: September 29, 2014, 05:00:05 am »
Then I clearly misunderstood you, sorry. I was thinking of replacing the base mechanics that selects a "golden" trajectory with a cone of fire (hence angle), with a gaussian spread. Could you explain how your system works, in math terms, because not everyone knows C++? Doesn't it make current weapon stats completely off-balanced?

(about the scripts that mod the hit chance based on disputable ideas like not seen personally or recoil - this is beside the point now)

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: OpenXcom Extended
« Reply #101 on: September 29, 2014, 05:13:42 am »
1. calculate a baseDeviation in radian (+- 3 sigma) https://github.com/redv/OpenXcom/blob/rigth_shot_chance_view/src/Battlescape/Projectile.cpp#L352
 restrictions: 0.02 <= baseDeviation <= 2.45

2. calculate horizontal and vertical deviations in radian, based on normal distribution (you calls it "gaussian spread")
https://github.com/redv/OpenXcom/blob/rigth_shot_chance_view/src/Battlescape/Projectile.cpp#L363

3. calculate a target voxel: https://github.com/redv/OpenXcom/blob/rigth_shot_chance_view/src/Battlescape/Projectile.cpp#L372

it's all:)
« Last Edit: September 29, 2014, 05:15:48 am by redv »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5412
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: OpenXcom Extended
« Reply #102 on: October 01, 2014, 09:19:00 pm »
@Yankes! I just remembered an important feature that's missing in the original: ability to declare (if desired) separate bigob and floorob for a creature/soldier that's not killed only stunned. Could it be added to the wishlist at least? :)

Offline Yankes

  • Moderator
  • Commander
  • ***
  • Posts: 3208
    • View Profile
Re: OpenXcom Extended
« Reply #103 on: October 01, 2014, 10:48:52 pm »
I will try do it in next build.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: OpenXcom Extended
« Reply #104 on: October 02, 2014, 10:44:40 am »
This is looking pretty great! Keep up the good work!