@Adoxa: Figuring out at what range do solars show up on Solar scanner tab.
-
Hey Adoxa, I’d very much appreciate some assistance in figuring out what defines the distance at which stations and other solars show up on the ‘Solar’ tab of the scanner list.
For testing purposes I’ve used a system containing nothing but one station, which was showing up on scanners from 13.9k distance. (regardless of range of scanner I was equipping)
Initially I have attempted to find the answer in CEScanner::Update, and subsequently in ScanList::add_in_range, but didn’t end up with anything useful. I have then changed my approach and checked Freelancer.exe, using an offset found in your plugin, ShipFilter, which led me to sub_4D0490, a method called when rendering the actual contact list.
While having the scanner set to the ‘Solar’ tab, I have ran through the code with the station in range and out of range, and the divergent point was the call at Freelancer.exe+0xD1754, which leads to sub_63315B0 in common.dll. The same method is being called from within ScanList::add_in_range.
The distance check is done in the area of code beginning in Common.dll 0x63316AA, the position offset being held in the vector ranging from ESP+0x10 to ESP+0x18, from which a squared distance is calculated, which is then checked against what can only be called a ‘detection distance’, which is a sum of ESI+0xC and EBX+0xC, operation done in common.dll, 0x63316AA.
When the method is called from within ScanList::add_in_range, ESI offset value is unknown to me, but constant across both callouts, which is relatively small 115.53596
The EBX offset value is the equipped-scanner range when called from ScanList::add_in_range, but when its called from Freelancer.exe, it’s instead overriden with a seemingly arbitrary value, in my case, 14000.Summary: While I can understand what is going on in general, I’m unable to determine the source of the two values (ESI+0xC and EBX+0xC) which when summed up become the distance detection threshold, when called specifically from Freelancer.exe+0xD1754
If any part of this is not clear, please let me know and I’ll happily assist as best I can.
-
I am aware, however the question I have is: What determines the range being used? For example, both Freeport 5 and Leon Base in Omega-41 both show up at the aforementioned 14k range, whereas most(all?) stations in New York, such as West Point Academy, show up regardless of range. As far as ini and solararchs are concerned, both are regular stations, which means that it isn’t always the 14k, and it can be affected, to an extent at least.
We have a use case in Discovery Mod that relies on limiting detection range of a specific subset of solar archetypes to a much lower amount, along the lines of 3k, but regardless of what we try, they show up at 10k. We are looking for the actual source of this detection threshold.
-
Very odd design decision, and sadly doesn’t allow us to freely customize the range on per-model basis, but at least now we know. Much appreciated!