Page 1 of 1

[0.17.34] lead_target_for_projectile_speed always targets player

Posted: Tue Apr 30, 2019 2:08 pm
by Deadlock989
Hi,

I saw the (not in wiki) lead_target_for_projectile_speed parameter set for worms, which are a kind of enemy turret at their core.

If you set this parameter in your own modded turrets, they start start shooting at you (i.e. they shoot at where they think you'll be when the projectile gets there) rather than leading from the enemy target that activates them. This happens if the turret is set to target_type direction or entity (I haven't tested position).

Expected behaviour: friendly turrets lead from the target they're actually firing at, not at the player who just happens to also be within firing range.

I just got a load of torpedos in my face unexpectedly, it was most disconcerting.

Re: [0.17.34] lead_target_for_projectile_speed always targets player

Posted: Tue Apr 30, 2019 5:28 pm
by Klonan
Can you post the mod

Re: [0.17.34] lead_target_for_projectile_speed always targets player

Posted: Wed May 01, 2019 12:59 pm
by Deadlock989
Klonan wrote: Tue Apr 30, 2019 5:28 pm Can you post the mod
Sorry, can't, it's bundled with a ton of other stuff. I will try and make a demonstration mini-mod for it when I get time.

Re: [0.17.34] lead_target_for_projectile_speed always targets player

Posted: Wed May 01, 2019 1:39 pm
by kovarex
Moved to pending until we get a way to reproduce.

Re: [0.17.34] lead_target_for_projectile_speed always targets player

Posted: Wed May 01, 2019 5:37 pm
by Deadlock989
OK, I think this is probably not a bug, just some weird behaviour brought about by not understanding how this parameter works.

I tried to reproduce this using only vanilla entities using the attached minimod and save. I don't get quite the same erratic player-centred behaviour as I do with my modded turrets, but it's close. I think what is happening is that lead_target_for_projectile_speed just doesn't work well with turrets that have a long range. It consistently targets ahead, and if the entity is moving at a tangent, that works out to be way ahead. Also, acceleration on the projectile massively confuses it. In certain cases, when the targeted enemy is far enough away, the lead it calculates just happens to centre on the player - because that's where the enemy is headed anyway ...

Load up the attached, there are biters to the south, aggro them by shooting one briefly and then lead them back up to the modded laser turrets (which shoot explosive cannon shells). Once the turrets have activated, run back and forth east to west. Occasionally you will see the turrets fire at a really odd location.

If you have any documentation that would help with picking sane values for lead_target_for_projectile_speed, it would be great to see it. In the base game, it's always 0.3375, and I have no idea where that comes from - but it is only used on worm and spitter streams, which are all pretty similar to each other.