Search Unity

Good source material on the mechanics of bullets, armor, and health?

Discussion in 'Game Design' started by McHazard, Feb 7, 2015.

  1. McHazard

    McHazard

    Joined:
    May 8, 2013
    Posts:
    13
    I've yet to find the Magic Search Phrase to turn up what I'm looking for, so I was hoping that someone might be able to point me toward a good discussion about the mathematics of designing and balancing weapon & armor mechanics, especially re: bullets and penetration. For example, I'd like to understand what constitutes reasonable balance in a pistol vs. a rifle, but also more discrete logic such as how one determines if a projectile is strong enough to carry through a target, and how such abstractions are "best" translated into the rigidbody world that Unity3d uses.

    I'm not looking for code, I'm really interested in knowing how other people have attacked this problem in a mathematical & theoretical sense.

    Thanks,

    - B
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,886
    Disclaimer: I've never actually done this in a game. I do have real-world experience (Army) and I've played lots of games, though. :)

    As you've indicated, it's all about balance. Many games do this differently. Thinking back to the first Halo game, I remember the pistol was super powerful, but the balancing factor was a lower rate of fire. Similarly, the sniper rifle tends to be even more powerful, but with an increased recoil that makes getting that second hit more difficult.

    In all likelihood, real world mechanics won't be useful to you since the same rules don't apply. In the real world, a rifle is far more accurate than a pistol, but the advantage a pistol has is the reduced weight, maneuverability in tight quarters, and cost of the weapon itself. Similarly, in the real world, getting shot once -- armor or not -- is likely to take you out of the fight, so exact mechanics of how armor affects things doesn't translate the same, either.

    The factors you do control and want to consider:
    • Effective distance (how far until the shot is adversely affected by gravity/decreased accuracy/reduced impact)
    • Rate of fire
    • Recoil
    • Ammo capacity (number of shots before reload and total number of rounds carried)
    • Reload speed
    • Damage (see below)
    Obviously the damage system is dependent on other factors in your game, but let's assume you have a point-based health system (0 = dead, 100 = full health) with a matching armor counter (0 = no armor, 100 = full armor). In that case, your weapons (or ammunition types if you're getting that fine grain) (pun) could additionally have an Armor Penetration rating. Let's say a value between 0 and 1. At 0, the bullet is completely stopped by armor and its damage to the player is multiplied by the penetration value (0) when affecting the player. But the armor value would be reduced by the original damage amount. At a value of 1, all of the damage affects the player's health as well as their armor.

    If you wanted the armor to not be affected by durability, you could just check if the player was armored, and maybe different types of armor (vest, helmet, space marine armor, etc) have different Resistance values that decrease damage.

    But really, it's all dependent on what you want the player to do. Do you want the player to constantly be scrambling for a new weapon? Make ammo capacity and ammo drops limited. Do you want them to have to select the best weapon for each situation? Make certain enemies resistant to certain weapon types. Do you want them to choose a weapon that best fits their play style? Design levels to offer choice of engaging at distance, stealthily, or all-out-assault.

    And then, most importantly, test the hell out of it! Watch people play the game and see if what you were going for has been achieved.
     
    JanCDS, Ryiah and BrandyStarbrite like this.
  3. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,452
    Myth busters? :)
     
  4. McHazard

    McHazard

    Joined:
    May 8, 2013
    Posts:
    13
    Thanks, Schneider. I appreciate getting to hear someone else's interpretation of the whole thing. Some of my initial thoughts were along the same lines. I'm somewhat tempted to read more about how systems like WH40K and WoW work, as they might provide the sort of insight you'd expect from years of constant use; but conversely, they're unwieldy and perhaps heavy-handed for my little third-person shooter =)

    I was concerned that doing a roll-your-own rule system would leave me wanting for something down the road, but perhaps I'm psyching myself out =p
     
  5. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,886
    Maybe a good way to go would be to start small and work your way up in complexity until you're satisfied with the results. No sense in building a ridiculously complex simulation if you end up not liking the way it works anyway, right?
     
    Kiwasi likes this.
  6. khanstruct

    khanstruct

    Joined:
    Feb 11, 2011
    Posts:
    2,865
    Schneider, I actually have a design (collecting dust at the moment) that was much more realistic with its firearms. In that system, if you get shot, maybe you don't die, but you're certainly done fighting. Armor may save your life, but primarily, what you wore protected you from the elements and/or made you look cool, and not much else.

    McHazard, it really depends on the game and its basic mechanics. In some games you would have "armor piercing rounds" that may ignore armor and possibly shoot through the target. In other games, armor would absorb X amount of damage per shot and transfer the rest to health, while others require that the armor be entirely destroyed before any health is lost.
     
  7. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,886
    That's exactly what I was intending to express, but I got lost along the way, haha. For some reason I keep thinking of Fallout 2 with the armor system being sort of a flat absorption level, and different types of ammunition that dealt with armor differently.

    Well put.
     
  8. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,779

    Hey McHazard it may be useful to see if the guys creating Overgrowth would be willing to discuss things with you. I'm pretty sure they are developing there own engine, but they do use Unity and I destinctively remember one of there youtube dev logs talking about projectile penetration, direction, speed, depth with/without armor and a lot of other related concepts you spoke of in the OP. WolfireGames.
    You are speaking about bullets and they were designing spears and thrown blades but it's pretty much the same concepts with different projectiles.
     
  9. McHazard

    McHazard

    Joined:
    May 8, 2013
    Posts:
    13
    Thanks, I'll check that out! I have heretofore been spending all of my time getting the foundations of my game in place, e.g. having models, animations (and interactions between two models), basic sounds, player and opponent AI, and Very Basic Guns. I'm finally at the exciting part -- adding in my "second tier" of complexity. There are a few different domains that I feel fall into that: inventory (the concept of having one, I mean); loot (having objects / opponents that contain inventory, and items inside of them); and a true weapon system (beyond simply having health and projectiles that subtract from it). This is all really super exciting because it is a milestone, but I'm already accruing a "fixit" list for minor bugs in animations & nav controllers, and I know that all of my work is going to be bookended by an intimidating "polish" phase, so I'm trying to balance my decisions between "ease of execution" and "flexibility".

    My day job is programming, which has given me plenty of insight into how a seemingly minor design decision in week 12 can be a princess-and-the-pea problem in week 129 ;) That's why I want to know where I generally "ought to be" headed now.

    That being said, I really do see the value in doing things simply and robustly at first. Thanks for your input! This process is fun and intimidating at the same time, if that makes sense.
     
    theANMATOR2b likes this.