Phobos-developers / Phobos

Ares-compatible C&C Red Alert 2: Yuri's Revenge engine extension
GNU Lesser General Public License v3.0
294 stars 89 forks source link

Trajectory projectiles enhancement #1246

Closed Coronia closed 3 weeks ago

Coronia commented 5 months ago

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:

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.

github-actions[bot] commented 4 months ago

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 commented 4 months ago

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

In rulesmd.ini:

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

also, both https://github.com/Phobos-developers/Phobos/pull/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.

Coronia commented 3 weeks ago

Close it for now since some logic is conflicted with the one made by CrimRecya, and the pattern of tags need to be uniformed. Will reopen or start a new pull request after some other trajectory pull requests are merged