project-navigation
Personal tools

Author Topic: Aimed Shot doesnt hit  (Read 8416 times)

Offline MrFusion

  • Cannon Fodder
  • **
  • Posts: 5
    • View Profile
Aimed Shot doesnt hit
« on: December 14, 2010, 05:19:48 pm »
This has happened numerous times now:
If i fire a sniper rifle wit an aimed shot and have 99% hit chance, the shot wont hit

Offline Tamanfodder

  • Rookie
  • ***
  • Posts: 84
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #1 on: December 16, 2010, 03:05:24 am »
Simple! 99% accuracy means that you hawe 1:100 chance of missing! This is not a bug! It`s bad luck! Report this as a bug if you miss with 100% chance of hitting!  ;D

Offline Duke

  • Administrator
  • PHALANX veteran
  • *****
  • Posts: 1037
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #2 on: December 16, 2010, 11:03:43 pm »
The 'chance to hit'-calculation is a little off anyway.

Offline CheeseshireCat

  • Rookie
  • ***
  • Posts: 82
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #3 on: December 22, 2010, 04:00:53 pm »
More like it is totally off. With a sniper rifle, aimed shot showing about 65% probability to hit in reality has about 5% chance of hitting. Checked that by using multiple restarts on a mining/Asia UFO crash map, because there it repeatedly deployed one sniper where I could crouch and fire at an alien deployed in the same spot on turn one in 19 out of 20 loadups. And even when hitting, a kill (even against a non-armored one) was scored in about 1/10 cases.

Now, the funner part. A rocket launcher shot at the same target from same spot with displayed hit probability of about 30% was scoring a direct hit in two out of three shots (and in all other maps, it's apparently the most accurate weapon). A kill was scored only in half the hits, though. And frankly, it seems to cause almost no splash damage whatsoever. I only twice managed to kill someone with splash damage, and it includes the cases with aliens standing adjacent to each other in a small (3x4) room, so there just was NO WAY to not catch them in the explosion. So I score a direct hit on one, it dies, but the other just goes like, "Huh? Someone farted?" :)

What's the problem with using the same thing to determine hit probability when aiming and when the actual shot is fired?

Offline Lew Yard

  • Squad Leader
  • ****
  • Posts: 111
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #4 on: December 22, 2010, 09:33:08 pm »
What's the problem with using the same thing to determine hit probability when aiming and when the actual shot is fired?

The game doesn't work that way.  That is, it doesn't calculate a hit probability, roll to hit, and then consults tables to determine what to do with misses.  What it does do is determine how much angular deviation there is (from aim point, normally central) based on a Gaussian distribution where the standard deviation takes into account the weapon, fire mode, crouching, accuracy stat, weapon skill, and significant injury.

Offline CheeseshireCat

  • Rookie
  • ***
  • Posts: 82
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #5 on: December 22, 2010, 11:43:24 pm »
Hm. Still, I think at least for an /unobstructed/ shot, calculating the odds of hitting should give a more or less correct value, so it's clearly a matter of using a wrong formula.

While I am not much good at programming anything other than a DB, I am pretty good at statistics and stuff, so maybe could come up with a solution.

There is another way to skin the cat, too, though... What comes to mind is -- since the hit probability is calculated to above-zero only when you actually target an alien anyway, the computing overhead won't matter that much...

Create a "camera" view that'd render the target single uniform color, everything else -- a different single uniform color, with the angle based on the spread, then calculate a weighted area. Or maybe just pop it up in the corner of the screen and leave it to the player to decide whether it's worth the shot :)

(This is speaking of direct-fire weapons -- and do I assume right that wind/gravity don't factor in, only uniform circular or elliptical spread?)

Offline Lew Yard

  • Squad Leader
  • ****
  • Posts: 111
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #6 on: December 23, 2010, 12:51:01 am »
The most direct approach would be to Monte Carlo it -- run an arbitrary number of "mock shots" and count up outcomes (hit target, hit a different enemy, hit a friendly, hit nothing).  It'd have to be fairly careful to preserve properties like throughWall (something which I vaguely suspect the code doesn't handle; currently, it's possible in certain situations to have fairly likely hits with the hit estimator saying *0%* because you're shooting through a wall).  Run an infinite number of mock shots and it should converge to the correct values regardless of cover. 

The obvious reason not to always throw e.g. 100+ such shots (or, say, keep throwing them in batches of 10 until the estimates stabilize to within some tolerance) is the CPU cost, which might be more bearable if instead of always being calculated while you're waving the targeting cursor around (which is quite possible if you're using grenades or rockets), perhaps it should require an explicit key press or something.

Offline Lew Yard

  • Squad Leader
  • ****
  • Posts: 111
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #7 on: December 23, 2010, 12:58:10 am »
Incidentally, one complication of how one might handle estimating how often one might hurt entities other than the target is that it is possible, AFAICT, for one shot in a burst to kill a target that was shielding another target, and for a subsequent shot in the same burst to hit the now unprotected target.  In the most straightforward form of 'mock shots' where a flag is set that skips doing damage, you'll miss this case.

Offline CheeseshireCat

  • Rookie
  • ***
  • Posts: 82
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #8 on: December 23, 2010, 01:45:53 am »
Um. Are we talking kill chance here or a hit chance?..

Offline Shoyusha

  • Cannon Fodder
  • **
  • Posts: 1
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #9 on: January 25, 2011, 01:25:08 pm »
I registered just to post in this thread. That's saying something because some genius, in setting up this forum, thought that someone would commit sixty teraflops of processing power on bruteforcing my usual password (which is seventeen characters long but contains no numbers) for some backwater forum and so I had to make some inane combination of letters and numbers.

ANYWAY.

This is a real problem. It's not "people being unlucky", it's a bug. It never hits. Snap shot is significantly more likely to hit than aimed shot in all situations. This game is excellent and I look forward to a bugless crispy-fresh ironed version in the future, however this particular issue isn't great as new players may not know to just always use snap shot instead of aimed shot. Could possibly be an easy fix too; compare the code for aimed shot to snap shot and see if there is an obvious issue.

EDIT: I want to clarify as I do not want to appear ungrateful for this brilliant open source game; I am willing to post logs, take screenshots, etc., however I don't see what I can post in a bug report to help with this problem. If there's anything I can do to help, let me know.
« Last Edit: January 25, 2011, 01:32:08 pm by Shoyusha »

Offline CheeseshireCat

  • Rookie
  • ***
  • Posts: 82
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #10 on: January 25, 2011, 04:30:54 pm »
In my experience, an aimed shot hits way more often than a snap shot. But a snap shot from kneeling position is about 3-4 times more accurate than an aimed shot from standing position. (I am not talking displayed chance to hit but actual hits from long distance here.)
Also, a question -- does aimed shot become less accurate at short range? (I'd expect it to, actually, IRL.)

Offline CheeseshireCat

  • Rookie
  • ***
  • Posts: 82
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #11 on: January 26, 2011, 02:58:08 pm »
Simple! 99% accuracy means that you hawe 1:100 chance of missing! This is not a bug! It`s bad luck! Report this as a bug if you miss with 100% chance of hitting!  ;D

