beyond-all-reason / spring

A powerful free cross-platform RTS game engine
https://beyond-all-reason.github.io/spring/
Other
210 stars 100 forks source link

Burst fire weapon + fastautoretargeting allows shooting units without turning weapon #1451

Closed thehobojoe closed 4 months ago

thehobojoe commented 5 months ago

Description

For any unit that has a burst fire weapon and fastautoretargeting, if the target is killed mid-burst, the weapon instantly retargets and finishes the burst on any in-range units without having to spend time turning the weapon.

Expected behavior

Burst is halted or ended until the turret turns to face the target.

Demonstration

This can be seen most easily with the razorback armraz and thor armthor in BAR.

https://github.com/beyond-all-reason/spring/assets/3493638/b580e795-a94c-4915-8fce-998a0f3f26c3

https://github.com/beyond-all-reason/spring/assets/3493638/060cf1d9-4e76-45b4-b2e6-6aa78b2f9caf

https://github.com/beyond-all-reason/spring/assets/3493638/a8c75ef6-ac37-4445-a273-361be9449259

Replay demonstrating issue

2024-04-16_05-01-24-286_Asteroid_Mines_V3_105.1.1-2314-g9e0bf7d BAR105.sdfz.zip

marcushutchings commented 5 months ago

Try setting fireTolerance on the unit's weapon def.

float fireTolerance  default: 32768.0 (+/- 180 degrees) New in version 99.0

    Final check to prevent weapons from shooting sideways. If a weapon is about to fire but the difference between its old aim and requested aim is greater than this angle (in cau) then it will not fire.
sprunk commented 5 months ago

This doesn't require fast auto regardeting and is reproducible by merely changing attack target mid-burst. Give a weapon 100 burst with 0.1 burstrate and see.

Expected behavior Burst is halted or ended until the turret turns to face the target.

I don't want salvos to randomly stop. IMO there should at least be an option to keep firing but in the direction of the turret as it turns. Perhaps this is what sweepfire could do? Right now it's only for beamlasers but keep in mind beamlaser is internally also just a burst.

marcushutchings commented 5 months ago

I've got the implemetation to cut the fire. Sweeping the fire is going to be more tricky. I'll think about how that can be achieved. Sweeping weapons circumvent the burst fire code.

marcushutchings commented 5 months ago

Possibly we block out of arc target acquisition until the burst is over? As an option.

thehobojoe commented 5 months ago

This doesn't require fast auto regardeting and is reproducible by merely changing attack target mid-burst. Give a weapon 100 burst with 0.1 burstrate and see.

Expected behavior Burst is halted or ended until the turret turns to face the target.

I don't want salvos to randomly stop. IMO there should at least be an option to keep firing but in the direction of the turret as it turns. Perhaps this is what sweepfire could do? Right now it's only for beamlasers but keep in mind beamlaser is internally also just a burst.

Finishing the burst during re-aiming would be really cool, I'd be very much in favor of that, but certainly not a requirement to fix the main problem.

Though with units with aoe weapons it could open up a lot of interesting design and balance possibilities I think.