aliens

Author Topic: "Realistic accuracy and cover system" option  (Read 8538 times)

Offline Juku121

  • Commander
  • *****
  • Posts: 1798
  • We're all mad here.
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #15 on: April 13, 2024, 11:43:45 pm »
So, I'm not only planning to "put that behind RA", but hope to fix it to reasonable state first.
Fair enogh. I quite liked the ability to see the 'hit roll' when I last tried. Perhaps too much PF WotR. :-[

In other words, 100% hit with good enough explosive, or 83,5% (good) hit with weak grenades
Yep, one of my problems with grenades in general. I seem to be somewhat in a minority, though.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #16 on: April 14, 2024, 11:14:15 am »
I seem to be somewhat in a minority, though.
I've heard a significant number of complaints about this issue from different people, throwable explosives are just much more efficient overall. I'm not sure for 100% but I think mods' developers (I recall XCF in particular) try to mitigate that advantage somehow.

UPD:
Tried original DOS version... What should I say? OXCE perfectly represents old algorithm :)
« Last Edit: April 14, 2024, 02:39:54 pm by jnarical »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #17 on: May 04, 2024, 11:38:04 pm »
Latest changes in RA part (not that much)


1) There's a kind of old bug where unit is elevated, target point belongs to the upper tile, and my code wasn't detecting that unit in one function, but detected in another, so there was discrepancy (50% no-LoS penalty was incorrectly applying in applyAccuracy, but not in drawTerrain). Yes, that's a part of that known bug with tank in XPZ, seems like its fix wasn't complete

2) All arcing shots now work with classic accuracy code, so no "precise" chance to hit or checking % target visibility. It immediately fixed related bugs (I've closed two issues in github). It is temporary solution ofc, I just want to narrow down all other bugs before starting to write "arcing RA" part. This could be confusing so I'll repeat)) RA is disabled for all arcing shots!

3) Two bugs - one in RA part in applyAccuracy, setting target voxel for missing trajectory outside of the map. I didn't think that would be a bug, as any voxel outside of the map still could be used as a valid target for a shot... but the issue comes when this voxel is used to get a tile from it, somewhere in code, and gives invalid tile. So I've restricted search for missing trajectroies only inside map boundaries. Second one - there's 100-times cycle which don't do anything useful, if target voxel belongs to invalid tile. I've added early break from the cycle in that regard.

4) Rollback that unlucky grenades accuracy commit that Meridian told about

My real life takes over one more time, so I cannot have as much time dedicated to OXC development as I want, but hope it'll change.

Offline aziza

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #18 on: May 08, 2024, 07:03:33 am »
brown accuracy digits are a cheat
it will show you exactly where the alien is, even if you can't see it, just move the crosshair from your ship over the UFO



Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #19 on: May 08, 2024, 07:07:55 am »
brown accuracy digits are a cheat
it will show you exactly where the alien is, even if you can't see it, just move the crosshair from your ship over the UFO
Thanks, I’ll look what could be done here.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #20 on: May 10, 2024, 12:51:44 am »
brown accuracy digits are a cheat
it will show you exactly where the alien is, even if you can't see it, just move the crosshair from your ship over the UFO
Fixed, It was trivial.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #21 on: May 11, 2024, 06:56:37 pm »
Fix is available in 8.5.0.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #22 on: May 12, 2024, 04:48:50 pm »
After I've got a couple of positive opinions about my version of throwing accuracy code, I've decided to return it back to game, under new option (independent from RA) - "Alternative throwing mechanics".

Here's the reasoning behind it.

There is applyAccuracy function, which applies unit's accuracy, adding deviation to target voxel, and there're several issues here.

1) Resulting deviation for successful rolls is not enough to make grenade fall to tiles, adjanced to target. It always falls to target tile in that regard.
That feels unnatural.

2) Resulting deviation for unsuccessful rolls feels unnatural too - grenade could fall too far away from target

