Hmmmmmm - I just had a thought - this "identify task force" stuff could probably be used to cut down on the N^2 sensor checks - basically divide all the ships in a system up into task forces before looking for "contact candidates" - basically the idea is to do a check between task forces to see if there's any hope of getting a contact before performing a more careful check between individual units in the task force. The "divide into task forces" step should be very cheap, since if you're using zero range you can just use == on x and y and if you're using non-zero range you can sort TG in x and then compare neighbors in the sort (if there are too many things in an x bin you can then do the same thing in y, but this is unlikely), and the initial check between Task Forces should result in a much smaller "N" in the N^2.
This type of calculation is possible but it is complicated. I could run a comparison on other fleets within the system for the distance to the targeted fleet, find those within a set range and calculate their sensor chances against the missiles compared to those of the target fleet. Presumably I would base that on their distance to the missiles rather than the target fleet. This would also add some time to the real time required for the turn for each case. Finding those on the missile track is much harder. I am inclined to think that I could spend that real time running smaller increments instead. It's a lot easier and covers every fleet, population and friendly buoy/missile in the system without having to work out their proximity to the missiles. In any event, unless the fleets are on exact reciprocal courses, once the missiles get within a few game time minutes of the target, the sub-pulses will switch to ten seconds each, which will cover all possibilities on the approach. Rather than add extra calculations up front, which could turn out to be a LOT of extra calculations in a major battle, I could just increase the ten minute catch-all time to fifteen or twenty minutes.
I'm actually suggesting something that (I think) is a lot simpler, and would probably speed up performance, due to cutting the number of sensor checks. The missile picket stuff is just a side-effect/bonus.
Let me describe what I'm thinking in wet-navy language (e.g. detection logic that might have been coded up for Harpoon). Think of a 20-element CVBG, including AWACS. Instead of modeling it as 20 point-like objects, each with its own sensor range, etc, model it as a "disk" of a certain radius, with sensor capabilities equal to the best of the 20 elements in each category and signature equal to the worst of the 20 elements in each category. Let's say that there's a red force with 50 elements divided up into 3 groups, and a blue force with 60 elements divided up into 5 groups. The detection phase then consists of checking between groups first using a range that's distance between disks (which is just the distance between centers minus the sum of the two radii); a "does not detect" between a pair of groups means that you don't have to check any further between elements of the groups, since there's no way they can see each other. So in the case where the two groups are a long way away from each other, you only end up doing 30 checks (3*5 for red and 5*3 for blue), as opposed to 600 (50*30 for red and 30*50 for blue).
So the proposal is to break the ships up into groups at the start of the increment, and just leave them that way. If you're worried about the performance of breaking them up (N^2 comparisons within a player's ships), then you could actually let the players specify which ships are operating together through a dialog - you've already got a lot of this information through the "escort" order.
I have recently added an extra calculation for those situations when an NPR fleet is closing on a PR fleet. Rather than carry out a lot of checks up front, which can get particularly complex if the pursuing fleet is slower and there are a lot of other units in the system, the game checks for a basic minimum intercept times. If that is less than 12 hours, the game runs a 12 hour increment with 10 minute sub-pulses (approx 10 seconds). if it is less than 24 hours, a 1-day increment with 15 minute sub-pulses is run (13 seconds). The 12 hour turn is to avoid those situations that occur at present with very small increments during pursuit situations. 10 or 15 minutes should be sufficient granularity for most ship to ship situations. I could change this if it proves not granular enough. One of the other changes I have made during the rewrite is that all NPR warship and scout movement is calculated pre-movement on every increment. Nothing is ever saved to the database. This takes about 0.7 seconds for the Trans-Newtonian campaign. Because of this, the interception check is carried out at the point the AI decides to carry out an interception. After all NPR movement is determined, the shortest interception is used as the basis for the above. Note this doesn't cover PR fleets closing on NPRs but the player will be aware that the closing is taking place and will no doubt chose smaller increments (which will have smaller auto-subpulses) in the case the NPRs turn out to be more dangerous or numerous that first thought
Cool!
That still leaves one more tricky issue. [SNIP]
I guess that is no different that the v4.0b SM events regarding alien presence in a system, although those no longer exist in v4.1. I think the benefits in terms of simplicity and performance probably outweigh the disadvantages. That is, unless I am missing something obvious, which is why I am posting the idea before implementing it
Actually, this (detection of bad guys when they transit into a hostile system) is working really well in v4.0b. As you say, (I think) an interrupt event gets generated, whether or not the WP is picketed. In addition, Aurora seems to be calculating arrival time so that it stops at the time of transit (which shouldn't be expensive, since there's no N^2). So I'm not sure how your idea is different/better than what's being done now in v4.0b. I would keep things the same as v4.0b, with the following minor tweaks:
1) Do a detection check (for that ship) when the ship transits, and only halt the increment if the ship is detected.
2) Do a detection check on the pre-transit side too (for the transiting ship). Right now, a bad guy who's glowing like the Sun can blow right by my pickets on the "friendly" side of a WP if a typical large increment is being used - when the increment stops, they're on the other side of the WP and undetectable. If you knew a ship was going to make a transit, you could give the WP the ship's signature and see if anyone could detect it - if so, treat it like a missile engagement with the ship being the missile, i.e. take some smaller sub-pulses.
3) This doesn't solve the "bouncing geo-survey" problem, where an NPR geo-survey ship keeps transiting back and forth between two fully surveyed systems, and one side of the WP is under observation. I think that problem needs to be solved on the AI side, though.
As far as my personal preferences on the "realism" issue go, my v4.0b game has led me to the viewpoint that I'd rather err on the side of detecting things that should be detected over getting information that I'm entering a system with bad guys in it. I also find it useful to get a "something's about to happen" indicator so that I can back up my DB in case a detection gets missed and I need to re-play with smaller increment. I've found that I have a pretty good idea where the bad guys are if I know about the race, so the only situation where I think you'd be getting much additional info is when transiting an already explored system that the bad guys have snuck into, and even that wouldn't be a lot of info since I typically don't go looking through my fleets to see who just transited if I get an NPR interrupt.
How's that sound?
John