- Joined
- Oct 13, 2013
- Messages
- 109
- Reaction score
- 82
There's been a lot of buzz lately about different ways turret AI should work, such as adding more types of selectable targets. While I was reading that thread, I thought about how I would like turret AI to function, and I came up with an idea that I think will please most people, and likely wouldn't be too difficult for Schema to program.
This will be a bit of a wall of text, but bear with me.
The Problem
I'm sure we've all had our own frustrated moments with turrets. We've had ion turrets waste minutes firing at enemies without shields. We've had giga-nuke-doom-turrets waste their 45-second recharge shot on a drone. We've had little anti-boarder security turrets fire at enemy dreadnaughts. We've had big, slow-turning turrets decide to fire at the enemy completely behind it, and spend the next fifty years turning around instead of shooting at the frigate buzzing in front of its reticule. You get the idea.
Currently, as far as I can tell, AI will target the closest enemy it detects, then continue to fire at that enemy until it moves out of range or is destroyed, even if something else comes closer, or something else is closer to the angle where it's currently aiming.
My solution will fix this problem without creating (much of) a headache for spaceship designers.
My Assumption
When I build a turret, I always know in my gut what I want it to shoot at. I have little anti-fighter turrets, medium anti-frigate turrets, and giant anti-capital ship turrets. I have anti-shield ion turrets, anti-hull missile or penetrating turrets. I have anti-fighter Stop turrets. So I'm assuming that most other designers feel pretty similarly, in that they have a reasonably good idea of what they want their turrets to shoot at, but just wish they could tell their turrets that.
I'm also assuming that most people playing Starmade aren't computer programmers, and don't want to have to manually program their AI. We want a midway measure--more options without having to reinvent the wheel.
My Solution: Target Priorities
I propose being able to, in the BOBBY AI menu, create a list of "Target Priority Categories." That is, the turret will fire at targets in your first category above all else, and they will fire at the second category if there is no detectable target in the first, and at targets in the third category if there's no targets in the second, and so on. If there's no viable target in any category, the turret will do nothing. Maybe it will default to its 'C' position, if people want that (I would, but I get not everyone would). Not super important.
Every Target Priority Category will have two components: a Category and a Tiebreaker. The turret will look at all enemies in range the given category (such as "Missiles" or "bigger than 100k blocks" or "closer than 10km" or "shields out") first, and if there are more than one, it will go to the tiebreaker (ex. Closest, Furthest, Biggest, Smallest, Closest to Reticule, Furthest from Reticule, Highest Shield %, etc.).
There would also be a global setting for your AI to shoot at Enemies, Neutrals, and/or Friends (you'd want it to shoot at friends if you have a healing beam, enemies if you have guns, and neutrals if you're into piracy). There could also maybe be a toggle between "keep firing at chosen target until its dead," "keep firing at chosen target until its no longer in the given category and/or dead" and "Periodically rescan for targets" (rescan for target interval would be a serverside setting, with a time increment chosen based on performance)
For example:
Example Categories:
These aren't necessarily the most optimal AI configs, but they should serve to show you how powerful this system could be.
Large Turret:
Shoot At: Enemies. Rescan periodically.
Priority One: Targeted by Player (Tiebreaker: N/A) |The ship will shoot whatever the player is targeted at first.
Priority Two: Any Target (Tiebreaker: Biggest Target) |If the player isn't targeting anything, the turret will default to shooting at whatever's biggest.
Medium Ion Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Shield % above 0% (Tiebreaker: Biggest Target) |Take out whatever has shields, prioritizing the biggest targets first. Another good option would be making the Tiebreaker prioritize whatever has the highest shield %, depending on what you want.
Priority Two: Targeted by Player (Tiebreaker: N/A) |If there's nothing with shields anywhere, fire at what the player is targeting, on the assumption that its important.
Priority Three: Any Target (Tiebreaker: Biggest Target) |If there's nothing with shields anywhere, and the Player isn't aiming at anything, just shoot whatever's biggest.
Medium Piercing Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Shield % below 0% (Tiebreaker: Biggest Target) |Take out whatever's shields are out, prioritizing the biggest thing in range.
Priority Two: Any Target (Tiebreaker: Lowest Shields) |If there's nothing without shields, just shoot whatever has the lowest shields. You could also, for example, set the turret to hunt incoming missiles instead, depending on what you want.
Tiny Point Defence Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Missiles (Tiebreaker: Closest to Reticule) |If there's any missiles, shoot at whatever you're closest to aiming at. Another valid option would be "Closest Target" (whatever's nearest the spaceship)
Priority Two: Astronauts (Tiebreaker: Closest Target) |If there's no missiles anywhere, take potshots at enemy astronauts.
Priority Three: Any Target (Tiebreaker: Smallest Target) | If there's no missiles or astronauts anywhere, just take pot shots at passing fighters.
Other examples:
Harvester:
Shoot At: Neutrals, Enemies. Keep firing until its dead or no longer in category.
Priority One: Overheating (Tiebreaker: Biggest Target) |You could have a turret with harvester cannons on it shoot at
Shield Regenerator:
Shoot At: Allies. Rescan Periodically
Priority One: Targets with shields less than 100% (Tiebreaker: Lowest Shield %) |You could have a turret with shield regenerators helping friendlies in battle. You could make a similar setup for power regenerators, repairbeams, etc.
Current Dumb AI:
Shoot At: Enemies. Keep firing until its dead.
Priority One: Any Target (Tiebreaker: Closest Target) |This is, I'm pretty sure, an exact simulation of how the current turrets work in my new system. So you can keep doing that, if you like.
Ideally, AI configs could be saved as profiles (similar to how the copy/paste block sections can be saved) so that you don't have to reinvent the wheel whenever you make a new turret. The game could come with a couple of default configs ("Point Defence," "Shoot Biggest Ship," "Shoot Smallest Ship") for newbies to use.
Anyway, sorry for the wall of text. These are my thoughts on turret AI. I think this is the only way to really get turrets (and I guess drones, though they'll probably need more settings) to do what we want them to.
This will be a bit of a wall of text, but bear with me.
The Problem
I'm sure we've all had our own frustrated moments with turrets. We've had ion turrets waste minutes firing at enemies without shields. We've had giga-nuke-doom-turrets waste their 45-second recharge shot on a drone. We've had little anti-boarder security turrets fire at enemy dreadnaughts. We've had big, slow-turning turrets decide to fire at the enemy completely behind it, and spend the next fifty years turning around instead of shooting at the frigate buzzing in front of its reticule. You get the idea.
Currently, as far as I can tell, AI will target the closest enemy it detects, then continue to fire at that enemy until it moves out of range or is destroyed, even if something else comes closer, or something else is closer to the angle where it's currently aiming.
My solution will fix this problem without creating (much of) a headache for spaceship designers.
My Assumption
When I build a turret, I always know in my gut what I want it to shoot at. I have little anti-fighter turrets, medium anti-frigate turrets, and giant anti-capital ship turrets. I have anti-shield ion turrets, anti-hull missile or penetrating turrets. I have anti-fighter Stop turrets. So I'm assuming that most other designers feel pretty similarly, in that they have a reasonably good idea of what they want their turrets to shoot at, but just wish they could tell their turrets that.
I'm also assuming that most people playing Starmade aren't computer programmers, and don't want to have to manually program their AI. We want a midway measure--more options without having to reinvent the wheel.
My Solution: Target Priorities
I propose being able to, in the BOBBY AI menu, create a list of "Target Priority Categories." That is, the turret will fire at targets in your first category above all else, and they will fire at the second category if there is no detectable target in the first, and at targets in the third category if there's no targets in the second, and so on. If there's no viable target in any category, the turret will do nothing. Maybe it will default to its 'C' position, if people want that (I would, but I get not everyone would). Not super important.
Every Target Priority Category will have two components: a Category and a Tiebreaker. The turret will look at all enemies in range the given category (such as "Missiles" or "bigger than 100k blocks" or "closer than 10km" or "shields out") first, and if there are more than one, it will go to the tiebreaker (ex. Closest, Furthest, Biggest, Smallest, Closest to Reticule, Furthest from Reticule, Highest Shield %, etc.).
There would also be a global setting for your AI to shoot at Enemies, Neutrals, and/or Friends (you'd want it to shoot at friends if you have a healing beam, enemies if you have guns, and neutrals if you're into piracy). There could also maybe be a toggle between "keep firing at chosen target until its dead," "keep firing at chosen target until its no longer in the given category and/or dead" and "Periodically rescan for targets" (rescan for target interval would be a serverside setting, with a time increment chosen based on performance)
For example:
Example Categories:
- Any Target (ie, go to Tiebreaker)
- Targeted by Player (Tiebreaker doesn't matter)
- Target closer than X meters
- Target further than X meters
- Block count between X and Y
- Block count bigger than X
- Block count smaller than X
- Missiles
- Astronauts
- Shield % Above X
- Shield % Below X
- Power % Above X
- Power % Below X
- Overheating
- Closest Target
- Furthest Target
- Biggest Target
- Smallest Target
- Closest Target to Reticule (ie, where the turret is aiming)
- Furthest Target from Reticule (away from where the turret is aiming)
- Highest Shield %
- Lowest Shield %
- Highest Power %
- Lowest Power %
These aren't necessarily the most optimal AI configs, but they should serve to show you how powerful this system could be.
Large Turret:
Shoot At: Enemies. Rescan periodically.
Priority One: Targeted by Player (Tiebreaker: N/A) |The ship will shoot whatever the player is targeted at first.
Priority Two: Any Target (Tiebreaker: Biggest Target) |If the player isn't targeting anything, the turret will default to shooting at whatever's biggest.
Medium Ion Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Shield % above 0% (Tiebreaker: Biggest Target) |Take out whatever has shields, prioritizing the biggest targets first. Another good option would be making the Tiebreaker prioritize whatever has the highest shield %, depending on what you want.
Priority Two: Targeted by Player (Tiebreaker: N/A) |If there's nothing with shields anywhere, fire at what the player is targeting, on the assumption that its important.
Priority Three: Any Target (Tiebreaker: Biggest Target) |If there's nothing with shields anywhere, and the Player isn't aiming at anything, just shoot whatever's biggest.
Medium Piercing Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Shield % below 0% (Tiebreaker: Biggest Target) |Take out whatever's shields are out, prioritizing the biggest thing in range.
Priority Two: Any Target (Tiebreaker: Lowest Shields) |If there's nothing without shields, just shoot whatever has the lowest shields. You could also, for example, set the turret to hunt incoming missiles instead, depending on what you want.
Tiny Point Defence Turret:
Shoot At: Enemies. Keep firing until its dead or no longer in category.
Priority One: Missiles (Tiebreaker: Closest to Reticule) |If there's any missiles, shoot at whatever you're closest to aiming at. Another valid option would be "Closest Target" (whatever's nearest the spaceship)
Priority Two: Astronauts (Tiebreaker: Closest Target) |If there's no missiles anywhere, take potshots at enemy astronauts.
Priority Three: Any Target (Tiebreaker: Smallest Target) | If there's no missiles or astronauts anywhere, just take pot shots at passing fighters.
Other examples:
Harvester:
Shoot At: Neutrals, Enemies. Keep firing until its dead or no longer in category.
Priority One: Overheating (Tiebreaker: Biggest Target) |You could have a turret with harvester cannons on it shoot at
Shield Regenerator:
Shoot At: Allies. Rescan Periodically
Priority One: Targets with shields less than 100% (Tiebreaker: Lowest Shield %) |You could have a turret with shield regenerators helping friendlies in battle. You could make a similar setup for power regenerators, repairbeams, etc.
Current Dumb AI:
Shoot At: Enemies. Keep firing until its dead.
Priority One: Any Target (Tiebreaker: Closest Target) |This is, I'm pretty sure, an exact simulation of how the current turrets work in my new system. So you can keep doing that, if you like.
Ideally, AI configs could be saved as profiles (similar to how the copy/paste block sections can be saved) so that you don't have to reinvent the wheel whenever you make a new turret. The game could come with a couple of default configs ("Point Defence," "Shoot Biggest Ship," "Shoot Smallest Ship") for newbies to use.
Anyway, sorry for the wall of text. These are my thoughts on turret AI. I think this is the only way to really get turrets (and I guess drones, though they'll probably need more settings) to do what we want them to.