Posted by: mikew
« on: April 19, 2009, 10:21:06 AM »
Here is something that *may* be a little more workable in determining intra-interval detection without any "higher math" For each group of ships determine the range to each other "group" in the system and compare against longest range sensor(s). For the next turn, determine the range again and compute a closing speed (range rate) by simply dividing the range difference by the time between checks. If you presume that these will remain relatively constant, you can then determine with a fair amount of confidence whether the groups will enter detection range in the next interval. This would only have to be done for fleets in systems with other potential targets. If ships reach a turnpoint, transit a warp point, etc., you'd have to restart calculations of course, since that changes the range rate criteria. At any such event, you can simply assign arbitrary range rates to other groups of ships equivalent to the maximum possible closing speed to determine whether a detection might be possible- once you run the first interval, you then have an actual rate for future calculations.
When the numbers indicate a potential detection range arrival, calculate positions of the ships/populations/whatever involved, recalculate the range rate, and determine whether to continue and for how long, and begin again. Eventually, your algorithm will bring you down to the shortest possible interval and your ships then enter detection range, at which point player interaction is called for as necessary. This iterative process will likely result in somewhat longer processing times, as it will at some point or another shorten the interval to check for detections which don't actually occur, and will likely do so multiple times during approach to actual contact, but it WILL get you to the correct point of first detection. With straight line movers, closing range rates will decrease as the range drops, so you will never have a ship manage to unexpectedly appear inside detection range.
This will be complicated if fleets are spread out over a large areas, but if they vessels are clumped relatively close together, only the best sensors need to be checked on the basis that short range sensors won't make the initial detection in any case. Based on what I've read so far, though, fleets won't be excessively large, and there won't be that many ships in any single system, so the overhead of calculating intevals shouldn't be that great. The slowdown will occur when the system starts running the shorter intervals as ships approach detection range. I don't know how long a typical update takes, so I can't estimate how much this will slow everything down- you might just be grabbing a soda from the fridge, or you might be cooking dinner- it depends on how long your normal intervals take to calculate.
So, bottom line - you'll end up breaking your intervals down more often when multiple ships are in the same system. You'll always do new calculations when ships transit to new systems (I imagine that happens now anyway), and if potential targets are in the system you'll need shorten intervals when ships approach waypoints to turn or change speed, and in addition when ships are calculated to potentially enter detection ranges based on previous closing speeds. You will NOT have to retain any additional data on previous positions, nor use any new formula. It should only result in significant slowdowns when vessels are actually in systems with possible targets, and then only when either approaching to contact or if vessels are maneuvering during the turn.
Mike