Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Fighter collision and targeting  (Read 1237 times)

NoFoodAfterMidnight

  • Ensign
  • *
  • Posts: 39
    • View Profile
Fighter collision and targeting
« on: August 14, 2019, 07:33:17 PM »

Is there a way to get non-PD weapons to stop even hitting fighters, or at least to stop targeting them? I've looked through the API but can't seem to find a way, was wondering if anyone else found a way to mess with collision/targeting implementation.
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Fighter collision and targeting
« Reply #1 on: August 14, 2019, 08:42:49 PM »

Absolutely, but you'd have to write a Weapon AI.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

NoFoodAfterMidnight

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: Fighter collision and targeting
« Reply #2 on: August 14, 2019, 11:20:32 PM »

Oh thanks, I didn't know that was possible.

But no way to make weapons not collide with fighters?

One of the more frustrating things is having a stray fighter fly through your strike fire, die popping the projectiles, then have its debris soak up even more damage. Speaking of is there any way to turn down debris HP/have fighters not make any?
Logged

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: Fighter collision and targeting
« Reply #3 on: August 15, 2019, 01:45:02 PM »

Hmm...

For Strike weapons, making them not hit enemy Fighters might be easy enough. 

There's an old thing in the .WPN specifications, allowing for a Weapon to have a specific mask (see concept of a bitmask if you're not familiar with how that works) for evaluating collisions.  I'm not sure if it's still working or Alex deprecated the code, however; I haven't messed with it in ages.

Essentially, you'd go into the .WPN / PROJ and write "pierceSet":["FIGHTER"]... I think?

I'll play around with this and see if it works.  I wanted to write something to allow certain weapons to pierce through MissileAPI's reliably; I had a system in Vacuum, but it was a little clunky.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Wyvern

  • Admiral
  • *****
  • Posts: 3786
    • View Profile
Re: Fighter collision and targeting
« Reply #4 on: August 15, 2019, 02:01:44 PM »

Weapons with the STRIKE tag will (generally) not be used by the AI against fighters - though STRIKE also has some other implications that you may not want (like the AI refusing to put such weapons on auto-fire), and it may need to be combined with USE_VS_FRIGATES.  You can see the available tags here: http://fractalsoftworks.com/starfarer.api/com/fs/starfarer/api/combat/WeaponAPI.AIHints.html

The vanilla plasma cannon is also capable of shooting through fighters - it hits them, but the shot keeps going.
The vanilla tachyon lance used to be capable of shooting through fighters and missiles, but I think that ability got removed?  I'd have to double-check and I don't have the game in front of me right now.
Logged
Wyvern is 100% correct about the math.

Morrokain

  • Admiral
  • *****
  • Posts: 2143
  • Megalith Dreadnought - Archean Order
    • View Profile
Re: Fighter collision and targeting
« Reply #5 on: August 15, 2019, 02:17:10 PM »

The vanilla tachyon lance used to be capable of shooting through fighters and missiles, but I think that ability got removed?  I'd have to double-check and I don't have the game in front of me right now.


There's an old thing in the .WPN specifications, allowing for a Weapon to have a specific mask (see concept of a bitmask if you're not familiar with how that works) for evaluating collisions.  I'm not sure if it's still working or Alex deprecated the code, however; I haven't messed with it in ages.

Essentially, you'd go into the .WPN / PROJ and write "pierceSet":["FIGHTER"]... I think?

I don't have a clue whether or not its actually used in vanilla like Wyvern said, but you definitely can always set any beam to pierce through fighters and missiles through editing its .weapon file. I do it in Archean Order for just about every beam since there are so many fighters. Beams used to be pretty suboptimal before I made that change. (Always would get stuck on the fighter cloud.)

Just set:

Code
	"pierceSet":[PROJECTILE_FF,PROJECTILE_NO_FF,PROJECTILE_FIGHTER,MISSILE_FF,MISSILE_NO_FF,FIGHTER],

in the file.

EDIT: Oh, and forgot to mention I don't think that code works for projectile weapons. Only beams, if I recall correctly. The closest thing to that for projectiles is the plasma cannon projectile file, and that forces your projectile to look a certain way so keep that in mind.
« Last Edit: August 15, 2019, 02:19:34 PM by Morrokain »
Logged

NoFoodAfterMidnight

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: Fighter collision and targeting
« Reply #6 on: August 16, 2019, 10:18:20 PM »

Awesome, thanks guys!
Logged