Search the Community
Showing results for tags 'logic'.
Found 1 result
Computers are good at math, right? So it follows that video games should be able to do plenty of physics calculations while you run around shooting zombies and stuff, right? Well, the thing is, they have to do a lot of calculations - and they have to do them really, really fast. Take, for example, some game based on a large map, with somewhere around a hundred players, all trying to shoot each other to death. Handled naively, every time a player shoots, the game would have to continuously test if the bullet is intersecting any player on the whole map at any given point along its path. And even handling one single player isn't easy! It's gotta check if it hit the player's foot, leg, other leg, hip, abdomen, shoulder, arm, other shoulder, other arm, neck, head... And then it gets even more confusing when you suddenly have an impenetrable pan on your back blocking some bullets. Now, check for all of these intersections somewhere between twenty and a hundred and twenty times per second, for every single bullet, for every single player. Basically, it's kinda hard for even fast computers to keep up, while remaining accurate. But that's where humans and their fandangled logic comes in! Now, how could a bullet possibly hit someone, if it's practically in a different time zone from them? Short answer: it can't! (Unless you have teleporting bullets, in which case you should be selling the technology for billions, not shooting people with it). So, take this giant map, and split it up into anywhere from a few to a bunch (so specific, I know) of little bitty squares. Now, as players move around, you've gotta keep track of which square they're in, which takes a bit more work. But now, when you have a bullet (or a few thousand) flying through the air, there's no way it's going to hit someone that's not within either its own zone, or maybe one of the adjacent zones. Now you've gone from checking every player in the game, to between zero and a handful! Much easier! These same sorts of logical assumptions can be made for all sorts of locality-based applications, like virtual lighting (really, do you want to simulate a billion photons shooting around a room?), more advanced collision detection (we've done point-like bullets hitting round-ish parts of bodies, but what about really complex, non-convex things hitting each other?), as well as odd things like splitting up a group of points into non-spiky triangles (or tetrahedra). That actually has applications in fluid dynamics, modelling the density of stars in galaxies, and a bunch of other things way over my head.