Jump to content

Shot Miss Scattering


Recommended Posts

This is something that is brought up regularly on the forums - the when a shot misses the target, it often does so in an unrealistically extreme manner, so a soldier aiming at a target may fire his bullet up to 45 degrees away from it.

I agree this is an issue, and it's something we'll be looking at fixing in beta. This thread is intended to discuss how it can be handled, as there's been about six thousand threads on the issue and I can't be bothered to read them all.

One of the previous problems with a narrower scatter arc is that sometimes a shot would "miss" and then scatter into the target, hitting them anyway. We can ensure this doesn't happen in the code, so I'm sure we can even have bullets passing through the tile the target is standing in and not hitting him.

There are two things the new systems has to bear in mind:

1) It should look reasonably realistic. The wild shot scattering at the moment is not realistic.

2) It still needs to preserve the X-Com style "hilarity" where you can accidentally hit your own soldiers. Not to the same degree as you can at the moment, but I don't think I'd be very happy with any system that didn't model the shot missing and hitting something nearby - whether it be terrain or a civilian or even an entirely different alien.

To be honest, it might actually be as simple as narrowing the scatter arc to 15 degrees on either side or something and treating the target as having a (projectile) stopping chance of 0 if the shot is calculated as a "miss" before the projectile is drawn.

Happy to listen to alternatives though.

Link to comment
Share on other sites

To be honest, it might actually be as simple as narrowing the scatter arc to 15 degrees on either side or something and treating the target as having a (projectile) stopping chance of 0 if the shot is calculated as a "miss" before the projectile is drawn.

That will solve everything except the minor cosmetic cases when the shot will go through the target and still miss. Old XCOM occasionally done that too.

Link to comment
Share on other sites

2) It still needs to preserve the X-Com style "hilarity" where you can accidentally hit your own soldiers. Not to the same degree as you can at the moment, but I don't think I'd be very happy with any system that didn't model the shot missing and hitting something nearby - whether it be terrain or a civilian or even an entirely different alien.

To be honest, it might actually be as simple as narrowing the scatter arc to 15 degrees on either side or something and treating the target as having a (projectile) stopping chance of 0 if the shot is calculated as a "miss" before the projectile is drawn.

15° is still a lot.

All the "hits" - regardless of their percentage - are dead on target while the "misses" go off on a wild angle?

That looks broken.