3) Accuracy for direct shots counted the same way as for throwable explosives. Throwing accuracy of 70% means that roughtly 70% of the time that highly explosive thing will hit the ground right under the target unit, demolishing both the target and surroundings. This is the main issue - although there's a distance modifier, it doesn't affect "successful" rolls. So, no matter how low your accuracy is, if you get a succesful roll - your grenades turn to a "sniper" ones. There's no significant difference between high and low throwing accuracy.

For successful hit with explosives - you doesn't need a precise hit to a voxel inside target's body, hitting any tile around it can be considered as success, to a different degree depending on a distance from target to explosion.

As a quick and dirty solution, for "Alternative throwing" option

1) I've added additional deviation so grenades could fall around the a target more naturally

2) Decreased deviation for "missed" rolls (again, to make them look more natural)

3) I've changed the formula, introducing accuracy additional penalty based on accuracy and distance. Distance without penalty is equal to square root from unit's accuracy multiplied by 3. All numbers are arbitrary and are subject to change of course, now I consider them as pretty conservative.

That way, a unit with T.Accuracy=36 could throw to 6 * 3 = 18 tiles without a penalty, and then it gets additional 16 voxels of deviation for every additional tile of distance.

T.Acc=49 gives 21 tile of "aimed" throwing
T.Acc=64 gives 24 tiles
T.Acc=81 gives 27 tiles
T.Acc=100 gives 30 tiles

With these changes, grenades are much less precise and powerful, you couldn't throw them across the whole map straight to target's feet anymore. But they are still powerful enough in hands of people with good throwing accuracy. Different accuracy and strength now matters more - there could be situation, when you got a soldier with good strength but poor accuracy.. so he could throw anything across the map, but without any precision, On the other hand, another soldier with poor strength never gets a penalty, as he just couldn't throw far enough, so he always hit target OR one ot its nearest tiles.
« Last Edit: May 12, 2024, 04:50:44 pm by jnarical »

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #23 on: May 12, 2024, 07:20:09 pm »
1) I've added additional deviation so grenades could fall around the a target more naturally
2) Decreased deviation for "missed" rolls (again, to make them look more natural)
3) I've changed the formula, introducing accuracy additional penalty based on accuracy and distance. Distance without penalty is equal to square root from unit's accuracy multiplied by 3.

Hey Mister) thank you for the new tossing mechanics. Could be a gamechanger.
- Can you share the exact formula? Is it bell engine or flat random around the target?
- What's the penalty per tile past optimal distance?
- I would like you to consider adding critical success toss too (i will share insights below in text, FYI)

For discussion:
1) Considering major mods, ordinary throwing skill is 40-50 for majority of troops in the beginning. THR skill cap is usually 80-90 (w/o commendations, which give additional +5 after many battles) 
According to lore, throwing 35 is somewhere ordinary man skill, while 50 is beyond that. 85 THR should be human olympic champion

2) Besides, there's one more sufficient parameter: STR. In OXCE, STR is the limiter of THR distance (and it should be), but what I feel is: to a lower degree, it can influence THR preciseness as well. Say, THR skill should have weight of 75% and STR should have weight of 25%. Some armors effectively reduces weight (like, weight= -40) and will not provide any bonuses, while armors, that boosts soldiers' strength (like, +50 STR) will have additional 12,5% hitchance.

3) The critical THR success possibility should be incrementally higher to apply on closer targets. For example, the low-skill trooper (40 THR skill) throws grenade:
- 2 tiles away should have at least 90% underfeet chance,
- 5 tiles away should have, like, 65%
- 10 tiles away - your penalties and deviations come into full power

For example, high-skiller trooper (80 THR) should be able to toss grenade well across the map. It is rather rare to find out such units in your rooster, but some mods present you units better (and stronger), than humans.
For these units, critical THR success chance should proliferate to a longer distances.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #24 on: May 20, 2024, 10:28:57 am »
Added some fixes, including important one. Changes involve "missing shots" mostly, improving how they work.

1. When targeting a unit with autoshot, and that unit is killed before all the projectiles are launched - remaining projectiles no more target the floor, they still aim to that target voxel which was part of that unit's body.

That's normal targeting behaviour for OG and always was that way, and I considered it a bug in RA. Now  it's gone, and heavy multiple projectile autofire weapons, like chainguns - work correctly. That was a small code change, but it'a big deal, really.
.
2. Now when shooting empty tile, roll-based hit/miss mechanics considers "virtual" medium-sized unit as target for calculating missing shots. So, if your accuracy roll gets a miss - shot will fly outside that "invisible" unit (but it surely could fly through the target tile at the same time)

3. Since the OG, when targeting empty tile, target voxel is fixed depending on tile type - 2 types of walls, floor, ceiling, object, or void. For example, for "void" tiles target is (8,8,12) inside that tile, its center. For RA, when targeting such tiles and rolling a hit - projectile now gets light deviation around that point. And when rolling a miss - yes, it'll fly outside invisible unit))

I've tested that code a little, in classic, XCF and 40k. All seems fine.

My next goal will be adding two things simultaniously:

1) "weightened" effect of target's exposure.

Possible options would be: 0% (off), 30% (light), 50% (medium), 70% (high), 100% (full)
In current version, it's 100%/full.

For example, you got 100% accuracy shot to 30% exposed target.
With different settings, final accuracy will be:

0%/off: 100%
30%/light: 70% + 30%*0.3 = 79%
50%/medium: 50% + 50%*0.3 = 65%
70%/high: 30% + 70%*0.3 = 51%
100%/full: 100% * 0.3 = 30% (current RA version)

2) "Sniper accuracy mechanics" - portion of accuracy, exceeding 100% initially, added after calculating exposure effect. And that could be weighted based on shot type, if needed. Time will tell.

For example, you get very high accuracy shot to a highly covered target. Initial accuracy 180%, target exposure is 5% (basically, some sectoid looking from a small window, with only its head exposed). Even with 100% exposure weight from the previous option, you get 180*0.05 (9%) + 180-100 (80%) = 89% chance to hit, where 80% part is for "sniping".

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #25 on: May 21, 2024, 11:57:58 am »
2) "Sniper accuracy mechanics" - portion of accuracy, exceeding 100% initially, added after calculating exposure effect. And that could be weighted based on shot type, if needed. Time will tell.
For example, you get very high accuracy shot to a highly covered target. Initial accuracy 180%, target exposure is 5% (basically, some sectoid looking from a small window, with only its head exposed). Even with 100% exposure weight from the previous option, you get 180*0.05 (9%) + 180-100 (80%) = 89% chance to hit, where 80% part is for "sniping".

Hey Joy, all changes are very nice and appreciated. Few things I would like to put your attention into:
- sniper shots exceeding 100% may be worth reconsidering formula, because weapon accuracies had been balanced around different shooting mechanics. Plain over-100% growth of hitchance is something that will make it surreal that 130% accuracy-guy will have 80% of actual chance to hit 50%-covered unit, while 100%-guy will have plain 50%. May it be 1/3 penalty for everything beyond 100% too, be worth considering. 

- empty-tile shooting is somehow broken in OG:
* when you have a wall adjacent to a tile you shoot: sometimes unit shots into wall, instead of a tile.
* when tile is empty or beyond visibility range, (or enemy that stands on it is undiscovered yet) - shooting goes into the ground tile. That is part of mechanics and is purposeful for number of things: killing downed enemies, lighting ground with plasma etc. But sometimes it is worth to shoot through this particular tile so bullet can fly past it and hit everything beyond.
Moreover, when player targets tile that is located above, fly-through shots are hard to make. E.g. unit stands on ground, supposed enemy is located on 4th floor 30 tiles away, unseen, then default firing results in shooting into the ceiling of 3rd floor, not window/wall of 4th floor. 
I suggest making one more shooting option: shooting into tile's center 1/3 height. This could be, possibly, tied to ALT button, instead of default shooting, which clearly should keep it's designation of ground aiming, if no enemy or object is located on the target tile.
To remind, CTRL is engaged for "shoot no matter what action", so CTRL+ALT+click must result in shoot no matter what, but into the 1/3 height of the tile.

