Page 1 of 2

Target prioritising of turrets

Posted: Tue Sep 08, 2015 11:40 pm
by Boogieman14
Current behaviour of turrets appears to be to lock onto a target and keep firing at it until it's gone. In the vanilla game, this doesn't matter much because most biters and spawners vaporise instantly with sufficiently researched turrets. When you're using modded enemies however, this can lead to potential issues. For instance, with bobenemies, new spawners exist that have 3500 hitpoints so they take a while to blow up. In the time this takes, several new biters or spitters can spawn and eat away at the turrets. It would probably be more sensible if the turrets would switch to a new target if they detect something that poses a bigger threat than their current target. Or perhaps somewhat simpler logic: prioritise the enemy object with the lowest amount of hitpoints.

All this of course assumes turret creeping isn't considered an invalid tactic (but if it is, I think new tools need to be introduced to push back against the biters in mid game; the tank doesn't seem well equipped to handle big biters).

Re: Target prioritising of turrets

Posted: Wed Sep 09, 2015 1:41 pm
by SirRichie
I do not think this is a balancing issue, it is much more an issue about turret AI.
I see the problem you outline. The problem with your approach is that if I had a mod which puts in spawners which spawn a lot of small enemies at a high rate, the turret would only fire on the biters, not the true threat.

In short, what is the biggest threat very much depends on setup parameters and it is very hard to come up with a "one-size-fits-all" strategy.
What might work is to support some turret-AI-profiles, which the user or the mod can select.

Re: Target prioritising of turrets

Posted: Wed Sep 09, 2015 1:56 pm
by Boogieman14
Well, there already is some intelligence built into turrets in that it seems they don't fire any more than is required to kill the target (with a distant enemy, they'll stop firing well before the target actually dies, while the last projectiles are still in flight). That appears to be communicated to neighbouring turrets too. So provided each turret could pick a different target in that big, weak swarm, that should still be ok. Then again, if a mod adds that kind of swarms, it would in my opinion also be responsible for providing the means to deal with those swarms (ie: flamethrowers :twisted: ).

But yeah, I'll agree the correct approach requires some more thought. Perhaps turrets could have a selectable firing profile. Or different turret types could have different profiles. Perhaps there could be a globally applicable list where you define target priorities manually (so you could order those swarm type mobs below their spawner, but all other moving enemies above all spawners)

Re: Target prioritising of turrets

Posted: Wed Sep 09, 2015 6:39 pm
by ssilk
I can see the following (and that is taken from the tower defense games I know):

- A turrets fire to the biggest target (that with the most HP) in range.
- A turret fires to the weakest target (lowest HP) in range.
- A turret fires to a target, that is possibly not targeted by another turret.
- A turret fires to targets, which are over 50% of their max HP.
- A turret fires to targets, which are under 50% of their max HP.
...

... more possibilities of course. I think option 3 is CPU expensive and it is also a bit complicated to find the HP's of all targets.

Re: Target prioritising of turrets

Posted: Wed Sep 09, 2015 8:57 pm
by orzelek
Having only first two and current mode (which I think is the nearest enemy) would be a big improvement.

Re: Target prioritising of turrets

Posted: Sun Sep 27, 2015 2:31 am
by DaemosDaen
If your only having the issue when using Bob's mods, then you may want to be protecting your sniper turrets with normal (or upgraded) gun turrets kept out of range of spawner your are having issues with. (this tactic also work with vanilla turret creep.)

I personally like having dumb turrets, something unnerves me when the machines get too smart.

Re: Target prioritising of turrets

Posted: Mon Sep 28, 2015 12:21 am
by bobucles
Bob's turrets, huh? A full line of sniper turrets is totally impenetrable. With enough turrets prioritization is pointless.

Turrets are already smart enough to use the proper number of shots and not waste overkill.

Re: Target prioritising of turrets

Posted: Mon Sep 28, 2015 1:38 am
by Kane
bobucles wrote:Bob's turrets, huh? A full line of sniper turrets is totally impenetrable. With enough turrets prioritization is pointless.

Turrets are already smart enough to use the proper number of shots and not waste overkill.
But Bob! Jimmy Said Else! So Jimmy is Right!

Re: Target prioritising of turrets

Posted: Mon Sep 28, 2015 2:55 am
by Ranakastrasz
Main thing I would want is for modded sniper-type turrets to be able to prioritize targets with armor that their damage is able to largely bypass compared to allied turrets, and not open fire on weak enemies that other turrets can kill, setting off a cooldown and wasting somewhat more expensive ammunition.

Re: Target prioritising of turrets