There are 2 basic approaches.

  1. Target-centric.

    Game calculates the chance to hit this particular target.

    The problem with that is what to do with the bullets that don't "hit the target".

    Ideally they just vanish by impacting on indestructible scenery like in your average FPS.

  2. Bullet-centric.

    Game calculates the chance of the bullet going where you aim it.

    It could be displayed in degrees of deviation but I'd consider that too technical for gamer consumption.

    I would still represent it as a probability... only the game does not do a dice roll and directly compares to this number to determine a hit.

    (Displayed) hit calculations would have two stages. The others come after that.

    1. Chance to hit the target tile.

      Simple trigonometry. Angle a at range b covers the width of 3.71 tiles. (always calculated as a 90° tile width)

      Base chance to hit the tile is 100 / 3.71 = 26.95 %.

    2. Chance to hit the target inside that tile.

      Every "thing" in the game has a density.

      Let's say a standing soldier covers 60% of an entire tile's cross section.

      60% of 26.95 = 16.17 %

      This is your chance to hit the soldier in the tile.

      It's what the player is shown as a %.

    3. Firing.

      The game tracks the real path of the bullet based on accuracy / angle only.

      As the bullet passes through tiles, it only does a "collision check" with those tiles where it passes within 1/2 tile's distance to the center.

      That way every tile has the same width from every angle and a corner of something slim that sticks a tiny bit into the bullet's path can not "suck up" the bullet.

      In other words: The "collision mesh" of every tile - regardless of content - is not a cube but a cylinder.

      When it passes through a tile, the density of this tile's content determines whether it impacts or not.

      If someone is standing behind a stone statue pedestal with an 80% tile density, that's great cover. Try to flank that target.

      OTOH, it's not a great idea to take cover behind that birch tree with a 15% tile density.

      That only "head on" tile widths are used eliminates the bogus hits where a bullet visually passes through a tiny corner of the tile your soldier is standing in... resulting in a hit.

      At a 45° angle, 30% of the tile's real (sqr(2)) width do not exist for the purpose of collision.

    4. Cover hits and friendly fire.

      There is no difference to hitting the intended target! Friendly fire is not friendly!

      If the bullet passes through the tile, it has a chance to impact based on the tile's density score.

      Shoot through a 60% cover tile and it has a 60% chance of sucking up your bullet.

      Simple.

      A bullet that doesn't hit alien 1 (including flying right through it because it missed the collision check) can hit alien 2 right behind it. There it has the same chance to impact with alien 2 as if it had been fired at alien 2.

      Sure, you may have a 100% chance to hit that target. Your bullet is heading that way alright.

      But if it has to pass through 60% cover to reach the target tile, your chance can never be higher than 40%.

      (being in cover rocks)

      When determining the hit % to display to the player, the game would have to raycast to the exact center of the target tile and factors in the probability of hitting something along the way... including cover.

    5. Secondary materials.

      A waist-high wall has 2 materials. The wall and thin air.

      A wall tile with a window has 2 materials. On a "collision pass through", the secondary material "glass" is hit.

      That way there is no super-special handling of windows vs regular tiles.

      (except for the window breaking but that's a function of the damage model)

    6. Sniper rifles / Aimed shots

      Depending on how much you aim a rifle, the bullet gets an increasing chance to pass the density collision check of every obstructing tile. (aka cover)

      The sniper rifle gets an inherent bonus so it's the weapon of choice for shooting a target that is in cover.

      That way the sniper rifle has a seriously powerful perk without requiring massive damage or insane overall accuracy. Asymmetric weapons are a lot easier to balance. =)

      Other weapons like assault rifles may get a small bonus from aiming.

      Shotguns do not. In fact, they should get a penalty for getting past cover.

      Shotguns suck at the whole "pinpoint accuracy" thing.

      Heavy weapons would get no bonus - aiming or not. It's great when it works and you score a direct hit on the alien behind the console but heavy weapons are not that accurate.

      Again - a unified system that allows to differentiate weapons in a believable way.

      Balancing doesn't start with twiddling numbers. Half the battle is to define the mechanics and degrees of freedom in the system.

    7. Burst / full-auto fire.

      No longer a balancing problem.

      Front-loaded AP cost makes it unwieldy to use on the move like in door breaching, especially with machine guns. (use shotguns, dummy!)

      Having no "pass through" bonus - or even a penalty - burst fire is of questionable value against entrenched opponents... but it's great for hosing down something you flanked or that you caught out in the open.

      Approach a stationary MG across an open field? Nope, you don't.

      Depending on the shooter's skill, the stream of bullets can "walk" off target... or back to it... but the bullets would remain within the angle originally calculated, making heavy weapons unwieldy but deadly.

      And even the bullets that don't hit have to go somewhere, like into the target's cover...

    8. How burst / auto fire could work.

      The first shot of a burst is aimed - or rather as aimed as the shooter's base accuracy allows without any special aiming ticks.

      This gets us a firing arc and the usual hit % display.

      Next the game determines where in that arc the first shot will go.

      This is the angle where we start firing the burst.

      Next we look up the weapon's burst angle. This is defined for every weapon as the maximum angle that a burst can "walk".

      Within that limit, a random angle around our starting angle is chosen.

      This is the next point in the process.

      The first 3 rounds of the burst walk towards this 2nd angle. So yes, you can actually miss the first shot and then walk the fire even further away.

      That's where real machine guns come in.

      The 4th and following rounds in the burst walk back towards the intended target at a speed of [1/10 weapon burst angle] per round.

      This direction of movement is only determined once and does not stop, even if it should walks over and past the intended target.

      Length of burst would be a key balancing factor of machine guns.

This system unifies hits and misses and eliminates the completely unbelievable hits/misses.

Shooting at a tank (maybe 80% coverage per tile) it would be pretty impossible to miss because you can hit 2 or 3 "tank tiles" in a row, each with it's own 80% chance.

But if only one tile of the tank is sticking out behind a corner, that's a different ballgame.

Shoot at a wall and your chance to hit the wall piece you're aiming for is the same chance as the bullet landing in the target tile when aiming at an alien.

Only the wall has 100% coverage so the bullet will always impact there...

It's all the same thing in this system!

The main problem that I see is that Chris probably won't want to toss out the old system wholesale and replace it with a different one. =)

I just don't believe that a "small fix" as suggested in the OP will do anything useful.

My system isn't 100% realistic or accurate, either. That is intentional.