- as we go through hit/miss rolls, there is one more thing I would like to suggest, regarding the visible targets shooting:
BASIC
* roll for hit means bullet flies into the target voxel
* roll for cover means bullet hits target OR cover, but within target voxel cone
* roll for miss DOESN'T mean necessary miss, but instead gives random shot within cone, where shot can go everywhere. (even, into the target, randomly)
DIFFERENCES for abovementioned ALT-method
*ALT+ roll for hit means bullet flies into target's voxel center's 1/3 height, even if there is cover (contrary to the specific case when unit shoots precisely into the finger, which sticks out from the window. Prove me incorrect, if CTRL+shooting already goes into center, not open-part of the body)
* NO COVER is considered when calculating ALT-shots. If there's cover, indeed, it is up to player to consider this method. This method is specifically good for destruction covers with heavy weapons.
* roll for miss works as default (goes everywhere, even into the target, randomly)

Wish you best!
 
« Last Edit: May 21, 2024, 12:00:59 pm by Abyss »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #26 on: May 21, 2024, 01:38:45 pm »
- sniper shots exceeding 100% may be worth reconsidering formula, because weapon accuracies had been balanced around different shooting mechanics. Plain over-100% growth of hitchance is something that will make it surreal that 130% accuracy-guy will have 80% of actual chance to hit 50%-covered unit, while 100%-guy will have plain 50%. May it be 1/3 penalty for everything beyond 100% too, be worth considering. 
1) About the formula - all numbers are just arbitrary... Maybe a threshold for sniping should be equal to unit's own accuracy? I don't know, but the core idea of sniping is just like that) Your example has a mistake... 130% accuracy to 50% covered target will be 130%*0.5 + 30% = 95%... and this mechanics should be used with "partial"effect from cover. It'll make 130% accuracy even more powerful and 100% accuracy to half-covered target - less penalized.

- empty-tile shooting is somehow broken in OG:
* when you have a wall adjacent to a tile you shoot: sometimes unit shots into wall, instead of a tile.
* when tile is empty or beyond visibility range, (or enemy that stands on it is undiscovered yet) - shooting goes into the ground tile.
 
It's not broken. It chooses target voxel based on tile type, and it's different one for different kinds of walls. About a tile with undiscovered unit - it's also makes kind of sense. And what about shooting in desired direction - as far as know, CTRL works just like that. To me at least, it works as "target the center of a tile, regardless of its type". So, if you'll shoot a tile with an undiscovered enemy with a CTRL, you'll get precisely what you want. I was experimenting with it lately, without CTRL a bullet goes to a floor (for a "floor" tile without a wall), with CTRL flies "horizontally" (considering the fact that gun's barrel is higher than tile center, it goes downwards slightly)

- as we go through hit/miss rolls, there is one more thing I would like to suggest, regarding the visible targets shooting:
BASIC
* roll for hit means bullet flies into the target voxel
* roll for cover means bullet hits target OR cover, but within target voxel cone
* roll for miss DOESN'T mean necessary miss, but instead gives random shot within cone, where shot can go everywhere. (even, into the target, randomly)
DIFFERENCES for abovementioned ALT-method
*ALT+ roll for hit means bullet flies into target's voxel center's 1/3 height, even if there is cover (contrary to the specific case when unit shoots precisely into the finger, which sticks out from the window. Prove me incorrect, if CTRL+shooting already goes into center, not open-part of the body)
* NO COVER is considered when calculating ALT-shots. If there's cover, indeed, it is up to player to consider this method. This method is specifically good for destruction covers with heavy weapons.
* roll for miss works as default (goes everywhere, even into the target, randomly)
I didn't get much tbh but I'll look again outside my working hours))

