News for hackers. Stuff that matters.
Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @12:09PM (#21879351)
Fun side note to this: although bullet collisions are trivial, sword 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.

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.

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.)

Re:How Do Bullets Work in Video Games? by mntmoss on Wednesday December 25, 2019 @03:16PM (#21880217)
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.

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 "hurt" or "stunned"). And it'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 "lookup table, finite state, timers, resource counters".

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's reduced to two one dimensional on-axis movements, which is trivial to compute). Once you want realistic physics as a "special effect" 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.

The video games that really work with physics instead of against them are kind of exceptional, and tend to be categorized as "simulators" - 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's chaos. As we eliminate the sim, more can exist in the designer-fiat space. That'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.

Re:How Do Bullets Work in Video Games? by babuskov on Wednesday December 25, 2019 @12:42PM (#21879535)
The problem with sword combat isn't the computational complexity, but the fact that reporting a hit late is much more noticeable.

If you are running across some open space and a bullet hits you, the game can report you being hit 500ms later and it's perfectly fine. With sword, the player can actually see the sword hitting and it has to report the damage at the same moment.

A game can compensate by having slower strike animations and preventing players to redirect sword mid hit. Dark Souls 3 does a pretty decent job there - once you press the attack button, you commit to a the attack animation and cannot change or cancel it. So, the receiving end can speed up the attack animation somewhat to compensate and show the sword hit approximately at the same time it hits "on the server". As long as you have good ping, the game feels close to real time - except that opponent attack animations feel somewhat faster than your own (so, harder to dodge and parry).

Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @01:15PM (#21879722)
Appreciate the comment, but I want stress that the problem really is the computational complexity. (Or at least, computational complexity really is a serious problem.)

If everything in your world behaves like a bullet, physics is simple. If everything in your world behaves like a sword, physics is a nightmare. A lot of games with swords literally pretend that swords are made of bullets to get around this. No kidding.

To spoil my deep explanation: in the sense games are concerned with, a bullet is a non-rotating length-0 inertially-controlled sword. That doesn’t generalize cheaply.

Re:How Do Bullets Work in Video Games? by Jasper_ on Wednesday December 25, 2019 @07:14PM (#21881230)
Swords can be modelled as "oriented bounding boxes" or OBBs. OBB/OBB collision has been part of the toolkit for years and is not computationally complex. The computation of sword/sword collision is not the hard part. The gameplay mechanics to make it fun, are.
Re:How Do Bullets Work in Video Games? by BorisTheBrave on Thursday December 26, 2019 @05:15AM (#21882937)
Actually no. Thin, quickly rotating objects are an area where a lot of collision detections libraries fall down - the simpler algorithms just look at the position of the objects each frame, and two swords can easily pass through each other in the time between frames.

The problem is called tunelling, and though there are some features to deal with it, there aren't any ones that are simple, reliable and cheap.

Re:How Do Bullets Work in Video Games? by tekromancr on Friday December 27, 2019 @03:22PM (#21894249)
Why wouldn't the blended ray+physics technique described in the article not work? I am imagining projecting a bunch of rays from the blade along the vector of travel each physics tick and using that to determine if a collision will occur during that tick.

I've never tried to implement anything like that, so I am curious where that might Fail.

Re:How Do Bullets Work in Video Games? by nwallin on Wednesday December 25, 2019 @05:39PM (#21880877)
Spitballing here.

Model a sword as a point of rotation e, (elbow, shoulder, whatever, have the animator figure it out) location of the tip point p, and the linear velocity vector v of its tip. Look at the letter 'F': The elbow is the point at the bottom, the travel of the tip is the top bar, the travel of the hilt (not modeled) is the shorter bottom bar. The travel of the tip is the parametric equation `tv + p`, which defines the line `(tv+p)d + e` You have one line for each sword. Solve for the intersection of the two lines. If t is outside the bounds of your framestep, they do not intersect. Do basic comparisons on the length of the arm/forearm + sword length to figure out if they connect. Bonus: gives you one character slashing the others' wrists for free.

Piercing attacks are just hitscan.

If you really need to model elbows that are moving (probably only for characters on horseback while galloping) you'll need to parameterize the elbow point. Use the character's velocity vector I guess; I wouldn't do anything more complicated than that. I suppose that also works for combination slashing/thrusting attacks?

I'm too lazy to plug that into the line intersection formula, but it seems like a fairly basic linear algebra problem. Unless you're trying to make it super hyper realistic, (don't do that) I don't understand why the computational complexity is a problem.

Re:How Do Bullets Work in Video Games? by konceptz on Wednesday December 25, 2019 @07:45PM (#21881334)
That’s very complex compared to a model I was thinking about while reading this article.

Consider that many forms of sword fighting remove the complexity by creating zones. I’ve been told that a skilled swordsman can identify 16-32 zones considering where an attack can come from or where to strike.

Isn’t this a much easier model if you factor in the weight/mass/velocity of each particular character? This would be a little like auto-aim but you could still compute each path and create effects against one when they happen or not.

Re:How Do Bullets Work in Video Games? by nwallin on Thursday December 26, 2019 @12:09AM (#21882134)
Maybe.

If you have 4-8 static blocks vs 16-32 attacks that would be fine, but if you need to calculate what happens when 16-32 attacks run into the same 16-32 attacks you have a combinatorial explosion problem which you then need to simplify.

One of the reasons I like going straight to the linear algebra approach is that you do a batch of basic arithmetic which the CPU does quite fast without branching, and then you do one branch to determine hit vs not-hit. Pairing zones with zones sounds like nested if/else statements, but I hadn't dived into considering that approach.

Re:How Do Bullets Work in Video Games? by subroutine on Wednesday December 25, 2019 @06:53PM (#21881159)
Here is the maths for rotation of vectors around arbitrary axes:

https://sites.google.com/site/glennmurray/Home/rotation-matr...

I've used these to simulate polymer growth branching in 3D. Determining if and where two lines in 3D space intersect requires determining the scalar parametric equations of the two lines, then solving 3 simultaneous equations using a method like gaussian elimination. Seems like the last step could be computationally taxing for a cpu if performed each time-tic during sword swings - not sure if modern GPUs are optimized for just this sort of problem.

Re:How Do Bullets Work in Video Games? by nwallin on Thursday December 26, 2019 @12:01AM (#21882112)
I'm aware. I deal with rotations and intersecting geometries at work too.

There's a closed form 3x3 matrix inversion procedure which is very fast on CPUs. [1] We don't use it with pen and paper because it's too hard to remember and there's a lot of places to fuck up substitutions, but computers don't have problems with remembering obtuse formulas. (it's like the 2x2 inverse where you shuffle stuff around and divide by the determinant) So you're looking at about 60 instructions (one division operation) with no branching to solve Ax = b in R3. [2] The reciprocal throughput is 16.5 cycles, so 5.5ns on a 3GHz Skylake assuming everything's in cache. In gamedev you'll use an approximate reciprocal instead of the division, so the latency will be lower but AFAIK the throughput will be the same.

The slow part of rotations is actually computing the sin/cos of the angles. You'll notice my model avoids anything to do with angles: there are no transcendental functions. This is non-physical for a few reasons, notably it's not possible to swing a sword more than 90 degrees in one frame. It's fine for a video game where you assume a full sword swing will take 15-30 frames and good enough is good enough, but it's not fine for scientific computing. Video games are all about faking it when nobody's looking.

Also, my model starts with defining motion in terms of the scalar parametric equations of the lines. I did think about this before posting. :)

[1] https://en.wikipedia.org/wiki/Invertible_matrix#Inversion_of...

[2] https://godbolt.org/z/ND6tTM

Re:How Do Bullets Work in Video Games? by subroutine on Thursday December 26, 2019 @05:26AM (#21882966)
You sure did think about it, hah, thanks for sharing!
Re:How Do Bullets Work in Video Games? by ngold on Wednesday December 25, 2019 @07:23PM (#21881253)
What's the difference from a fighting game like sf2, where your legs and fist act as essentially the same thing as a sword. Dhalsim has some pretty long feet and arms in that game.
Re:How Do Bullets Work in Video Games? by nwallin on Thursday December 26, 2019 @12:17AM (#21882148)
Fighting games like SF2 usually work on 2D hit boxes. [1] You have boxes which are defined as things that do hitting, boxes which are defined as areas that can get hit, and boxes that define clipping. If a do-hitting box overlaps a get-hit box, a hit occurs. It's a simple, elegant system that's ideal for a game with a fixed 2D playworld and fixed 2D attacks. It doesn't work for a system with free form 3D sword combat. If you block up and to the right, and a sword comes in from up and to the right, you should block it, but if it comes from up and to the left you should get hit.

https://www.youtube.com/watch?v=SB2CvPt87X8

Re:How Do Bullets Work in Video Games? by rriepe on Wednesday December 25, 2019 @01:32PM (#21879800)
Bullets don't have bullet/bullet collisions and they largely don't affect the player model at all.

Swords can hit other swords but they also have to convincingly portray the arms, head, torso and legs during any swing or interrupt.

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'e either a brief flash of light or a power struggle.

Re:How Do Bullets Work in Video Games? by reificator on Wednesday December 25, 2019 @03:41PM (#21880319)
> 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'e either a brief flash of light or a power struggle.

Agreed, but only if you put the following in your autoexec.cfg:

    seta helpUsObi "1"
    seta ui_iscensored "0"
    seta g_saberRealisticCombat "1"
    seta g_dismemberProbabilities "1"
Re:How Do Bullets Work in Video Games? by rriepe on Wednesday December 25, 2019 @04:34PM (#21880608)
While you're at it, bind a stormtrooper spawn to a key too. If you hold it down while your lightsaber is out, you get a whole pile of stormtrooper parts with these options on.

Nothing pushed my GeForce 2 harder than that pile of stormtrooper parts.

Re:How Do Bullets Work in Video Games? by bloopernova on Wednesday December 25, 2019 @12:50PM (#21879593)
Offtopic: One day I'd like to see a game that simulates/emulates the multiple layers that go to make up a human character.

So you'd start with the skeleton, layer muscles on top of it, then fat layers, then skin. On top of that would come a couple of layers of cloth, then leather, mail, and plate armour.

My desire to see this has kind of sprung from mods for games like Skyrim, Fallout: New Vegas, and Fallout 4. Seeing the creativity of modders who make these amazing outfits, armours, and weapons, and wondering how they'd look if they were a single layer on top of other clothing.

This, combined with the amazing hitbox work that goes into some games, could be very cool to see. Imagine a character getting hit by an arrow: it would have a vastly different effect whether it hits on a shield, against shoulder armour, or against a helmet. Now imagine if the character had their arms raised for an overhead strike with a sword, and the arrow hit their side or under their arm?

Re:How Do Bullets Work in Video Games? by grawprog on Wednesday December 25, 2019 @12:52PM (#21879601)
>Offtopic: One day I'd like to see a game that simulates/emulates the multiple layers that go to make up a human character. So you'd start with the skeleton, layer muscles on top of it, then fat layers, then skin. On top of that would come a couple of layers of cloth, then leather, mail, and plate armour.

This is exactly how dwarf fortress works. It's not a flawless system though and it tends to make combat realistically brutal. You can even modify the raws to a pretty large extent and create your own creatures and beings made out of and up of pretty much anything.

https://dwarffortresswiki.org/index.php/DF2014:Modding#Moddi...

Re:How Do Bullets Work in Video Games? by bloopernova on Wednesday December 25, 2019 @12:55PM (#21879627)
I had no idea, that's very cool.
Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @01:42PM (#21879841)
I’ve had this thought. You know what I worry, though— even if I did have a vividly realized simulation of a human body accurate enough to engage in realistic medieval melee combat, wouldn’t I just have her sit at home and write esoteric computer programs? That’s what I do with this one.
Re:How Do Bullets Work in Video Games? by drewmol on Wednesday December 25, 2019 @02:28PM (#21880027)
>That’s what I do with this one.

Having an infinite supply of them would effect your decisions.

Re:How Do Bullets Work in Video Games? by DayDollar on Wednesday December 25, 2019 @02:11PM (#21879958)
Swords are also hard to control with a mouse and keyboard.

Imagine yourself surrounded by a transparent sphere, on which you can paint a point and a line. Where on the sword is that point? How does the point/sword travel along a line?

This is not easy to solve. What happens if you shift your perspective after a sword attack is drawn? Can you amplify it by looking away? Can you arrest the motion, by looking towards the executed sword motion.

Re:How Do Bullets Work in Video Games? by B1FF_PSUVM on Wednesday December 25, 2019 @02:43PM (#21880076)
(mumble) Nintendo Wii (mumble)
Re:How Do Bullets Work in Video Games? by Impossible on Wednesday December 25, 2019 @05:49PM (#21880933)
Modern VR motion controls are better. Much of the innovation in physics based gameplay and things like sword mechanics is happening in VR, because the controls are accurate, expressive and low latency. Wii had the idea but lacked real tracking (a smartphone accelerometer can do Wii gameplay better than Wii).
Re:How Do Bullets Work in Video Games? by m-p-3 on Wednesday December 25, 2019 @08:59PM (#21881625)
Even the improved Wiimote Plus?
Re:How Do Bullets Work in Video Games? by DayDollar on Thursday December 26, 2019 @05:36AM (#21882994)
VR controls are exausting, almost like a real sword battle. Real innovation for gaming is when the controls do not exaust you. What may look like a working system (touch-control) either vannishes after a while (novelty factor wears off) or turns into yet another stone held in a relaxed lapgrip..
Re:How Do Bullets Work in Video Games? by audiometry on Wednesday December 25, 2019 @10:25PM (#21881861)
(Mumble) Clang (mumble)
Re:How Do Bullets Work in Video Games? by phaus on Wednesday December 25, 2019 @12:21PM (#21879423)
Do you happen to know what kind of tech Mordhau uses? Its not perfect but the hit detection seems far better than any other melee combat game I've tried.
Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @01:07PM (#21879681)
I don’t know specifically, but the general trick is to get your approximate solve to have the impact happen at a consistent time, since that’s what players have fine-grained control over. Other stuff involved in restitution, like angle of deflection and force at the point of impact, you can basically fudge to be close enough for gameplay purposes. If a game feels really satisfying, it generally means that stuff has been tuned really carefully. (So it is with games.)

You work that stuff out with numerical accuracy if you can be careful about when you need to, but since the animations and audio cues need to be carefully tuned anyway, it tends to add unnecessary complexity.

Re:How Do Bullets Work in Video Games? by meheleventyone on Wednesday December 25, 2019 @01:04PM (#21879666)
Mordhau uses a lot of raycasts.
Re:How Do Bullets Work in Video Games? by gunshai on Wednesday December 25, 2019 @12:45PM (#21879553)
>sword collisions are genuinely computationally complex

Have you played Dark souls and or Sekiro? I've always been a little curious how FROM accomplishes such a great experience with melee weapons.

Also a shout out to Mordhau for similar reasons but with LOTs more people to worry about in a server.

Re:How Do Bullets Work in Video Games? by CoolGuySteve on Wednesday December 25, 2019 @12:54PM (#21879621)
I haven't played Sekiro but Dark Souls doesn't really model swords colliding at all. It just plays the animation and allows for the occasional interrupt, like when your sword hand is too near a wall. Your sword slices straight through the enemies and plays a sound effect depending on the hit.

But one of the reasons Dark Souls and Demon's Souls feel 'tough but fair' is that the animations are very explicit and mostly uninterruptible by the player. It meant if you made a mistake, it was probably your fault and not the animation or game logic.

Demon's Souls actually looked kind of cheap and had janky transitions at the time because of it but the games since then have been getting better at animating transitions between moves.

The animation-above-all-else style also leads to some silly interactions with the Havoc physics engine. For example, when you kick through a dead body the rag doll physics accelerate at the speed of the animated player leg causing it to look weightless and kind of ridiculous.

Re:How Do Bullets Work in Video Games? by gunshai on Wednesday December 25, 2019 @02:05PM (#21879936)
>Dark Souls doesn't really model swords colliding at all.

This is a good point, the only collisions are what you said and animations for parry windows.

And yes the rag doll physics in DS games is pretty silly.

Have you checked out Mordhau at all? Because that is probably more of the collisions/interactions you were initially referring to.

Re:How Do Bullets Work in Video Games? by jayd16 on Wednesday December 25, 2019 @02:49PM (#21880108)
>Dark Souls doesn't really model swords colliding at all.

Does this really make a difference? There's nothing fundamentally different about sword to sword vs sword to body is there?

The anim set makes hits look good even though the impact is not physically calculated for collision angles and impact velocity and such. Perhaps you mean model in this way? Even still, the game has to at least do a hit detection on a deforming hitbox.

Do you happen to know how From accomplishes their hitbox animation and collision detection?

Re:How Do Bullets Work in Video Games? by nine_k on Wednesday December 25, 2019 @03:10PM (#21880195)
A lot of difference.

Real swords slide, slow down to a stop, jump back, get stuck, and variously swivel and yaw in your hands as they meet obstacles.

This is rather expensive to physically model, even harder to nicely animate, and nigh impossible to map to the keyboard and mouse controller combo.

Re:How Do Bullets Work in Video Games? by CoolGuySteve on Wednesday December 25, 2019 @07:56PM (#21881380)
The game itself would also probably become less predictable and less fun as a consequence.

There was a cool talk called "Phase-Functioned Neural Network for Character Control" that used a neural network to join animations together based on user input: https://www.youtube.com/watch?v=Ul0Gilv5wvY

Something like this where the gameplay outcomes smoothly animate realistic swordplay might be pretty fun.

Edit: For anyone wondering what truly accurate physics might do to gameplay, the Totally Accurate Battle Simulator is free on the Epic Game Store for Dec 26: https://www.epicgames.com/store/en-US/product/totally-accura...

Re:How Do Bullets Work in Video Games? by erikpukinskis on Wednesday December 25, 2019 @08:54PM (#21881607)
It doesn't make sense to me that it would be expensive to model. It's just four line segments.

The math seems like it would be preposterously difficult. I wouldn't even know where to begin. Seems like a very serious algebra problem. But once you solve the equations I can't imagine it's more than a few matrix operations each frame.

But it's entirely possible I'm missing something that makes it unsolvable without discrete math that pushes it into the computationally costly realm.

Re:How Do Bullets Work in Video Games? by CapsAdmin on Wednesday December 25, 2019 @07:02PM (#21881189)
I've toyed with this idea for a bit but gave up because it's difficult to make it feel like you're in control of the action due to the randomness it adds to simply hitting something.

The physics itself is not computationally complex as far as I know, but it depends on the amount of detail you want to simulate.

I personally think realistic systems like this are fun to make but they can often be frustrating when put in a game.

There's an old game called Die by the Sword released in 1998 which lets you control the movement of melee weapons with your

https://www.youtube.com/watch?v=DPm3R3eWtA4

The gameplay feels kinda silly, but it works in this game because it doesn't take itself too seriously.

Re:How Do Bullets Work in Video Games? by ironore on Wednesday December 25, 2019 @11:12PM (#21881985)
There is a game that does this. Exanima by Bare Mettle Entertainment. This is my first time with an account here, and I felt compelled to post this.
Re:How Do Bullets Work in Video Games? by boomlinde on Wednesday December 25, 2019 @02:58PM (#21880134)
> Fun side note to this: although bullet collisions are trivial, sword 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.

That's not a sense in which you can determine the computational complexity of the problem. Perhaps accurate sword combat just isn't very fun. Maybe it makes convincing animation much harder. Maybe it makes controlling the character much harder. Maybe you just don't know that many games. There are plenty reasons that it might be true that no games that you know of shipped with a robust real-time solver for sword-sword collisions other than computational complexity.

> 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.

Of course the modelling of bullets is also usually extremely simplified in video games. If there is anything we can learn from this I think it's that players prefer games to be predictable and controllable over them being perfectly realistic.

Re:How Do Bullets Work in Video Games? by rossnordby on Wednesday December 25, 2019 @03:56PM (#21880407)
I prototyped a physical first person sword fighter doohicky once, so allow me to weigh in:

You're both right! I'd point out four big categories of difficulty:

1) Physics. You need a swept collision test capable of handling very high linear and angular velocity of very thin shapes (a sword is not thick, and the tip can move pretty dang fast), and collision response capable of dealing with the results. This is doable- conservative advancement operating on distance functions will work- but working out all the details in a way that makes the final result fast is not easy. A speedy implementation alongside a speculative contact solver can work, though: https://www.youtube.com/watch?v=sfgC_eNx9M8#t=1m20s

2) User interface. A mouse and keyboard struggle to express all the degrees of freedom available to a physical handheld weapon. Swinging using the mouse works okay, but you need to do so in a way that doesn't interfere with camera control, and you need to be able to interrupt and redirect movements at any point, then add jabs, different guards, ... Expressing all of that in a single intuitive interface that doesn't require awkward mode switching is not easy. My prototype had an okay-ish approach, and I think it could still be improved further, but there's no way a mouse-keyboard user would be able to compete with someone of equal skill using VR hand controllers. There's a good reason why melee combat games are so much more common in VR.

3) Graphics. Single planar projections simply aren't enough for first person (especially outside of VR)- it feels like wearing blinders. Even third person doesn't help enough, and seeing your character gets in the way of seeing your weapon and opponent sometimes. Using a nonplanar projection like stereographic fisheye, it starts feeling okay around 160 degrees, though 200+ is nice once you adapt to the mild distortion it introduces. This requires a pretty different approach to rendering (like multiple subviews, direct projection raytracing, vertex warped rasterization, etc.). A couple of examples: https://www.youtube.com/watch?v=jQOJ3yCK8pI https://www.youtube.com/watch?v=mIax_ProQ8c#t=1m4s

4) Animation. While achieving a level of animation quality common in early 2000's titles is pretty easy- just have a set of poses for various weapon states to interpolate between, blend in some leg motion, shrug, done- achieving a very high animation quality bar is extremely difficult. Most modern AAA games use massive libraries of mocap data, and in some cases the animations directly drive motion to make everything grounded and solid. For Honor is a good example: https://www.youtube.com/watch?v=4pdcA3mhe0E. But in a game allowing total physical control with expectation of proper physical response to every interaction, the mocap coverage requirements explode. You can still do pretty well if you have enough data and put in a huge amount of effort, but at a certain point you start wishing the magical machine learning genie would swoop in and save you.

I think all of these things are solvable enough to permit the existence of a game, but they're hard enough that it's not surprising that they are still so rare.

Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @04:55PM (#21880690)
Just to close the circuit. If you do ever make the move to VR, frame times go way down and arc accuracy requirements for the very tip of the blade go way up. You are going to get really frustrated that you can’t just google up a numerically robust solver :)

In VR you will run into edge cases where the difference between a miss and a parry at the tip of the blade requires sub-frame rotational resolution at the controller. If it were a gun, you’d never know the difference— with a sword you can feel that it moves wrong during the frame. I don’t think there’s going to be any software solution for that, we just need better tracking hardware before we can properly model a 1-meter object held out at arm’s length.

Which makes you think about constraints, is all I’m saying.

Re:How Do Bullets Work in Video Games? by rossnordby on Wednesday December 25, 2019 @05:34PM (#21880851)
On the software side of things, the good news is that the combination of a decent conservative advancement detection scheme and speculative contacts can get you down to microsecond tier fidelity pretty cheaply. (Incidentally, this specific problem is why I built that particular form of continuous collision detection :P) You're definitely right though that it's not going to magically solve away hardware level concerns.

On that front, one of the things I had to end up doing to ensure physical consistency was bite the bullet on a level of indirection. This can be flat out necessary on a gameplay level- allowing full 1:1 control often leads to pretty nasty pathologies and difficulty with correct physical responses. A truly physical character's motion can never truly match the input motion, since your controller is dramatically more nimble than even a light 2.5 pound longsword and the physical sword may be interfered with. This introduces some challenges on the side of user responsiveness and intuition, to be sure, but the physical motion also smooths out input and seems to make small scale controller imprecision a distant concern to the player. If the player can adapt to the physical indirection, they tend to allow a lot more leeway. This becomes even more valuable when trying to hide latency. If you have physically reasonable accelerations, networking overhead becomes a whole lot less objectionable.

There are definitely tradeoffs- the feeling of being a puppeteer takes some time to get used to.

Re:How Do Bullets Work in Video Games? by erikpukinskis on Wednesday December 25, 2019 @09:02PM (#21881630)
I would expect you'd have to go DEEP into cognitive science to find a good model for this stuff. E.g.:

https://www.researchgate.net/publication/12618263_Perceptual...

http://scholarpedia.org/article/Dynamic_touch

Re:How Do Bullets Work in Video Games? by redistressed on Wednesday December 25, 2019 @04:33PM (#21880606)
> There are plenty reasons that it might be true that no games that you know of shipped with a robust real-time solver for sword-sword collisions other than computational complexity.

This is the kind of comment that makes me just want to skip HN altogether. Why on earth are you arguing this at all — the counter to a point I never made — and why are you arguing from a position of ignorance like it makes you smarter than me?

You don’t have to pull an opinion out of your ass here. Just try it, the way my sibling poster has. This is a mathematically hard problem, and it will constrain your game design, and I think that’s really interesting.

You really don’t have to be a dick about it.

Re:How Do Bullets Work in Video Games? by dang on Wednesday December 25, 2019 @05:32PM (#21880844)
HN can definitely be annoying when commenters act like they know more than they do. No question about it. But please don't let it trigger you into lashing out, which only makes the thread worse. Instead, remember that the vast majority of readers are here to learn, and if you know more, sharing some of what you know, or some of your experience, is really helpful to them.

https://news.ycombinator.com/newsguidelines.html

p.s. On another note, can you please stop creating accounts for every few comments you post? We ban accounts that do that. This is in the site guidelines too. HN is a community. Users needn't use their real name, but do need some identity for others to relate to. Otherwise we may as well have no usernames and no community, and that would be a different kind of forum. https://hn.algolia.com/?sort=byDate&dateRange=all&type=comme...

Re:How Do Bullets Work in Video Games? by vlunkr on Wednesday December 25, 2019 @08:08PM (#21881422)
Is there a reason hn admins can't send direct messages to users, as opposed to calling them out publicly for things like this? I suppose doing it this way is probably more effective in changing behavior.
Re:How Do Bullets Work in Video Games? by dang on Wednesday December 25, 2019 @09:51PM (#21881761)
That's the main reason for doing it publicly, yes. We do try not to seem like we're picking on anybody personally.
Re:How Do Bullets Work in Video Games? by boomlinde on Wednesday December 25, 2019 @08:41PM (#21881555)
I just don't see how your observation (that you are not aware of any game that solves the problem well) leads to your conclusion (that its solution is computationally complex). I can see that there may be other lines of reasoning that support that conclusion, for example something pertaining to the algorithms and techniques involved, but I also see how other conclusions may be true given your observation.

> Why on earth are you arguing this at all — the counter to a point I never made — and why are you arguing from a position of ignorance like it makes you smarter than me?

You are reading way too much into my post. I am arguing from a position of ignorance, but under no pretense that it somehow makes me smarter than you. On the contrary, it seems like you are familiar with the problem, and I think that you may have made much more relevant observations than the one you posted, but because my post has already prompted a more detailed description of the problem and its potential solutions I don't have to wait through petty insults to hear about it.

Re:How Do Bullets Work in Video Games? by mwkaufma on Wednesday December 25, 2019 @12:11PM (#21879360)
Good note!
Re:How Do Bullets Work in Video Games? by willmadden on Wednesday December 25, 2019 @02:29PM (#21880030)
In the real world bullet collisions are definitely not trivial. Video games do a laughable job at modeling the ballistics of projectiles. They don't even account for bullet drop.

When was the last time you saw a bullet do this in a video game? https://www.youtube.com/watch?v=0ABGIJwiGBc

If you do some light reading on "terminal ballistics", "experts" can't even agree on the lethality of bullet designs, especially in handguns.

People love to assume their models are accurate when they are usually educated guesses with gaping holes. Ballistics is no exception.

Re:How Do Bullets Work in Video Games? by nine_k on Wednesday December 25, 2019 @03:02PM (#21880155)
First time I actually saw the bullet drop was the original Quake more than 20 years ago.

Set the FOV to some narrow angle to give yourself a sniper sight, go to a long corridor, take a nail gun, shoot horizontally along the length of it. You will see how nails end up below the aiming cross.

If it were a rounding error, the nails would end up randomly distributed the aiming cross.

Alas, shotgun did not sport the same effect IIRC, though the hit of every individual pellet was accounted for separately.

Re:How Do Bullets Work in Video Games? by SmooL on Wednesday December 25, 2019 @02:44PM (#21880081)
There's actually many games that account for bullet drop! The article talks about this, but off the top of my head there's PUBG, and any game that involves a bow and arrow as a weapon.
Re:How Do Bullets Work in Video Games? by Thaxll on Thursday December 26, 2019 @09:01AM (#21883819)
Battlefield one of the most popular FPS has been doing bullet drop from a while.

https://battlefield.fandom.com/wiki/Projectile_mechanics

Re:How Do Bullets Work in Video Games? by thatguy0900 on Wednesday December 25, 2019 @02:41PM (#21880068)
https://youtu.be/cix07R1vlhI Arma 3 is the most advanced I know of, accounting for bullet drop and speed loss when passing through different objects with different caliburs
Re:How Do Bullets Work in Video Games? by gallexme on Wednesday December 25, 2019 @02:46PM (#21880090)
Project reality, squad even more advanced with wind and smth about earth rotation I forgot the Name of it

There's also the ace3 mod for Arma 3 which makes bullets behave more real

Re:How Do Bullets Work in Video Games? by kanaba on Wednesday December 25, 2019 @05:38PM (#21880871)
Re:How Do Bullets Work in Video Games? by magicalhippo on Wednesday December 25, 2019 @03:43PM (#21880330)
Video games in general do a poor job, but there are some exceptions. The Delta Force[1] for example did bullet drop 20 years ago, as well as Novalogic's multiplayer game Joint Operations: Typhoon Rising from 2004 which also supported up to 150 players per server.

[1]: https://en.wikipedia.org/wiki/Delta_Force_(video_game)

[2]: https://en.wikipedia.org/wiki/Joint_Operations:_Typhoon_Risi...

Re:How Do Bullets Work in Video Games? by ErneX on Wednesday December 25, 2019 @04:30PM (#21880588)
Some games do model bullet drop.