Posted: Mon Sep 28, 2015 12:18 pm
by bobingabout
i think the default should be to attack whatever has the least health. being able to select other logics (Probably definied in the data definitions, so you can't change it in game) such as most health etc would be good too.

Whatever comes into range first is okay on smaller things, but with those behemoth biters, they can take so long to die that all those big biters have eaten your wall and are chewing away at your turrets by the time the behemoth finally falls.

Re: Target prioritising of turrets

Posted: Mon Sep 28, 2015 4:27 pm
by bobucles
A good targeting algorithm is all about reducing the enemy's DPS as quickly as possible. Target priority is about taking down the glass cannons first, then the regulars, then the weak tanky types. Then you have to worry about maximizing AoE damage against enemy clusters, properly calculating enemy damage potential when enemy AoEs/DoTs/debuffs are involved, and taking armor types into account to assure best output.

Or you could just like not be a cheapo and build more turrets man. Quantity has a quality all its own.

Re: Target prioritising of turrets

Posted: Thu Mar 03, 2016 5:13 am
by Nova
To be honest, I think the turrets should not be too clever. All we should have is:
- A turret attacks the "most threatening" enemy.
- A turret doesn't change the attacked enemy until it's dead or not in range anymore.

"most threatening" is more or less easy to define. If we stay with biters and spitters only (and I hope we don't do that) than we should say "All big, then all middle, then all small" units. Don't know if spitters or biters are worse, you decide.

Re: Target prioritising of turrets

Posted: Thu Mar 03, 2016 11:29 am
by bobingabout
Biters increase in difficulty exponentially, where spitters increase linearly, so a small spitter deals more damage than a small biter, but a big biter deals more damage than a bit spitter. But Spitters have less health, as a trade off for an attack range.

As for your mentioned behaviours, shoot until dead, or out of range, that's how it works already, it just doesn't have a threat rating system, so it shoots at whatever comes into range first.
when it dies there and there's already lots in range already, I don't know how it decides. I have 3 possible guesses, there could be whatever is closest, whatever is scanned first on the global list as being in range, in which case it's whichever enemy spawned first, or whichever is scanned first within the range bounding box (if there is one).
Most likely option B, whichever as spawned first.

Re: Target prioritising of turrets

Posted: Thu Mar 03, 2016 5:04 pm
by Nova
Turrets are already quite intelligent: They attack a biter, but only until there are enough shots fired to kill it, even if they didn't reach it yet. If a biter takes 4 shots, a turret will fire 4 times and then attack another biter while the shots fly to the first biter and kill it. That's quite impressive.

Re: Target prioritising of turrets

Posted: Fri Mar 04, 2016 12:27 am
by bobingabout
Nova wrote:If a biter takes 4 shots, a turret will fire 4 times and then attack another biter while the shots fly to the first biter and kill it. That's quite impressive.
Unfortunately, that logic also has flaws. I've seen people posting complaints in the modding forum where they've modded in say, a shotgun turret, this logic kicks in, but the biter doesn't die, the turret moves onto the next target since it's fired the required shots to kill it, but that biter is then ignored by all other turrets because of that logic.

Re: Target prioritising of turrets

Posted: Fri Mar 04, 2016 12:59 am
by ssilk
That is only possible, cause every shoot is a hit and it is calculated at the moment, before the gun shots. So it knows exactly if the biter dies now or not. :)

The rest of the "shoot" is drawing the bullets until it hits. Especially with the lasers you can really see - if a biter is fast - that the laser shots in curves, so he can't be missed out. ;)

Re: Target prioritising of turrets

Posted: Fri Mar 04, 2016 1:02 am
by Supercheese
bobingabout wrote:Unfortunately, that logic also has flaws. I've seen people posting complaints in the modding forum where they've modded in say, a shotgun turret, this logic kicks in, but the biter doesn't die, the turret moves onto the next target since it's fired the required shots to kill it, but that biter is then ignored by all other turrets because of that logic.
Huh, I've had great success with using Cannon Turrets + Bobwarfare Scatter Cannon Shells as shotgun turrets, but I do always tend to use them in conjunction with other turrets, so that might be why I don't encounter this issue.

Re: Target prioritising of turrets

Posted: Sat Mar 05, 2016 8:03 pm
by MeduSalem
Well... has anyone here ever played the game "Harvest: Massive Encounter"?

For a tower defense game it did a quite nice job in my opinion.

I always wished for Factorio to adopt the diversity of enemies like HME has and eventually to have many different types of turrets to counter them as well which can be set to different priorities like so:

Image

Each turret type has 4 priorites (High, Normal, Low, Ignore) which work on a global scale (every turret of a particular type is affected by the settings). All enemy types could be put to a priority level of your choice by drag&drop.

The game had also an interesting feature which allowed the laser turrets to focus on another laser turret, effectively daisy chaining them, to form an even stronger laser turret with more power and further reach. It's quite funny actually.

I really recommend people (also the Factorio devs) to take a look at that game. It has some interesting features that might actually be worthwhile to be ripped off and I wouldn't blame the devs because if there is one part Factorio definitely needs improvement on it is the variety of enemies, the variety of turrets and combat in general. And to look how other tower defense games do it might be worthwhile the effort in my opinion because trying to defend your factory from neverending hordes of bugs is nothing more than a tower defense game in that aspect as well.

Re: Target prioritising of turrets

Posted: Sun Mar 06, 2016 3:39 am
by ssilk
I just had a idea: Take that above and add some new circuit sensors that enables us to measure the number of different aliens in range.

Now this: Depending on sensor input and calculations done in the combinators, change the priority of the weapons... that could be really fun to change the target priorities in real-time via circuits.

Re: Target prioritising of turrets

Posted: Sun Mar 06, 2016 5:55 am
by MeduSalem
ssilk wrote:I just had a idea: Take that above and add some new circuit sensors that enables us to measure the number of different aliens in range.

Now this: Depending on sensor input and calculations done in the combinators, change the priority of the weapons... that could be really fun to change the target priorities in real-time via circuits.
While I like the "Factorio-like" approach with using circuit networks to change priorities etc... I have one concern... Wouldn't it be a nightmare to hook up... lets say 3000 turrets to multiple circuit networks? :roll:

One would have to split the defense into multiple sections along the wall because each sensor would obviously only be covering a limited area and thereby each single sensor could only control the turrets that are actually pointing to the area covered by said sensor. So each sensor and attached turret battery would require its own combinator contraption to do the calculations. Rinse and repeat for the entire perimeter.

It can be handled of course... with blueprints and stuff which would have my approval, but somehow there could be an easier, global way too for people who are not that much into micromanagement.

Right clicking on a turret to open up a window (like Power poles etc) to adjust priorities globally for all turrets seems somewhat easier and would get the job done as well...