For now, I can tell that destroying covers already works well with CTRL. I'm not sure where target voxel precisely is when you aim a unit with CTRL... Both ways are possible, I should check. For now, I don't get why you're asking for another firing mode, my guess is that you want to have a way to shoot slightly down... for destroying obstacles with HE shots, for example. So those HE shots could explode more often and not fly away to the sky ))

UPD:

For HE ammo, I've already adjusted target point to a lower one
« Last Edit: May 21, 2024, 02:05:47 pm by jnarical »

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #27 on: May 22, 2024, 01:20:54 pm »
Thanks for clarification, CTRL+shooting indeed goes to the waist-level of the target empty tile. Shame on me for not knowing it for 7 years.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #28 on: June 04, 2024, 09:21:06 pm »
New update to Realistic Accuracy. Internally I consider it as "RA v1.0" and it's a huge milestone.

What's added / changed:
  • I've changed, almost removed accuracy caps. Now it's 1% / 300% for minimum/maximum respectively. Was 5%/95%. It was a quick and dirty fix, in the nearest future I'll change that to 1/1000 :) I plan to remove upper cap entirely by default, and to add "98% upper cap" as menu option. Reason: as I found out, in mods like XCF one could possibly get up to 600 final accuracy... So who am I to disallow that? :)

  • Now short-ranged aimed shots have 100% cap instead of 95%. After some distance, you could be sure that you won't miss.

  • New option: cover efficiency! It means - how much of your accuracy is affected by targe'st cover. Possible values are 0, 30, 50, 70 and 100%. 0% effectively disables all cover-based accuracy penalties - so you get vanilla-like hit chances. 100% means all your accuracy is multiplied by target exposure percent - that's how RA used to be earlier. Default value will be 50%, with 70% as a more hard/tactical option. Calculation example: you're targeting enemy with 10% exposure, your accuracy with bonuses like kneeling is 120%, and cover efficiency is set to 70%. That means, we take 100-70=30% of your accuracy as unaffected, that would be 120%*0.3=36%. Then, we take the remaining 70% of your accuracy (120%*0.7=84%) and apply target exposure to it: 84%*0.1=8,4% - and then we add the numbers together: 36+8,4=44.4% - and that would be your final accuracy, except for the case with aimed shot - 'cause there's another option!

  • New option: sniping mechanics. Here's how it works. Imagine you got a unit with 83 own accuracy stat. That unit is performing an aimed shot while kneeled, gets 120% weapon bonus for aimed and 1.2 multiplier for kneeling, which gives us 83*1,2*1,2=119,52 (120 like in the previous example, if rounded). We get sniping bonus as (total accuracy - unit's accuracy)/2, which is (119,52-83)/2=18,26. Adding that to the result of previous example, we get 44,4+18,26=63% chance to hit - that's almost 2 of 3 shots. That way, aimed shots now have significant tactical advantage against heavy covered targets, negating their protection from cover. Sniping bonus couldn't make your accuracy higher than you "initial final" accuracy, and is capped at that value. For shots which were improved to their maximum value by sniping bonus - crosshair cursor becomes white, which means "Look! You'he got a good sniper shot here, congrats!" Another small detail about this mechanics - accuracy size multiplier for targeting big units doesn't counts in sniping bonus, but... it's still used for accuracy calculation before applying bonus.

    But don't forget, that even if auto-shot has a much smaller initial chance, it has a good chance to destroy the cover so remaining shots wil have much better chances against the target, opened to fire.

  • And the last one... I've updated russian translation.

Feel free to test and give feedback, positive or negative! And don't forget to submit bugs, too.

Offline aziza

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: "Realistic accuracy and cover system" option
« Reply #29 on: June 05, 2024, 09:07:32 pm »
New option: sniping mechanics.

Realistic accuracy improved aimed shots

New option: cover efficiency! Default value will be 50%

Realistic accuracy cover efficiency
is default value 50% ? or 70% ? now it seems to be 70% default value (image below)
which value will be the best and most brutal?

« Last Edit: June 05, 2024, 09:12:56 pm by aziza »