Stormworks: Build and Rescue

Stormworks: Build and Rescue

39 ratings
Advanced Sonar Tracker
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
310.464 KB
28 Sep, 2024 @ 12:17am
28 Sep, 2024 @ 7:07pm
6 Change Notes ( view )

Subscribe to download
Advanced Sonar Tracker

Description
Submarines Beware



Specifications
The ship and torpedo are only really intended as a showcase for the sonar system.

This sonar system was derived mostly from my TWS system. So it's not surprising it works almost identically too. It works by building up a list of new detections before updating target tracks. It doesn't use a position threshold to update target tracks. Instead, tracks are updated by first building a matrix of the distances from detections to tracks. Then using the Hungarian algorithm (Kuhn-Munkres) to find which detection-track pair is closest ( https://en.wikipedia.org/wiki/Hungarian_algorithm ).

This system is also incredibly modular, you can change the UI or add more sonars. I'll touch more on this later in the description.

Selected target coordinates are outputted on channels 1,2,3, where channel 1 is west/east, channel 2 is altitude, channel 3 is north/south). Channel 4 is the ID for which missile is assigned to the track.

Operation
Most of the buttons are just for decoration, but to turn on the sonar you must first press the ping toggle. If you then want to launch on a specific target, highlight the track through the monitor and then press the space-bar to launch a torpedo.

Customisation
With a little work you can add more sonars, in order to increase scan rate. To do so, you'll have to manually change the two highlighted numbers in the lua code though. These numbers are marked with the note "--#sonar", set the first value to the number of sonars in your system and the second to the number of channels you are taking from each sonar.

I've also added a few different options to change sonar parameters in the MC, it's not obvious what each of these do since I've had to keep the names short because of the character limit.

If you feel that target's are disappearing too fast/slow after losing lock you can change it with the "Decay" parameter. Setting this to 8 will mean the target will be deleted if it hasn't been detected for the last 8 scans.

"X" and "Y" should be set to your monitor's size.

The "S" parameter is a bit difficult to explain. This TWS updates tracks by assigning the closest new sonar contact. This can be a problem if you lose a lock on one target, but acquire a different target on the other side of the map. Normally, the algorithm doesn't care how far they are away, it'll update the old track with the new target. S will limit the TWS, by default it's limited to 900 metres, but you should increase this as you increase radar range.

The "M" parameter is pretty niche, makes it so that only the coordinates of the selected target are outputted. Remember that it still outputs altitude over channel 2 though.

If you want details about the code, just DM me.

Permissions
Feel free to re-upload the torpedo and sonar system on your own vehicles, so long as you provide the link to this WS page. Do not, however, re-upload the ship.
28 Comments
Alternative_0 24 Jul @ 6:51pm 
can you make it work with the 2x2 screen?
funhans 16 Apr @ 2:39pm 
Thanks a lot :)
Will try it once I've got some time 👍
SMITHY  [author] 10 Apr @ 6:43pm 
Should be able to copy paste, but you have to increment the ID in the new missile microcontroller so there’s none overlapping
funhans 7 Apr @ 4:12pm 
Very good system, well done!
How can I add more torpedos to the launch system?
SMITHY  [author] 26 Feb @ 12:39pm 
Active sonar only for the foreseeable future , I might add it at some point though
Ragoon 26 Feb @ 9:55am 
Can it passivly detect? or is active sonar mandatory?
Captain Robertson 21 Feb @ 12:29am 
Sounds good and I'm looking forward to any changes that come this way.

Yeah, I'm glad the Devs doubled the character limit recently as it's meant that I can go back into the lua scripts in my own creations and paste the unminified code back into them again, it just makes it so much easier to read and edit on the fly instead of having to jump in and out of Pony IDE all the time.
SMITHY  [author] 20 Feb @ 6:59pm 
I might add that at some point. Only reason it didn't include a passive mode, was because of the character limit at the time.
Captain Robertson 20 Feb @ 8:43am 
Excellent work Smithy! I use this MC as part of my own ASW builds.

The only thing that's missing is the option to toggle between active and passive sonar, as switching between them occasionally would certainly help differentiate between harmless stuff like floating crates, animals 'etc' and things with actual engines and props - like submerged enemy submarines.

Yeah, I think if I kill one more shark or innocent humpback whale then Greenpeace may start to get involved. ;)
SMITHY  [author] 5 Feb @ 4:25pm 
And then do the opposite to change the range