Vincent Athena wrote:Now if all 100 ships shoot a missile, its got to do the above 100 times, a total of 10,000 checks. If there are 2000 ships on grid all shooting then 4 million checks need be done.
Each check is not trivial. For guns, the server first has to update the potential target's position to the moment of the shot. It then has to find the minimum distance between the line segment describing the shot and the center of the ship at its updated position. If that distance is smaller than the ship radius, a hit is registered.
Okay, I see that the calculations can scale at N^2 if they're brute forced.
I guess the main point is to compare N targeting vectors with M displacement vectors to determine whether they are approximately colinear and shorter distance. I just tried this out with a small program on my laptop, and for N=M=2000 random vectors (4M comparisons), the calculation took 0.1 seconds.
The loop is trivially parallelizable with a couple of openmp directives, so on the 4-core Sol blades of TQ, these computations would take a factor 4 less. And in practice, the number of targeting vectors to use in computations would actually be decreased by a factor of eve-clock-tick/average-rate-of-fire. So you can imagine this computation adding a fraction of a second per clock tick of an already time-dilated battle.
A more advanced calculation would project the signature radius of the potential occluder onto a plane transverse to its displacement vector. It's fairly simple linear algebra to map the targeting vector onto the plane and determine whether it falls into the sig radius, probably a few extra floating point operations over what I've done.
The Eve model for calculating hits - involving sig radius, transversal and turret speed - is already fairly sketchy as a model of real physical turrets. But this allows them to apply some quick-and-dirty approximations (e.g. using sig radius rather than a detailed model of the shape of the ship) which are still somewhat consistent within the "physics" of Eve.
For more simplifications, you could just exclude small objects from the computation - for instance, invent a rule that frigates and smaller (drones, missiles) never get involved in these type of occluding events.
A more advanced version of that would be to exclude ships beyond a certain distance, which might depend on their signature radius. For instance a battlecruiser at 50km subtends a very small solid angle and is highly unlikely to occlude a shot. So a good approximation would be to ignore it.
And for close range brawlers, there are very few additional occluders with a distance less than its target, so you automatically cut out the bulk of the calculations for those ships.
Missiles are more complicated, but some hacks might be sufficiently good for play. You could do the calculation once at launch - this would correspond to something like the missile locking on to the wrong target. Or just update the calculation 2 or 3 times along the flight of the missile. That's probably good enough for hollywood.
More radically, you could invent a lore explanation which removes missiles from this type of calculation. They are guided, so maybe their guidance systems are good enough to avoid intervening targets. This would correspond to a big buff for missiles over turrets, so would have to be balanced out in other ways. But it could be a neat way of adding further differentiation between the weapon systems.
Finally, I'd say that even if you exclude ships from occluding calculations and just consider large collidable objects, structures and asteriods, that would already be a huge improvement to the tactical game.