Brainstorm This My Two Cents on Turret AI

    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:
    • 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
    Example Tiebreakers:
    • 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 %
    So what would this look like in practice? Let's say you have a ship with four kinds of turrets--a main gun designed for punching ships bigger than it, a medium-sized turret with ion beams designed for taking out shields, a medium-sized turret with piercing weapons designed to take out hulls, and a tiny turret for shooting missiles.
    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.
     
    Joined
    Nov 3, 2014
    Messages
    624
    Reaction score
    287
    • Community Content - Bronze 2
    • Wired for Logic
    • Legacy Citizen 6
    it definitley needs an overhaul... on the other hand i also don't want it to become too specific because there need to be ways to distract them...
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    I agree.

    Secondary suggestion: This is a graphical front-end which automatically generates LUA AI code in the background, which can be saved and loaded as custom AI scripts. This graphical programming would allow players to gradually learn and understand LUA by comparing their choices with the code it generates.
     
    • Like
    Reactions: alij331
    Joined
    Oct 13, 2013
    Messages
    109
    Reaction score
    82
    it definitley needs an overhaul... on the other hand i also don't want it to become too specific because there need to be ways to distract them...
    Why do there need to be ways to distract them? Shouldn't people's turrets only do what they're supposed to do?
     
    Joined
    Nov 3, 2014
    Messages
    624
    Reaction score
    287
    • Community Content - Bronze 2
    • Wired for Logic
    • Legacy Citizen 6
    because if the ai is too good it would not make sense to put humans into ships anymore. - crewability
     

    Keptick

    Building masochist
    Joined
    Sep 26, 2013
    Messages
    4,062
    Reaction score
    1,841
    • Councillor 2 Gold
    • Railman Gold
    • Thinking Positive Gold
    Yep Yep Yep, I said a similar (although really summarized) thing in one of the other turret threads. Having something like this would really help with turrets.

    That and separating the pirate/ship AI config from turret AI config.
     
    Joined
    Oct 13, 2013
    Messages
    109
    Reaction score
    82
    because if the ai is too good it would not make sense to put humans into ships anymore. - crewability
    I disagree. None of this effects the accuracy of turrets, which is pretty poor on most servers. Also, humans will almost always be more intelligent than any amount of prescripted activity, because with humans, you can talk to them and adjust strategies on the fly.
     

    CyberTao

    鬼佬
    Joined
    Nov 10, 2013
    Messages
    2,564
    Reaction score
    641
    • Legacy Citizen 4
    • Railman Gold
    • Thinking Positive
    The only thing I might think could be an issue is the ability to set most of your turrets as "Priority 1: Missiles". Though it would make sense with small PD turrets that we use now, allowing that kind of thing opens up the option to make giant turrets with multiple computers to exploit the AI firing all computers. A giant turret originally with 2 5k outputs now has hundreds of 10 dps outputs (accounting for lost space from computers), making missiles effectively useless (accounting for the fact that PD will be fixed accuracy wise, and missiles having more appropriate speed).

    Also, I would opt for a more simplified version to appear as default, but for a more advanced tab to be toggle-able as well, with at least this many options. Why? Because a wall of settings/sliders/buttons might throw newer players off a bit if their first interaction with AI is too indepth. Asking for an explanations via chat or forums on how to even best use the AI within their first days is something I would personally want to avoid.
    Would be nice to also have these settings for AI ship engagement - which target they would pick while in a fleet (when we get that feature).

    I also like the idea of Lua code ingame to tweak behavior for the more advanced players. Just for a more personalized touch to your fleet, and maybe adding in exceptions maybe. I dunno.
     
    Joined
    Feb 24, 2014
    Messages
    160
    Reaction score
    11
    Cool thoughts. I like the ability to customize stuff so this would work for me
     

    Keptick

    Building masochist
    Joined
    Sep 26, 2013
    Messages
    4,062
    Reaction score
    1,841
    • Councillor 2 Gold
    • Railman Gold
    • Thinking Positive Gold
    So, I just read the entire thing (I skimmed it for my other reply).

    FUCK YES.

    If this doesn't make it into the game I will make sure that schema doesn't get any cake. Ever.
     
    • Like
    Reactions: Koloss_Meshuggah

    Lecic

    Convicted Lancake Abuser
    Joined
    Apr 14, 2013
    Messages
    5,115
    Reaction score
    1,229
    • Thinking Positive Gold
    • Purchased!
    • Legacy Citizen 11
    Support.

    We've had big, slow-turning turrets
    All turrets turn at the same speed. This will (probably) change in the turret update (coming after the GUI update) though.
     
    Joined
    Dec 3, 2013
    Messages
    552
    Reaction score
    182
    • Legacy Citizen 9
    • Purchased!
    • Community Content - Bronze 1
    Just read this after making a similar thread. I fully support this idea. As for CyberTao's concern about new players I agree completely. I would suggest a much easier interface for noons to start with and an "advanced" tab for those of us that really want to dig into it. I think the basic interface could have options like this:

    [] Ally [X] Enemy [] Neutral (check as many as you want from these 3)

    Ships [1]
    Turrets[3]
    Asteroids [0]
    Space Stations [2]
    Astronauts [4]
    Missiles [5]

    *A value of zero indicates that, that type of target would not be targeted.

    *you could not enter the same priority for two target types (except for zero)

    Keep in mind that this is just a fast example. there could be more values and such but I'm too lazy to write all the possibilities down. BUT I think that a simple menu like this could help new players get use to the idea of setting a role for their turret until they want to jump down the rabbit hole.
     

    Lecic

    Convicted Lancake Abuser
    Joined
    Apr 14, 2013
    Messages
    5,115
    Reaction score
    1,229
    • Thinking Positive Gold
    • Purchased!
    • Legacy Citizen 11
    Just read this after making a similar thread. I fully support this idea. As for CyberTao's concern about new players I agree completely. I would suggest a much easier interface for noons to start with and an "advanced" tab for those of us that really want to dig into it. I think the basic interface could have options like this:

    [] Ally [X] Enemy [] Neutral (check as many as you want from these 3)

    Ships [1]
    Turrets[3]
    Asteroids [0]
    Space Stations [2]
    Astronauts [4]
    Missiles [5]

    *A value of zero indicates that, that type of target would not be targeted.

    *you could not enter the same priority for two target types (except for zero)

    Keep in mind that this is just a fast example. there could be more values and such but I'm too lazy to write all the possibilities down. BUT I think that a simple menu like this could help new players get use to the idea of setting a role for their turret until they want to jump down the rabbit hole.
    It'd be even nicer if we could make it target ships based on things like remaining shields, remaining HP (when that gets implemented), mass, docked ship count, etc.
     
    Joined
    Jan 31, 2015
    Messages
    1,696
    Reaction score
    1,199
    • Thinking Positive
    • Likeable
    because if the ai is too good it would not make sense to put humans into ships anymore. - crewability
    As an avid PvP nut with tens of thousands of competitive matches under my belt, I disagree very, very strongly.

    Even if every weapon on your ship hits an enemy every time it fires, this does nothing to eliminate human intelligence, tactical response, or strategic awareness from the situation. All it does is eliminate micro-management. A ship captain IRL doesn't have to aim all his cannons manually, nor are his crewmen who aim for him retarded simply because they are not captains.

    Consider some of the most played - and watched - PvP games in the world; eSports like League of Legends & Starcraft (I&II). If I'm in range of a valid target, my unit automatically fires and hits every time unless my opponent performs some kind of evasion or interrupt (cloak, teleport, shield, wall, paralyze, etc), and I can assure you that such matches are extremely intense and skill-driven. The human still has to know when and where to commit, when to withdraw, which targets to focus on, how to counter enemy maneuvers, etc.

    I'm 100% in support of turret AI of the highest possible caliber. It supports PvP the way people have shown they prefer to fight it.
     

    Mered4

    Space Triangle Builder
    Joined
    Jan 12, 2014
    Messages
    662
    Reaction score
    190
    • Community Content - Bronze 2
    • Purchased!
    • Legacy Citizen 4
    As an avid PvP nut with tens of thousands of competitive matches under my belt, I disagree very, very strongly.

    Even if every weapon on your ship hits an enemy every time it fires, this does nothing to eliminate human intelligence, tactical response, or strategic awareness from the situation. All it does is eliminate micro-management. A ship captain IRL doesn't have to aim all his cannons manually, nor are his crewmen who aim for him retarded simply because they are not captains.

    Consider some of the most played - and watched - PvP games in the world; eSports like League of Legends & Starcraft (I&II). If I'm in range of a valid target, my unit automatically fires and hits every time unless my opponent performs some kind of evasion or interrupt (cloak, teleport, shield, wall, paralyze, etc), and I can assure you that such matches are extremely intense and skill-driven. The human still has to know when and where to commit, when to withdraw, which targets to focus on, how to counter enemy maneuvers, etc.

    I'm 100% in support of turret AI of the highest possible caliber. It supports PvP the way people have shown they prefer to fight it.
    Exactly.

    Unfortunately, I've had a difficult time convincing people that they need to think bigger in Starmade PvP. Many folks seem content with the occasional fighter 3v3 tourney or organized faction war between small-ish factions - but they continue to ignore the huge potential for an experience beyond anything we've ever seen.

    Imagine EVE's biggest fights, but between two fleets of custom ships, all created by the community. Or the thrill of a space sim like Limit Theory or Freelancer, but YOU MAKE THE SHIPS. You literally create the universe.

    That's what we are playing right now, and the best ships will be used throughout the lifetime of Starmade as the standard vessels that we measure against as benchmarks for future builds.

    I know performance has an upper ceiling somewhere, but we have to stop thinking about the battles of the past and start considering the fights for the future. Previously, its been about you, the player, fighting with one or two of your friends against a similarly sized force with forward facing primary weapons and seriously oversized turrets (depending on the weight class). It was more like a space shooter - which is kinda fun, until you start getting to really large servers, where there isn't a whole lot to do besides mine for more resources so you can buy one more ship.

    This game is amazing as it is right now - but half that, in my mind, is its amazing potential. By no means can I sell this as a great play to folks unless they are already in love with the creative aspect. Getting turrets right - so as to encourage multiple levels of play and cooperation - is a small, but important step to reaching the future of Starmade.

    The game can become so much more than a niche title in its own genre. Custom ships + open universe + incentives to go fight other players? Talk about a game-changer.

    But balance, both survival and otherwise, doesn't encourage this. It encourages smaller, more compact builds at first. But, as the universe develops, players are forced to overshield their ships just to survive for a few more seconds, and this snowballs into the Titan weight class. Everyone starts flying around in these massive behemoths that can kill eachother in seconds. We need a better balance, but we also need better mechanics. Especially when it comes to turrets.
     
    • Like
    Reactions: Keptick
    Joined
    Dec 10, 2014
    Messages
    36
    Reaction score
    4
    • Purchased!
    Personally Id like to be able to add groupings of turrets to my weapon hotbar for an easy access "on/off" switch. I know you can do that through the catalog, but when things are really going down I dont have time to scan through dozens of lines of text looking for specific turrets.

    Like you wouldnt be forced to put them in your hotbar, and would be totally optional. Would it need a new block type? Basically a logic block that shows up in your weapons tab when placed on your ship, that you can name whatever you want, and slave turret docking modules to. So when its activated in the weapon hotbar, it turns all attached turrets in that group "on/off"

    So say I have a set of turrets that are really energy hungry that I only switch on when I have juice to spare. Now I can leave those off unless I really need them. Or say I notice that a certain set of turrets is totally innefective against an enemy. Id want to just switch them off so they stop wasting energy.

    The AI ideas suggested by the OP are great sounding, but id also like the choice of a straight up, hardwired "on/off" switch I can use any time, like Im suggesting. Both combined would be great.
     
    • Like
    Reactions: Lecic and Sgtwisky

    Valiant70

    That crazy cyborg
    Joined
    Oct 27, 2013
    Messages
    2,189
    Reaction score
    1,168
    • Thinking Positive
    • Purchased!
    • Legacy Citizen 4
    As an avid PvP nut with tens of thousands of competitive matches under my belt, I disagree very, very strongly.

    Even if every weapon on your ship hits an enemy every time it fires, this does nothing to eliminate human intelligence, tactical response, or strategic awareness from the situation. All it does is eliminate micro-management. A ship captain IRL doesn't have to aim all his cannons manually, nor are his crewmen who aim for him retarded simply because they are not captains.

    Consider some of the most played - and watched - PvP games in the world; eSports like League of Legends & Starcraft (I&II). If I'm in range of a valid target, my unit automatically fires and hits every time unless my opponent performs some kind of evasion or interrupt (cloak, teleport, shield, wall, paralyze, etc), and I can assure you that such matches are extremely intense and skill-driven. The human still has to know when and where to commit, when to withdraw, which targets to focus on, how to counter enemy maneuvers, etc.

    I'm 100% in support of turret AI of the highest possible caliber. It supports PvP the way people have shown they prefer to fight it.
    *BASHES AGREE BUTTON WITH A SLEDGEHAMMER*
     
    • Like
    Reactions: Sgtwisky
    Joined
    Oct 1, 2013
    Messages
    60
    Reaction score
    1
    Great Idea.
    I agree.

    Secondary suggestion: This is a graphical front-end which automatically generates LUA AI code in the background, which can be saved and loaded as custom AI scripts. This graphical programming would allow players to gradually learn and understand LUA by comparing their choices with the code it generates.
    Should be optional as it might slow stuff down.
     
    Joined
    Feb 10, 2014
    Messages
    317
    Reaction score
    244
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 7
    I like this, but lets go a little further. lets add the ability to assign sectors of fire, for the turrets. That way turrets on the starboard side aren't wasting their time shooting at targets on the port side when they should be shooting things on their side.
     
    • Like
    Reactions: Mered4