Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Gun shooting: Accuracy versus damage.

Discussion in 'General Discussion' started by uberalles, Feb 8, 2018.

?

Option 1 or option 2

  1. 1

    50.0%
  2. 2

    50.0%
  1. uberalles

    uberalles

    Joined:
    Jun 29, 2013
    Posts:
    46
    I have human characters shooting at each other (*updated: the game is an RTS). I want there to be a feeling of realism (the game takes place in an actual historical setting) but I'm conflicted on choosing between these two options:

    1. Shooting always hits its target, but you can vary the damage shooting does based on a number of factors (character's experience level, gun type). The shooting is just the muzzle flash particle effect.

    2. Shooting has an accuracy element to it, meaning not every bullet will hit its intended target. Experience and gun type will effect this. Shooting now has a bullet being rendered and an impact on target effect.

    Up to this point I've gone with option 1 as option 2 feels as though there's an element of luck if the shots are somewhat randomized. Since multiplayer is possible (or will be...hopefully) I think players will be annoyed that their opponents shots landed more often in a crucial fight.

    Any opinions offered on the matter are greatly appreciated. Thanks.
     
    Last edited: Feb 8, 2018
  2. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Both options are more geared towards an RPG type of game, and not a pure skill based shooter type of game.

    If players expect an RPG game in which they level up and this increases the chance of attack hitting target and/or damage done by attack, either of these methods is fine, it's just how you want to drive progression to keep player interest.

    But if you want a skill based shooter, or players coming into your game are given the impression that this is a skill based shooter, they are going to be upset if they have arbitrary factors inhibiting their ability to shoot the bad guy.

    But there is realistic ways to effect player accuracy. Gun wobble is the biggest and most obvious one. This can increase or decrease based on arbitrary experience level. If you are going to make it so that weapon types or character xp level introduces a random bullet offset factor, make sure the player knows and expects this.

    But even in RPG games -- and my experience with RPG games is casual ones like Elder Scroll Series -- I think the trend is to move combat from the traditional numbers based approach (taken from board game tradition) and move to a real time, skill based approach.

    I think thhe recent Fallout games strike a balance between the two styles. WIth the VAT's target system your character XP and perks play into accuracy and damage, whereas you can also skip that entirely and just play the game like a regular shooter. But weapon damage still derives from character XP and perks -- it's not just set and based on the weapon itself. Which, personally, I think is kind of stupid. It's not like a trained killer shooting somebody in the face with the same gun Aunt Sally shoots somebody in the face with does more or less trauma. Many gamers probably aren't upset about this, but for me it is an obvious gamism and thus lessens immersion.

    The first Ghost Recon games had skill tree progression, and these increased how much incoming damage you could receive, how quickly your aim wobble subsided, etc. But never gave you extra damage and the weapons accuracy/handling values were inherent. So, a maxed out character's stats were still divided by the weapon stats, which makes sense. A trained soldier can handle a machine gun better than a less trained soldier, but it's still a machine gun and nobody can fire it from the standing position with any accuracy.

    Above all, the question is not, which method to choose? The question is, what experience do I want the player to have? and then, which methods will deliver that experience?
     
    Last edited: Feb 8, 2018
    theANMATOR2b likes this.
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If you're going for realism, I don't see how you could choose bullets always hitting their intended target.

    As far as some real world data... According to a RAND Corporation study of the New York Police Department's accuracy, 82% of the bullets they fired in real situations over an 8 year period missed their intended target. And they are supposed to be trained at this :p
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    If this is the case - option 2. But the (to portray realism) the accuracy should be real low - with a lot of variables).
    Anyone who has shot weapons at other human beings know most guns are less accurate in that situation than they are portrayed in movies/games.
    Well - movies portray bad guy guns pretty accurately - never hitting anything except the side of the buildings.

    However - randomized is kind of bad - but if given to the players actual ability and knowledge of the systems - can be delivered in a bunch of different ways. If you ever played any of the Red Dead games - the face offs where the game slows down, the cursor floats all over the place and has like a noise motion on it so it is harder to pin point the location the player really wants to shoot - when first starting out. Also the slow down time is a lot faster.
    Later on when the player gets more experienced, more knowledge, more level up - the cursor has less noise on it, it is smoother, it floats less, and the slow down timer is longer - allowing the player to manage shooting at the exact spot more easily.

    Can you expand on "two players shooting at each other"? My first thought was a wild west face off.
     
  5. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    This. Is it a first person shooter or something else? What kind of gameplay is this?
     
  6. uberalles

    uberalles

    Joined:
    Jun 29, 2013
    Posts:
    46
    First off, to everyone that replied...thanks.
    I feel very embarrassed by this but I should have mentioned it's an RTS. You can have multiple units shooting at each other in a number of ways (types of guns).
    I apologize for any inconvenience.
     
    Martin_H likes this.
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,516
    The gun is exactly as accurate as it is at any other time. It's the human being who's potentially less effective in that situation. ;)

    A few things to consider.

    One is that luck is a valid enough part of combat. Usually you wouldn't get into a fight unless you were pretty sure you were going to win, but that's based on what you know or think you know to begin with. If you know much about statistics, realise that with a high enough number of bullets you can have a luck element without having it spoil the strategic part of the game. Next, that luck element can also help increase tension. For example, I can put myself in the best possible position to win a firefight, but I know that an unlucky shot from the enemy could still incapacitate a key person. On the flip side, I also know that even if things are looking grim I could get lucky.

    Next, have you played games where every shot goes exactly at its target? It doesn't feel right. It feels mechanical and unrealistic. So however you do it, and even if it's only visuals, you want to break that up a little.

    Finally, on the visuals side, I'd consider displaying attacks as bursts of rounds. This gives you a few opportunities. First, you can think about and balance damage on a per-burst basis instead of per-shot. So for a three round burst that hits you can draw three shots, two of which dramatically hit the wall near the target. Secondly, from each burst you could have one shot that deals the damage, and a bunch of other shots which are purely visual. This means you can do a lot of signaling to the player without messing with your balancing. That includes "critical hits", where your visual-only shots also show hits. Third, you can make stuff a lot more intense by drawing a lot of bullets that don't have any effect on gameplay, making things look busier and more dangerous than they really are under the hood. If you've got a suppression mechanic, particles raised by those non-damaging bullets could be a neat signal for that.
     
  8. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Visual mayhem is important for that immersion factor, but I'd want to be careful with this specific suggestion -- just be sure that it doesn't become like one of those Call of Duty scenes where there appears to be absolute mayhem going on, but the player can literally stand in the open and not get scratched. If things seem chaotic and dangerous, but they actually are not; if the player learns this they'll lose respect for the game, or even become uninterested if it loses its challenge.
     
  9. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    2,985
    If you're going for realism, you should not allow bullets to always hit their target. In the real world, very few bullets ever hit their target. Most bullets miss. Sometimes this is because people are not consistent shooters during stressful situations, like life and death gun battles. That includes highly trained soldiers and highly trained police officers. Other times it is intentional, such as gun fire used to contain an enemy or prevent an enemy from moving.
     
  10. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,516
    Well, it's an RTS, and in the context of the previous suggestions there's full control of how much mechanical mayhem is actually happening. You're definitely right in that those visual-only shots shouldn't misrepresent what's going on or look like they should be doing damage elsewhere, though. If your visual cues are misrepresenting what's going on to the detriment of your player's understanding then yes, things clearly aren't right.

    Playing devil's advocate, though, Call of Duty is massively successful in part because it doesn't try to be realistic.
     
  11. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Right, but it's the things I mentioned is why people don't like it, not part of the reason people do like it.

    I think it is popular because, 1. multiplayer and casual gameplay that anybody can pick up and play, and 2. impressive visuals/production value.

    Back on topic, if it's an RTS going for a realistic immersiveness, I'd give units or characters level up points/perks, whatever you call it, that increases their accuracy, movement speed and range, ability to do things more quickly like call indirect fire, etc etc. But if realism is a concern at all, I would keep damage inherent to the weapon type.
     
  12. uberalles

    uberalles

    Joined:
    Jun 29, 2013
    Posts:
    46
    Thanks again for all the replies, great feedback.

    I like that accuracy is an element of shooting and it's improved through experience. I also like showing the bullets zip around 'cause it does (as others have stated already) makes things more exciting and chaotic.

    What I'm now thinking is I can still have a set damage per second and improve that with accuracy if I directly control how often the unit misses instead of leaving it up to some random variable. That way the player still feels like there's a 'guarantee' of how much damage the unit will do over time.
    Or leave it random and just add damage to each bullet hit, since the increase in accuracy would cause the 'enemy' unit to be hit in a more vital area.
     
  13. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Although the actual code hasn't been written yet, the idea for enemy AI accuracy in my project is to be percentage based. Enemies fire a variable amount of bullets (rounds per minute) depending on what "combat mode" they are in, and then a variable percentage of those fired bullets will hit the players location.

    There is other factors involved -- you could get really complex -- but I think this is a decent logic to start from for a method that is both rooted in realism and also has flexibility to help drive game play in the way you want it.
     
  14. EternalAmbiguity

    EternalAmbiguity

    Joined:
    Dec 27, 2014
    Posts:
    3,144
    It's already been mentioned, but you should take a look at some RTS games that do these various types of things. I think Company of Heroes has either randomized or percentage-based hits. Don't quote me on that. And I know Age of Empires 3 is a definite hit each time, I think Command and Conquer Generals (probably others in the series) is that way too.

    Try them out and see what they do. See what you feel is wrong about it, or more accurately, what you need to change to get the feel you want for your game.
     
  15. uberalles

    uberalles

    Joined:
    Jun 29, 2013
    Posts:
    46
    I too like the idea of a percentage based system, something that is reliable and can be improved upon.
    My only fear is that if the players are in a fight and it comes down to that last shot to kill an enemy (I always think of 'kiting' in Starcraft) and that shot misses, it upsets the player. I suppose the logical argument for that is just because you fired that one last shot needed to kill the enemy unit doesn't mean it will ways hit, again trying to represent some realism.

    Thanks again for the feedback.
     
  16. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    To get a feel for the accuracy/randomness element you should play Men of War Assault Squad 2 or Call to Arms. I think it works fine for that type of game, but it might be harder to balance.

    I wonder what your nickname is supposed to mean.
     
    EternalAmbiguity likes this.
  17. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Both plus I think your missing a few other factors?

    1. Range - Affects damage and accuracy
    2. Rate of Fire - Can impact sustained accuracy and compounds damage
    3. Type of Shot e.g. Auto/Burst/Snap/Aimed/Sniped e.g. Time Taken e.g. AP's used.
    4. Activity level of shooter e.g. running/walking/standing/kneeling/prone
    5. Health/Damage of player.

    I would try for as realistic as possible even thought it's an RTS.
     
  18. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,328
    I'd like to point out that reducing accuracy reduces damage, so they are effectively doing the same thing.

    For example 60% chance to hit, means the unit is dealing 60% of maximum damage on average.

    I think I'd be very annoyed if my foot soldiers in RTS kept missing targets, and I think this kind of RND is more suitable for turn-based games like XCom. Also RPGs.

    However, chance of missing would make sense for slow moving weapons, like mortars, rockets, etc.... or the "Nuke of Doom" from Dune 2 (which hit roughly in the same quarter of the map where you aimed, but could devastate entire enemy base if you got luck and could be fired into fog of war).
     
    Kiwasi likes this.
  19. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    It's an RTS, for goodness sake. You don't need to, and shouldn't be, considering stuff at this level of detail. Work out a DPS for each unit in each situation, then match your visuals to that.


    The player is almost never going to notice or care if an individual bullet hits an individual target. If they do, you are making a tatics game, not a strategy game.
     
    angrypenguin likes this.
  20. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    We are revamping our ballistics for our game. We base it on real world physics, so we use the velocity for said weapon (easily found online for real world weapon) since we know the velocity and frame time we can calculate the raycast length, we also adjust for gravity. Next frame using the ballistics coefficient

    https://en.m.wikipedia.org/wiki/Ballistic_coefficient

    We lower the velocity accordingly. When the raycast hits a object we calculate velocity drop based on thickness and material setup (concrete vs wood etc) plus bullets ability to pierce. If hit object is a player we calculate damage based on bullet weight and velocity .
     
    Arowx, ippdev and Martin_H like this.
  21. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,793
    I would think that using actual bullet ballistics would be the way to go. Even have a digital wind direction and speed factor, elevation for air density and sights that can compensate for perceived distance. I like the scene in Lonesome Dove where the bad guys have Robert Duvall pinned down and thin they are out of shot range and taunt him. He tests the wind and then adjusts his iron sights upwards, takes aim above the guy and takes a shot and hits him in the chest to the clowns chagrin as he begins bleeding out..
     
  22. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    What about impact effects, this is something not many games do well. E.g. the shock of being hit could make the NPC stumble/fall/double-over/drop an item or weapon or stun/reduce their effectives for a time regardless of damage.
     
  23. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,960
    It would be cool that a game somehow lets you use physical rifle sights to aim. Instead of perfect crosshair aim.

    Though it’s impossible to have true realism when at the end of the day it’s a game, where player has less visual definition than real life, and tunnel vision. I would adjust enemy ability to spot player, and reduce their accuracy as well, to even things up.
    (I find that realistic games you get spotted way too fast, like a boolean sets true and boom you’re spotted by all enemies, and they rarely miss because in real life it would be an easy shot)

    Also damage could be a lot more complex than a health bar. Health should affect game in terms on where player got hit. You can either die fast or slowly, can reduce mobility or not, and so on.
     
    Last edited: Feb 11, 2018
  24. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Also there could be a suppression factor, e.g. even missed shots can affect where an NPC moves or if they stay behind cover (are suppressed). Most Heavy Machine guns are classed as area suppression weapons as they shoot a lot of rounds but with quite a wide coverage so supress enemy activity in an area.
     
  25. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
     
    angrypenguin likes this.
  26. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,516
    This. Figure out the gameplay experience you want, then implement the simplest system you think might achieve it. Test, Iterate.
     
    Kiwasi likes this.
  27. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    Yeah, I would try to start with the absolute most simple way for units to engage and destroy one another. Like each unit is a chess piece, with a value that can negate some units but not others, as well as its respective movement capabilities.

    As far as accuracy, bullet impacts, and all that -- just fake it with particle effects. No need to actually waste time designing and running calculations that will ultimately result in the same outcome -- enemy killed in ______ amount of time after engagement.
     
    Kiwasi likes this.
  28. Master-Frog

    Master-Frog

    Joined:
    Jun 22, 2015
    Posts:
    2,302
    Imagine doing this study, reading each police report and statements to determine 'intent'.
     
    Martin_H likes this.
  29. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,516
    Strictly in the context of an "intended target" that's believable enough to me.
     
  30. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Your point? It would actually be a reasonably interesting study.

    I've done studies where I boiled leaves of trees to see how snails reacted. You can go a lot less interesting then reading police reports.
     
    EternalAmbiguity likes this.
  31. Martin_H

    Martin_H

    Joined:
    Jul 11, 2015
    Posts:
    4,433
    What I thought he meant was that it'd be super depressing reading so many police reports.
     
  32. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    Some of the best RTS games still have single player character control and actions.

    Also it depends on the number of Units deployed with smaller squads and single vehicles (most RTS games have < 200 units per side) then realistic calculations are an option on mid level hardware. It depends on how tactical the RTS is vs how strategic it is e.g. Small Units/Big Armies.

    There is also the emergent factor when you use more realistic physics e.g. ricochets, blasts taking out bullets/missiles, vehicles taking down soldiers GTA style.

    Lets face it if a tank comes at a group of soldiers they are going to get squashed they cannot stop it physically.

    It's possible to do more realistic bullet physics in an RTS, especially if you adopt Unity's new Job system (2018.1 Beta) that can batch raycasts and transform changes.
     
    Last edited: Feb 12, 2018
    Martin_H likes this.
  33. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,960
    How did snails react to marijuana leaves though?
     
    EternalAmbiguity likes this.
  34. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,328
    I think supreme commander used actual collision detection for projectiles (i think it was ALL projectiles), and that massively upped cpu requirements. Also, falling planes could cause damage by crashing into stuff.

    In practice it was not incredibly noticeable, compared to, say Warhammer 40k. The idea of RTS is that unit gets in range, and starts chipping away at target's health. Now, lack of cooperative movement in W40k was incredibly noticeable in comparison.

    Some games made it a bit more complicated, by using variable amount of armor on different sides of vehicles. For example, in Red Alert 3, tanks had more armor in the front, so while retreating under fair, you would want to make them move backwards. Troops also had scatter manuever to avoid beign squished by tanks easily, etc. But once again - not incredibly noticeable.
     
  35. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    There has always been some collision based projectiles. Even back in the Dune 2 days, a siege tank had trouble hitting a moving target. But that was simple cell based stuff.

    I still don't think there is a real need for anything more in an RTS. It's just a level of detail that's going to be obscured in the final detail.
     
  36. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I think a system with raycast every frame like the one we are doing will get better results than actual physics. Well atleast for bullet velocities. 40mm grenades are a different story