It contains a lot of abstraction which makes it easier to judge a shot without checking the hit % display every time.

The more obstacles in the way, the lower the chance to hit the target. A rookie shooting past 3 trees at an alien in cover? Don't bother.

Cover and obstacles mean something even if you don't have the "in cover" state.

Auto and aimed fire work asymmetrically which makes it much easier to find roles for both without resorting to extreme and unrealistic values for damage or accuracy.

Edited by Gazz
Link to comment
Share on other sites

As a333 says it is a cosmetic issue but one I feel could impact on perception of the game (ie looks like a bug and so on).

Alternatives I have suggested (or may have heard suggested, no intention to claim credit for things others have said):

Minimum and maximum shot deviation set so that missed shots deviate to either side of the target tile without passing through it (too obviously anyway) (may have been MrPyros suggestion as I can't find my own post on this subject).

Calculate the displayed accuracy to take into account miss deviation impacts.

Accuracy would need to be reduced across the board (at least invisibly in the background) to allow shots to have some chance to miss the target, especially up close.

Shot deviation (from the centre of the target tile) is determined by your hit roll.

Rolls that only just fall inside the required range to hit will be close to the outside edge of the target tile, rolls that fall just outside of the range will deviate just outside of the target tile.

Wild misses will still be able to deviate wildly (ie need under 20 to hit, roll 100 and watch the bullet disappear at a 30 degree angle).

Link to comment
Share on other sites

One of the previous problems with a narrower scatter arc is that sometimes a shot would "miss" and then scatter into the target, hitting them anyway. We can ensure this doesn't happen in the code, so I'm sure we can even have bullets passing through the tile the target is standing in and not hitting him.

......

To be honest, it might actually be as simple as narrowing the scatter arc to 15 degrees on either side or something and treating the target as having a (projectile) stopping chance of 0 if the shot is calculated as a "miss" before the projectile is drawn.

If those two, then perfect.

Link to comment
Share on other sites

Gazz provided excellent analysis. Only thing missing is penetration and obstacle heights.

If I was to add something, it would be bullets trajectory looking more natural. Currently they seem to fly directly at center of tile that was hit. Instead, they should follow the path to target and create impact somewhere in the tile.

Link to comment
Share on other sites

I left out penetration on purpose because I see no need to fix what currently happens if something is hit. =)

Height is covered in the generic "tile density" value.

It's an abstraction but a necessary one if you don't want to have an actual 3D collision mesh in addition to a drawn tile.

Some obstacles are tall but slim, others a waist high wall, yet others a window in a wall.

Only one of them can even use a height property but all can be represented by a generic density value...

Link to comment
Share on other sites

Gazz, you've described a pretty complicated system, but it covers a lot, except of some points:

Calculating chance of hitting.

That's more to Chris than to you. Why we should even show hit percent to the player? I'm sure everything you should get is "no line of fire" message, because sometimes isometrics can mess with our eyes. Read: soldiers can report if there is a wall, but they can't exactly know what is the percent of hitting that little window.

Big question is how your system will track the bullet through different z-levels. The bullet may fly higher (though they only descent now).

2. Cover and density.

Sure, you may have a 100% chance to hit that target. Your bullet is heading that way alright.

But if it has to pass through 60% cover to reach the target tile, your chance can never be higher than 40%.

This will lead to a silly situations. You are standing right in front of the alien, separated only by some low-height (say, 10%) wooden box from him, your gun practically looking in his xeno face. And suddenly you have 10% chance that your bullet will drop down and hit that box.

A bullet that doesn't hit alien 1 (including flying right through it because it missed the collision check) can hit alien 2 right behind it.

That will be the issue i've talked about earlier.

As the bullet passes through tiles, it only does a "collision check" with those tiles where it passes within 1/2 tile's distance to the center.

This will result bullets flying through the wall corners, even if the wall have 100% density.

3. Affordability

Your system surely complicate things, and every complication brings out more border cases for which you're gonna need even more complications. It should be stopped somewhere, and i'm afraid Chris already decided where it should stop long time ago. Don't get me wrong, i will be happy if something like this would function, since i cant think of something more simple.

Link to comment
Share on other sites

All I have to add is that I really want an exception to be made for the square immediately adjacent to the soldier. I should never ever shoot the waist-high wall I'm taking cover behind, or a kneeling soldier in front of me if I'm not also kneeling.

I guess it doesn't have to be an exception, depending on how the bullet trajectory is calculated. If the bullet starts from the shoulder height and only has a 15% deviation, it should never hit a wall or soldier at waist level regardless.

Link to comment
Share on other sites

All I have to add is that I really want an exception to be made for the square immediately adjacent to the soldier. I should never ever shoot the waist-high wall I'm taking cover behind, or a kneeling soldier in front of me if I'm not also kneeling.

I guess it doesn't have to be an exception, depending on how the bullet trajectory is calculated. If the bullet starts from the shoulder height and only has a 15% deviation, it should never hit a wall or soldier at waist level regardless.

I agree with some of what you said in the previous posts. However, I have no problem with the shot hitting a box that's only waist level even from the adjuncent tile because stuff like that happens all the time in real life. Take a look at some actual shoot out video from police dash cams where they are literally less than 10 feet apart. You'll be amazed at where some of the bullets go.
Link to comment
Share on other sites

Chris, I like your simple solution, but I do have a few ideas / suggestions: Either have the amount deviation related to the to hit roll i.e. if you have good chance to hit the misses are closer to the target (less scatter) OR roll two dice for misses so the scatter amount is a bell curve i.e. misses tend to concentrate down the "middle." My other thought is to make sure you include over and under deviation. In those cases I would simply have the round hit the ground in front of the target tile or simply pass through target and keep going until it hits higher terrain or leaves the map. I have no problem with a shot simply passing right through an alien or friendly as that happened in the original game, I just figured it went over the head of the target. Finally, my other suggestion is to tie suppression to accuracy. A lot of close shots making dirt, concrete chips, and splinters fly around your head are going to be much more suppressive than shots landing yards away. It should be very easy to do with with a simple modification to your suppression formula.

Edited by StellarRat
Link to comment
Share on other sites

I agree with some of what you said in the previous posts. However, I have no problem with the shot hitting a box that's only waist level even from the adjuncent tile because stuff like that happens all the time in real life. Take a look at some actual shoot out video from police dash cams where they are literally less than 10 feet apart. You'll be amazed at where some of the bullets go.

Less amazed than you might think. I've shot a few pistols; I know how easy it is to miss at that distance even when you're calm. Regardless, there's a league of difference between the level of firearms training a patrolman has and what spec ops types have. More importantly, people who have faced combat before are less erratic.

What if I compromised and said "anything above a snapshot"? The whole point is that you're taking a second to steady yourself, after all. In my head, I see a snap shot as point shooting, a normal shot as just getting sight picture, and aimed as breathing out and firing.

Link to comment
Share on other sites

Less amazed than you might think. I've shot a few pistols; I know how easy it is to miss at that distance even when you're calm. Regardless, there's a league of difference between the level of firearms training a patrolman has and what spec ops types have. More importantly, people who have faced combat before are less erratic.

What if I compromised and said "anything above a snapshot"? The whole point is that you're taking a second to steady yourself, after all. In my head, I see a snap shot as point shooting, a normal shot as just getting sight picture, and aimed as breathing out and firing.

That would be fine with me. You are assuming that the alien doesn't duck or dodge behind cover momentary then and the shooter is able to stay relatively calm? Adrenalin can really muck up your shooting. I suppose one factor that could be added would be whether or not the target is aware of the shooter. I'm actually not opposed to any of the solutions given so far because anything from Chris's relatively simple solution to the complicated ones are far better than what we've got now.
Link to comment
Share on other sites

I'm just imagining myself holding something the size of a carbine or larger--like most weapons in Xenonauts--and accidentally shooting something at my waist. It would be almost impossible, particularly if the muzzle is extending over the crate I'm behind. I guess I could see it happening as a negligent discharge while drawing a weapon

Link to comment
Share on other sites

I'm just imagining myself holding something the size of a carbine or larger--like most weapons in Xenonauts--and accidentally shooting something at my waist. It would be almost impossible, particularly if the muzzle is extending over the crate I'm behind. I guess I could see it happening as a negligent discharge while drawing a weapon
Well, keep in mind that the tiles SEEM to be somewhere between 3 and 10 feet square to me anyway. So, even at one tile your technically not brushing up and against the guy. But think about this, if you roll a miss at that range didn't something go drastically wrong? Also if I remember right you can't hit terrain in your own tile nor can you hit another Xenonaut that is crouched down in the tile directly in front of you. Edited by StellarRat
Link to comment
Share on other sites

