Avorion

Avorion

32 ratings
Accurate auto turrets
2
2
   
Award
Favorite
Favorited
Unfavorite
Mods: Mod
File Size
Posted
Updated
30.302 KB
24 Apr, 2024 @ 5:06am
12 Feb @ 6:04pm
4 Change Notes ( view )

Subscribe to download
Accurate auto turrets

Description
What does this do?
This mod calculates an ideal firing vector based on own position, target position, own velocity, target velocity and projectile velocity for turrets that are not controlled by a player (auto targeting, attack my target).
It works on player owned ships and only if the target is a ship.
Should work with all kinds of weapons including instant hit weapons like railguns or lasers.

What does this not do?
This does not guarantee a hit, instead it just greatly improves hit rate compared to vanilla targeting.
Weapons are not 100% accurate which makes it impossible to have 100% hit rate when the target is far away, also
this cannot predict whether the target changes its speed while the bullet is already flying (obviously). Higher distance to target means bigger impact on hit rate if its speed changes.


Notes:
- This was my first time working with lua and Avorion modding. If you encounter any issues please let me know so i can look into it
- Due to constraints when solving the quadratic equation which is necessary to calculate firing vector this won't work when the relative velocity between target and own ship is bigger than the projectile velocity (solution for the equation would be complex in this case)
- Avorion resets entity scripts when you enter a new sector which also resets the saved turret array and thus temporarily disables this mod. The mod refreshes the turret array every ~10s to combat this so don't worry when the mod seems to be doing nothing right after entering a sector.
23 Comments
Pobblebonk  [author] 23 Jun @ 4:40pm 
@leeson400 Thank you!
leeson400 22 Jun @ 2:49pm 
This mod is impressive, it's like a night & day difference in autoturret tracking effectiveness.
This should be in the actual game, not a mod! It's that essential.
Solid work Pobblebonk, this and the ai version of this mod are never leaving my subscribed mods.
Pobblebonk  [author] 5 Jun @ 5:20am 
@Phrill As far as I know coaxial turrets cannot be made into auto turrets.
There is (probably) a way to circumvent that by ignoring if a turret is automated or not, but that would always make coaxial seeker launchers automated with no way for the player to use them manually. Also there seems to be no way of telling a turret that its current firing angle is ok for shooting with a mod, because the variables controlling that are marked as read-only in the documentation.

Apart from the technical difficulties, coaxial seeker launchers from turret factories are incredibly overpowered and make the game trivial, even on the highest difficulty settings. I think having to control them manually is not a bad thing.
Phrill 4 Jun @ 9:21am 
does this also make coaxial seeker weapons work with AI? xD Im frustrated that the AI wont fire seeker misle launchers if they are seeker because thes have to be aimed at the enemy for the AI to fire them.
Bakker 3 May @ 2:37pm 
It's a very handy mod especially when mining asteroids.:avorion:
Pobblebonk  [author] 18 Mar @ 2:32am 
yes
Ragatokk 17 Mar @ 5:32pm 
Cheers man, assume if I want it for both AI and Players I use both mods.
Pobblebonk  [author] 10 Mar @ 3:39am 
@Ragatokk Both mods should work with this one.
2843935966 works very similarly for beam weapons so you can use one or both mods for pretty much the same effect.
2992808971 changes a lot of stuff so I can’t guarantee that there won’t be any issues, you’ll have to try it yourself.

I can make a version just for AI ships, you’ll have to wait a couple days tho until I have time to do it.
Ragatokk 4 Mar @ 7:59am 
Is it compatible with 2843935966 and 2992808971 ?
Could you please make a separate workshop entry with the changes that enables it for all ships?