Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trajectory projectiles enhancement #1246

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Coronia
Copy link
Contributor

@Coronia Coronia commented Apr 25, 2024

Some enhancement for trajectory projectiles, especially for Bombard Trajectory. Many thanks to NaotoYuuki who provided trajectory scatter logic and the prototypes of vertical and meteor projectiles, which are used as the base of these additions.

1 - Both Straight Trajectory and Bombard Trajectory now support Inaccurate=true, BallisticScatter.Max and BallisticScatter.Min keys, which allows them to scatter when picking targets.

2 - Bombard Trajectory, instead of simply flying to the top of the target and free fall, is now extended into a series of trajectories which flying to a 'turning point' first, and then turning to the targets or respawning on their top. The behaviors of the projectile and the position of the turning point could be customized by the following tags:

  • Trajectory.Bombard.FallPercent controls the distance of the turning point by its percentage of the total distance between attacker and intended target. If set to 0%, then it'll fly up vertically. If set to 100%, then it'll travel to the top of the intended target.
    • For each launch the turning point percentage could add or minus a random value, which is not greater than Trajectory.Bombard.FallPercentShift. If set to 0%, random shift will be disabled.
    • You can also makes the turning point scatter in a circle with Trajectory.Bombard.FallScatterRange as its radius. If set to 0, random scatter will be disabled.
  • Trajectory.Bombard.FreeFallOnTarget controls how it'll hit the intended target. If set to true, the projectile will be respawned above the intended target and free fall. If set to false, the projectile will travel to the intended target from the turning point.
  • Trajectory.Bombard.NoLaunch controls whether the attacker will fire the projectile by itself. If set to true, projectile will directly fall from the turning point.
  • Trajectory.Bombard.FallSpeed controls the initial speed of the projectile after it turns. If set to 0.0, then it'll use Trajectory.Speed. Can't work together with Trajectory.Bombard.FreeFallOnTarget=true.
  • Trajectory.Bombard.TargetSnapDistance controls the maximum distance in cells from intended target the projectile can be at moment of detonation to make the projectile 'snap' on the intended target. Set to 0 to disable snapping.

In rulesmd.ini:

[SOMEPROJECTILE]                          ; Projectile
Trajectory=Bombard                        ; Trajectory type
Trajectory.Bombard.Height=0.0             ; double
Trajectory.Bombard.FallPercent=1.0        ; double
Trajectory.Bombard.FallPercentShift=0.0   ; double
Trajectory.Bombard.FallScatterRange=0.0   ; floating point value
Trajectory.Bombard.FreeFallOnTarget=true  ; boolean
Trajectory.Bombard.NoLaunch=false         ; boolean
Trajectory.Bombard.FallSpeed=0.0          ; double
Trajectory.Bombard.TargetSnapDistance=0.5 ; floating point value

If all values are set to default, it'll perform as the old Bombard Trajectory, so those who have made use of it don't need to modify their ini if they want it to behave the same.

NOTE: Both the old and new Bombard Trajectory will crash when firing a Voxel=true projectile, which is unresolved yet. Avoid using it for now, and if someone could make it work I'll be really grateful.

Copy link
Contributor

@FS-21 FS-21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine

Copy link

github-actions bot commented May 26, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Coronia
Copy link
Contributor Author

Coronia commented May 30, 2024

added a tag to display anim when the projectile is 'turning'

  • Trajectory.Bombard.TurningPointAnim, if set, will play an anim when the projectile reaches the turning point. If Trajectory.Bombard.FreeFallOnTarget is set to true, it'll be spawned above the target with the projectile together. If Trajectory.Bombard.NoLaunch is set to true, it'll be played at where the projectile falls, no matter if it's free fall or not.

In rulesmd.ini:

[SOMEPROJECTILE]                          ; Projectile
Trajectory.Bombard.TurningPointAnim=      ; Animation

also, both #1261 and this PR has implemented Inaccurace for trajectory, with different approach however. The other method considered about distance between the target and the firer, which seems to be how it's worked in vanilla. Please check these 2 implementations to see which is better and should be kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants