<story><title>How Do Bullets Work in Video Games?</title><url>https://www.gamasutra.com/blogs/TristanJung/20191206/355250/How_Do_Bullets_Work_in_Video_Games.php</url></story><parent_chain><item><author>redistressed</author><text>Fun side note to this: although bullet collisions are trivial, &lt;i&gt;sword&lt;/i&gt; collisions are genuinely computationally complex, in the sense that I’m not aware of a single publicly available game engine that ships with a robust real-time solver for sword-sword collisions.&lt;p&gt;I find this really interesting because it’s a complete inversion of reality, where bullet impacts are vastly more energetic and chaotic than sword clashes. It tells you something about the scale we play games at, maybe.&lt;p&gt;I don’t see people talking about it, but this has to be a huge part of why sword combat in video games is so much less explored and well-realized than gunfighting. Figuring out why it’s such a hard problem, and exploring the various workarounds and their limitations, is a fun weekend project if you know a little computational geometry. (And it’s probably the work of a few minutes if you know enough formal geometry, I guess.)</text></item></parent_chain><comment><author>mntmoss</author><text>The great lie that games tend to run with is that if they define a sufficiently large lookup table of results, they get a convincing effect without being accurate to any form of reality.&lt;p&gt;This is basically true with almost all character controller behaviors(perfect ability to jump high, sidestep, slide etc. without stumbling) and also with combat results(add enough animations and you have a melee combat system; turn granular physical reactions like bullet impacts into a state change making the target &amp;quot;hurt&amp;quot; or &amp;quot;stunned&amp;quot;). And it&amp;#x27;s even true of the earliest ball-and-bat games: reduce hitting a ball to a lookup table of trajectories and you get Pong without having any trigonometry in your algorithm. You can define a massive swathe of gameplay code as combinations of &amp;quot;lookup table, finite state, timers, resource counters&amp;quot;.&lt;p&gt;This is also true of the physics solvers: define the solver in terms of eliminating all the visibly wrong results(which in the base case means filtering the set of results that contain  penetration), and you have one sufficiently good for gameplay. For 2D games this has classically meant solving AABB-AABB movements along 1 axis at a time(i.e. if your raycast is diagonal it&amp;#x27;s reduced to two one dimensional on-axis movements, which is trivial to compute). Once you want realistic physics as a &amp;quot;special effect&amp;quot; you typically will switch towards using a physics library to provide both solver and colliders, and so as a gameplay programmer you may never have to learn the physics problem in much depth.&lt;p&gt;The video games that really work with physics instead of against them are kind of exceptional, and tend to be categorized as &amp;quot;simulators&amp;quot; - flight sim, racing sim, pool sim, pinball sim. Or they are joke games like QWOP, or at their most fantastic, space games. When we actually simulate anything, the scenario-and-story space tends to reduce dramatically as everything starts converging around the sim&amp;#x27;s chaos. As we eliminate the sim, more can exist in the designer-fiat space. That&amp;#x27;s how we can have games about wrestling and swordfighting and yet not really be able to convey the physics or controls of those activities.</text></comment>
<story><title>How Do Bullets Work in Video Games?</title><url>https://www.gamasutra.com/blogs/TristanJung/20191206/355250/How_Do_Bullets_Work_in_Video_Games.php</url></story><parent_chain><item><author>redistressed</author><text>Fun side note to this: although bullet collisions are trivial, &lt;i&gt;sword&lt;/i&gt; collisions are genuinely computationally complex, in the sense that I’m not aware of a single publicly available game engine that ships with a robust real-time solver for sword-sword collisions.&lt;p&gt;I find this really interesting because it’s a complete inversion of reality, where bullet impacts are vastly more energetic and chaotic than sword clashes. It tells you something about the scale we play games at, maybe.&lt;p&gt;I don’t see people talking about it, but this has to be a huge part of why sword combat in video games is so much less explored and well-realized than gunfighting. Figuring out why it’s such a hard problem, and exploring the various workarounds and their limitations, is a fun weekend project if you know a little computational geometry. (And it’s probably the work of a few minutes if you know enough formal geometry, I guess.)</text></item></parent_chain><comment><author>rriepe</author><text>Bullets don&amp;#x27;t have bullet&amp;#x2F;bullet collisions and they largely don&amp;#x27;t affect the player model at all.&lt;p&gt;Swords can hit other swords but they also have to convincingly portray the arms, head, torso and legs during any swing or interrupt.&lt;p&gt;Having said all that, I think Jedi Knight 2 is still the best swordplay system. But only because the animations just ignore everything in their way, as a lightsaber would. Each time lightsabers hit there&amp;#x27;e either a brief flash of light or a power struggle.</text></comment>