Gazz - interesting, but as you mention in your post I don't want to go for that radical surgery (or not at this stage at least). A lot of our ground combat code is connected and redoing the accuracy stuff would be a major undertaking - certainly not the first thing we'll try.

Your precision idea is interesting though.

crusherven - cover in adjacent tiles is already disregarded from the to-hit accuracy calculation. The only problem is a "miss" can still scatter into that obstacle, so it doesn't look like that's the case. We intend to fix that.

StellarRat - interesting ideas re: deviation / accuracy linkage.

Link to comment
Share on other sites

Considering everything that's been said, I think a simple three-step solution could do the job.

1. Calculate hit chance as required by balance considerations.

2. Using bell curve distribution, plot rays out from the tile, corresponding to scatter angle.

3. For each ray, make a weighed distribution of hit probability for each tile on its way.

Tile weight can depend on:

- distance: lower weight for close tiles, higher for distant

- solidity: does the tile contain an obstacle, low weight if not (floors)

- solidity accumulator: each obstacle on the ray's way adds to it

- coordination: for friendlies tile weight is decreased.

I think the last one, coordination, is pretty important. It can be a value based on difficulty and soldier's mental state.

For the intended target weight is set at 0, since it's determined in a separate hit chance calculation.

Now with this weighed distribution you know each tile's chance to be hit in advance. It can be a good mechanic to display friendly fire chance for each target (like it's done in AoW), at least at lower difficulties. Then just roll the RNG and display the outcome it picks.

Link to comment
Share on other sites

There must be a relatively easy way of calculating how likely a miss is to pass through the target tile.

The possible deviation angle is known, the size of the tile is known, the distance to the tile is also known.

Maybe not knowing the angle of the target tile might cause some issues as that would have an effect on the chance.

If that calculation can be done prior to firing (when the game calculates the displayed accuracy for the player) then that chance can be quietly deducted from the formula.

In effect the current system is used but the players accuracy changes (in the background) on the fly to take into account the deviation of a miss.

Quick (ish) examples (numbers purely for demonstration of the principle)...

Current:

The player aims a shot at an enemy 10 tiles away.

The game calculates accuracy and displays a 50% chance to hit after all modifiers.

However if a miss is rolled the deviation arc and range will mean a projectile will pass through the target tile 30% of the time.

This is in effect a bonus 30% accuracy.

The player notices that they rarely miss, even on shots with a low accuracy value displayed.

Deviation deduction method:

The player aims a shot at an enemy 10 tiles away.

The game calculates accuracy and displays a 50% chance to hit after all modifiers.

However if a miss is rolled the deviation arc and range will mean a projectile will pass through the target tile 30% of the time.

Behind the scenes the accuracy formula deducts 30% from the hit chance to balance out the additional bonus accuracy the tighter deviation angles gives.

The player doesn't notice this as their actual chance to hit is the same as the original displayed value.

I realise that the formula may get quite complicated as it needs to take into account a number of factors.

- Deviation only happens after a miss is rolled.

- Kneeling targets (only 60% chance to hit even if deviant shot passes through).

- Deviation arc width needs to be calculated for each shot as the width would get greater as range increased.

- Tile width varies slightly from different angles.

Downside is that it would still mean short range shots would have an incredibly high (certain in a lot of cases) chance to hit as the width of the deviation would be physically too narrow to allow shots to miss (less than one tile width).

Link to comment
Share on other sites

Chris - I saw that you had modified the scattering somewhat in the beta candidate (v18) by making misses miss. Can you give us any further details about the system you finally decided on? There was a very lengthy talk about this here and I'm curious. Did you go with your first idea or what? Thanks.

Link to comment
Share on other sites

This is a relatively simple fix that GJ did himself. If a shot misses the target, it now cannot hit the tile the target is on. The misses are also assigned by normal deviation on a bell curve, so slight misses are more common.

What hasn't changed is the maximum deviation, which perhaps we should narrow. But wild shots should be much less common now.

Link to comment
Share on other sites

This is a relatively simple fix that GJ did himself. If a shot misses the target, it now cannot hit the tile the target is on. The misses are also assigned by normal deviation on a bell curve, so slight misses are more common.

What hasn't changed is the maximum deviation, which perhaps we should narrow. But wild shots should be much less common now.

That sounds like a good simple solution to me. I'll see how it works once I get the 18 version downloaded.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...