[Beta] Cheetah's Radars: now with Target Scanning & Analyzing! для Space Engineers
Attention!
Before accusing me of removal of something from the mod, read this.Donation is now possible! Here's the link.
NEW FEATURE: Target Analyzing! Look below for details.
Many, many starting scripters were looking at the Raycast mechanism and thought: can I build a radar with it? Then they calculated, and found out that 4-5 cameras are enough to track something you already know of, but to determine if anything is around, arrays of thousands are needed. So, eyeballing around and squinting at anything suspectible remained the only viable way of detecting stuff. Surprisingly enough, there's not many radar mods on the Workshop, and they are either old and often get broken, or require whitelist hacking, or unbalanced, or they do not support programmable block scripting. I decided to fix this issue.
Radar Dome: it's like a raycast, just better
This mod works not unlike a Raycasting Camera, but under the hood, there's some optimization. Instead of blindly poking all around the sky, the mod's script "knows" all nearby objects, and then tests if they are detectable by the radar. Such "reverse" approach allows to keep overall load low, even in dense debris clouds.
How does this work?
You need to build the Radar Dome, power it, switch some settings and you already can sweep your surroundings for derelicts or hostile ships.
Which sizes are available?
There are three Radar sizes: 1x1x1 large grid (which also serves as 5x5x5 small grid), 3x3x3 small and 1x1x1 small. They differ from each other by maximum supplied power and, thus, by efficiency of detecting things at large distances.
How do I view the radar's output?
In the Radar's terminal menu, there is the "Show Markers" option. With this option enabled, GPS waypoints will appear on your HUD, not unlike in Tyrsis' old beacon mod. These waypoints will track every object detected by the Radar, displaying it's type, distance, relationship, and name (if available). They are even colored based on the ownership: enemies will appear red, owned grids will appear blue, allies will appear green, neutral/unowned objects will appear white or gray.
To top it off, the HUD markers will be displayed as long as the Radar can reach your suit or your ship via your Antenna Network.
Hey, I'm a starting scripter and I can't quite figure out how to use the Radar from a PB script.
I've created a simple helper class which simplifies the work with the Radar. Just create the Radar class with an IMyTerminalBlock reference pointing to the Radar Dome, and the resulting instance will expose the main functions of that Radar block in a neat wrapper.
How the Radars work internally? How they detect things?
These Radars consist of five main components: Active Radar, Passive Radar, Heat&Radiation Scanner, Turret Sensor and Gravimetric Detector, packed for convenience in a single Radar Dome. All these require a direct line-of-sight from radar to the target.
Active Radar
Active Radar is intensively probing the space with radiowaves. It is, by far, the most powerful detection mode. The visibility of a given object depends on the active radar's current power, distance to object and it's size. The detection rule is:
Distance <= (TotalPower/1000 * Grid.ActiveDetectionRate/40)
where TotalPower is the sum of all Radars' powers, and ActiveDetectionRate is WorldVolume * 400 (decreased by decoys). WorldVolume is a sphere which can encompass the grid's copy-paste box. For example, the ADR for Argentavis pirate ship is 20000.
However, keep in mind that Active mode with enough power supplied will effectively broadcast your position to every Radar around, and every one of them will have a MyDetectedEntityInfo entry with your ship's coordinates. Active Radar can be turned off in terminal, in favor of other components. A Radar at 10 MW will be visible to all Radars in 20 km radius.
Note that you can reduce the detection rate (and thus detection range) of your ship for Radars in Active Mode by installing Decoys on it. Decoys fool Radars by emitting an erratic radio pattern which is complementary to the ship's radio signature, and make your ship look like it is a natural radio source. On close ranges, where the reflected signature is strong, it does not make sense as the Radar is capable of telling apart the real pattern and faked pattern, but on large distances, the defining points of your ship's signature can be over-powered by Decoys, effectively turning your signature into noise.
The more operational decoys the target ship has, the lower it's visibility distance will be. If the target has 10 decoys and default detection distance of 10 km for particular radar power setting, it's detection distance drops to 3850m.
Passive Radar
Passive Radar is silently listening to the space around, looking for radio signals of artificial nature. It picks up antenna broadcasts, beacons, and other Radars. A Passive Radar cannot be detected since it is not emitting a significant amount of power, but it also cannot see something that is keeping silence.
It also keeps track of every grid accessible via Antenna Network. This can be helpful when scripting radar-powered drones.
Heat and Radiation Scanner
This module detects ships based on their reactors' combined current output. If a target is currently actively using up Uranium, it will appear as visible to the Radar, depending on distance. For example, a Large Grid Large Reactor working at 2/3 load will be visible from 20 km.
Note that Batteries and Solar Panels are nearly invisible for the scanner, so, disabling your reactors and switching to battery power is a good idea when you need to go stealth.
Turret Sensor
The so-called "Turret" sensor employs the same short-range scanning principle as regular AI turrets. It is capable of picking up any ship on distances up to 1000m, no matter what.
Gravimetric Detector
It detects ships based on their mass and active gravity generators. While being pretty useless for detecting light ships, it makes significant difference when the target's weight surpasses 1000 tonnes. When deployed against the largest of known warships, the Gravimetric Detector may locate them before any other component.
Note that the Gravimetric Detector cannot tell apart rock and steel if they are close to each other, thus, ships and stations anchored to voxels are seen as yet another space potato. Use this wisely when you need to hide something very heavy.
Target Analyzing
Now the Radars can analyze the grids that are around them, and give you the list of all terminal blocks on the grid! The scanning distance is limited to 3 km range and could be further decreased by Decoys, but in any case it is no less than 1 km. You are also limited to 1 scan per 10 ticks per Radar block, so choose wisely. This feature is currently only available for Programmable Blocks. Refer to the wrapper class for usage tips.
— An unsuccessful scan will produce null. Always check the scan result for being null.
— A successful scan will produce a List<Dictionary<string, string>> describing every block on the grid. Each dictionary contains basic information on a terminal block: Type, Subtype, Enabled state (always "null" in case of non-togglable blocks such as cargo containers), Functional (non-broken), WorldPosition, OwnerID and Accessible (relative to Radar owner).
Thanks to Vicizlat for the Radar Dome models!