Woo, I just had exactly that happen :)
A sniper at short range, showing 100% hit probability, *MISSED* :) The bullet hit the wall to the right (from the sniper's POV) of the alien.

Here's how the shot went.

Offline wheel83

  • Rookie
  • ***
  • Posts: 29
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #12 on: March 04, 2011, 01:15:57 am »
I stopped using the sniper rifles all together and just went for assault rifles and rockets. I just found the sniper rifles to be useless and too much of a risk. It's a shame though, I thought they would be cool to have on rooftops and shit.

Offline Sepelio

  • Rookie
  • ***
  • Posts: 37
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #13 on: March 05, 2011, 01:42:38 am »
Rockets are freaking awesome. Love em.

Offline Kobura

  • Rookie
  • ***
  • Posts: 31
    • View Profile
Re: Aimed Shot doesnt hit
« Reply #14 on: April 29, 2011, 02:25:34 pm »
Incase it's relevant, even in Dev2.4 (not super-current build, but newer than 2.3.1) I've noticed sometimes shots just aren't allowed to hit aliens in certain places on certain maps. I've played enough to recognize when something's being strange, and instead of aiming directly at them when this happens (telltale signs include but aren't limited to several consecutive 99% shots from different soldiers missing at mid-range, unobstructed target) try aiming a few tiles behind them with their body "blocking" the shot.

See what happens. I'm curious.

Also about the password: yea it's damn ridiculous. I understand making it hard for spambots but it's actually hard for the real humans too now. Who won that battle?  ::)