[General Purpose] New Disperse trajectory#1295
Closed
CrimRecya wants to merge 116 commits intoPhobos-developers:developfrom
Closed
[General Purpose] New Disperse trajectory#1295CrimRecya wants to merge 116 commits intoPhobos-developers:developfrom
CrimRecya wants to merge 116 commits intoPhobos-developers:developfrom
Conversation
|
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. |
… Fix DisperseWeapon now can target to Disguise and Cloak within DisguiseSensors and Sensors range
…d time calculate and targeting a building
chaserli
requested changes
Sep 19, 2024
Contributor
chaserli
left a comment
There was a problem hiding this comment.
This one is fully decoupled and can/should go first among all these 3 new trajectories. I might have a few concerns about potential overhead in BulletRetargetTechno but it should be fine in game.
FS-21
pushed a commit
to FS-21/Phobos
that referenced
this pull request
Feb 18, 2025
This is a sequel of Phobos-developers#1246, which makes use of logic and tag standard from the other trajectory pull requests (Phobos-developers#1293, Phobos-developers#1294, Phobos-developers#1295 and Phobos-developers#1374), and also utilizes the generic random anim function from (Phobos-developers#1380). Many thanks to @CrimRecya for making these projectiles as well as helping with improvement of enhanced Bombard trajectory. Also thanks **NaotoYuuki** for providing the prototypes of vertical and meteor projectiles, which are used as the base of these additions. 1 - 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.Height` controls the height of the turning point. - `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 randomly in a circle with `Trajectory.Bombard.FallScatter.Max` as its radius. If set to 0, random scatter will be disabled. `Trajectory.Bombard.FallScatter.Min` can be used to determine the minimum radius of the circle. If `Trajectory.Bombard.FallScatter.Linear` set to true, the random scatter will be limited to the line that is vertical to the original direction of the projectile. - `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 when `Trajectory.Bombard.FreeFallOnTarget` set to true. - `Trajectory.Bombard.DetonationDistance` controls the maximum distance in cells from intended target (checked at start of each game frame, before the projectile moves) at which the projectile will be forced to detonate. Set to 0 to disable forced detonation (note that this can cause the projectile to overshoot the target). - `Trajectory.Bombard.DetonationHeight` controls when the projectile is in a descending state and below the height of the launch position plus this value, it will detonate prematurely. Taking effect when it is set to non negative value. If `Trajectory.Bombard.EarlyDetonation` is set to true, it'll take effect during the ascending stage instead, which makes it detonate when its height is above the launch position plus this value. - `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. - `Trajectory.Bombard.TurningPointAnims`, 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. If more than one animation is listed, a random one is selected. - `Trajectory.Bombard.LeadTimeCalculate` controls whether the projectile need to calculate the lead time of the target when firing. Note that this will not affect the facing of the turret. - The following tags further customize the projectile's descending behaviors when `Trajectory.Bombard.FreeFallOnTarget` set to false. - `Trajectory.Bombard.OffsetCoord` controls the offsets of the target. Projectile will aim at this position to attack. It also supports `Inaccurate=yes` and `Trajectory.Bombard.LeadTimeCalculate=true` on this basis. - `Trajectory.Bombard.RotateCoord` controls whether to rotate the projectile's firing direction within the angle bisector of `Trajectory.Bombard.OffsetCoord` according to the weapon's `Burst`. Set to 0 to disable this function. - `Trajectory.Bombard.MirrorCoord` controls whether `Trajectory.Bombard.OffsetCoord` need to mirror the lateral value to adapt to the current burst index. At the same time, the rotation direction calculated by `Trajectory.Bombard.RotateCoord` will also be reversed, and the rotation angle between each adjacent projectile on each side will not change as a result. - `Trajectory.Bombard.UseDisperseBurst` controls whether the calculation of `Trajectory.Bombard.RotateCoord` is based on its superior's `Trajectory.Disperse.WeaponBurst` of the dispersed trajectory, rather than `Burst` of the weapon. If this value is not appropriate, it will result in unsatisfactory visual displays. - `Trajectory.Bombard.AxisOfRotation` controls the rotation axis when calculating `Trajectory.Bombard.RotateCoord`. The axis will rotates with the unit orientation or the vector that from target position to the source position. - `Trajectory.Bombard.SubjectToGround` controls whether the projectile should explode when it hits the ground. Note that this will not make AI search for suitable attack locations. In `rulesmd.ini`: ```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.FallScatter.Max=0.0 ; floating point value Trajectory.Bombard.FallScatter.Min=0.0 ; floating point value Trajectory.Bombard.FallScatter.Linear=false ; boolean Trajectory.Bombard.FreeFallOnTarget=true ; boolean Trajectory.Bombard.NoLaunch=false ; boolean Trajectory.Bombard.FallSpeed=0.0 ; double Trajectory.Bombard.DetonationDistance=0.4 ; floating point value Trajectory.Bombard.DetonationHeight=-1 ; integer Trajectory.Bombard.EarlyDetonation=false ; boolean Trajectory.Bombard.TargetSnapDistance=0.5 ; floating point value Trajectory.Bombard.TurningPointAnims= ; list of Animation Trajectory.Bombard.LeadTimeCalculate=false ; boolean Trajectory.Bombard.OffsetCoord=0,0,0 ; integer - Forward,Lateral,Height Trajectory.Bombard.RotateCoord=0 ; floating point value Trajectory.Bombard.MirrorCoord=true ; boolean Trajectory.Bombard.UseDisperseBurst=false ; boolean Trajectory.Bombard.AxisOfRotation=0,0,1 ; integer - Forward,Lateral,Height Trajectory.Bombard.SubjectToGround=false ; boolean ``` If all values are set to default, it'll perform as the old Bombard Trajectory. **NOTE:** Both the old and new Bombard trajectories might trigger a fatal error when firing a Voxel=true projectile (EIP: 007564B4), which is unresolved yet. Avoid using it for now, and if someone could make it work I'll be really grateful. --------- Co-authored-by: CrimRecya <335958461@qq.com>
2128644 to
799ea22
Compare
Contributor
Author
|
Has been completely rewrited. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a feature split from #1261 .
It may have similarities with other parts.
ROT, but its settings are more flexible. It also has a unique trajectory. And as its name suggests, it can even spread out more weapons.Trajectory.Disperse.UniqueCurvecontrols whether to enable simulated Qian Xuesen trajectory. After enabling this, it will NOT respect the following 21 items andTrajectory.Speed.Trajectory.Disperse.PreAimCoordcontrols the initial flight direction of the projectile, and after reaching this coordinate, it will begin to turn towards the target direction. When it is set to 0,0,0 , it will directly face the target.Trajectory.Disperse.RotateCoordcontrols whether to rotate the projectile's firing direction within the angle bisector ofTrajectory.Disperse.PreAimCoordaccording to the weapon'sBurst. Set to 0 to disable this function.Trajectory.Disperse.MirrorCoordcontrols whetherTrajectory.Disperse.PreAimCoordneed to mirror the lateral value to adapt to the current burst index. At the same time, the rotation direction calculated byTrajectory.Disperse.RotateCoordwill also be reversed, and the rotation angle between each adjacent projectile on each side will not change as a result.Trajectory.Disperse.FacingCoordcontrols whether the forward direction inTrajectory.Disperse.PreAimCoordis depending on the orientation of the firer. By default, it will depend on the vector between the firer and the target.Trajectory.Disperse.ReduceCoordcontrols whetherTrajectory.Disperse.PreAimCoorddefines the initial movement coordinates when the attack distance is 10 cells, and the actual initial movement coordinates will change with the length of the attack distance. It can be simply understood as an optimization term aimed at ensuring hits at close range.Trajectory.Disperse.UseDisperseBurstcontrols whether the calculation ofTrajectory.Disperse.RotateCoordis based on its superior'sTrajectory.Disperse.WeaponBurstof the dispersed trajectory, rather thanBurstof the weapon. If this value is not appropriate, it will result in unsatisfactory visual displays.Trajectory.Disperse.AxisOfRotationcontrols the rotation axis when calculatingTrajectory.Disperse.RotateCoord. The axis will rotates with the unit orientation or the vector that from target position to the source position.Trajectory.Disperse.LaunchSpeedcontrols the initial flight speed of the projectile.Trajectory.Disperse.Accelerationcontrols the acceleration of the projectile's flight speed, increasing or decreasing the speed per frame according to this value, the final speed will beTrajectory.Speed.Trajectory.Disperse.ROTcontrols the turning speed of the projectile which refers to the maximum angle that the projectile can rotate per frame in terms of direction.Trajectory.Disperse.LockDirectioncontrols whether after reachingTrajectory.Disperse.PreAimCoordand completing the first turn, the projectile will lock the direction of motion without further adjustment.Trajectory.Disperse.CruiseEnablecontrols whether after reachingTrajectory.Disperse.PreAimCoordand completing the first turn, the projectile will maintain altitude while moving towards the target.Trajectory.Disperse.CruiseUnableRangecontrols how far away it is from the target to end the cruise phase, no longer maintaining the cruise altitude, and begins to move directly towards the target. If the distance is already below this value by the timeTrajectory.Disperse.PreAimCoordis reached, the cruise phase will be skipped.Trajectory.Disperse.CruiseAltitudecontrols the minimum altitude of the projectile in the cruise phase.Trajectory.Disperse.CruiseAlongLevelcontrols whether to calculateTrajectory.Disperse.CruiseAltitudeby the height of the projectile and the ground height of the current position, otherwise it will be calculated by the height of the projectile and the height of the launch position.Trajectory.Disperse.LeadTimeCalculatecontrols whether the projectile need to calculate the lead time of the target during motion.Trajectory.Disperse.RecordSourceCoordcontrols whether the projectile needs to record the launch position, which will be used for the weapons inTrajectory.Disperse.Weapons. It can be nested and inherited when both sides set this to true.Trajectory.Disperse.RetargetAlliescontrols whether the projectile chooses allies as its target when searching for new targets after losing its original target.Trajectory.Disperse.RetargetRadiuscontrols the radius of the projectile to search for a new target after losing its original target. If it hasn't arrivedTrajectory.Disperse.PreAimCoordyet, the last coordinate of the original target is taken as the center of the searching circle. Otherwise, the coordinate of the distance in front of the projectile is taken as the center of the circle. Set to 0 indicates that this function is not enabled, and it will still attempt to attack the original target's location. If it is set to a negative value, it will directly self explode in place.Trajectory.Disperse.TargetSnapDistancecontrols 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.Trajectory.Disperse.SuicideAboveRangecontrols the projectile to self destruct directly after reaching the flight distance. Set to 0 to disable suicide. When set to a negative number, its absolute value represents a multiple of the initial distance.Trajectory.Disperse.SuicideShortOfROTcontrols whether the projectile will explode when it detected its insufficient turning ability.Trajectory.Disperse.SuicideIfNoWeaponcontrols whether the projectile will self destruct after the number of times it spreads the weapon has been exhausted. IfTrajectory.Disperse.WeaponCountset to 0, this will not be enabled.Trajectory.Disperse.Weaponsdefines the dispersal weapons of the projectile.Trajectory.Disperse.WeaponBurstdefines how many corresponding weapons each time the projectile will fire. When the quantity is lower thanTrajectory.Disperse.Weapons, it will use the last value.Trajectory.Disperse.WeaponCountcontrols how many times the projectile can spread the weapon. Set to a negative value means unlimited times.Trajectory.Disperse.WeaponDelaycontrols the delay for dispersing the weapons defined byTrajectory.Disperse.Weapons.Trajectory.Disperse.WeaponInitialDelaycontrols the initial delay for dispersing the weapons defined byTrajectory.Disperse.Weapons.Trajectory.Disperse.WeaponEffectiveRangecontrols the weapon dispersing timer to start counting only within this distance of reaching the target. Set to 0 to disable this function. Set to a negative value means it will only disperse the weapon at most once before detonation.Trajectory.Disperse.WeaponSeparatecontrols whether the projectile no longer fire all the weapons inTrajectory.Disperse.Weaponsat once and instead fire a group of weapons in the list order, followingTrajectory.Disperse.WeaponBurst.Trajectory.Disperse.WeaponRetargetcontrols whether the dispersed weapons will find new targets on their own. Using theRange,CanTarget, requiredAttachedEffectsof weapons to search new targets.Trajectory.Disperse.WeaponLocationcontrols whether the dispersed weapons will search for new targets at the center of the spreading position, otherwise they will focus on the original target.Trajectory.Disperse.WeaponTendencycontrols whether the dispersed weapons will choose the original target as the first new target in each group of weapons.Trajectory.Disperse.WeaponHolisticcontrols whether the dispersed weapons will choose targets that are in different states from the original target (in air and on ground).Trajectory.Disperse.WeaponMarginalcontrols whether the dispersed weapons will choose unimportant items such as trees and streetlights as secondary targets.Trajectory.Disperse.WeaponToAlliescontrols whether the dispersed weapons will choose allies as targets when searching for new targets.Trajectory.Disperse.WeaponDoRepeatcontrols whether the dispersed weapons will select duplicate targets when the number of targets is insufficient. If it is set to true and the weapon can select both the technos and the ground as targets, the technos will be prioritized, then if all non-repeating technos have been selected and the weapon can still be launched at this time (in each round of salvo), it will start selecting duplicate technos. If it is set to false and the weapon can select both the technos and the ground as targets, the technos will be prioritized, followed by the ground cells, then if all non-repeating technos have been selected and the weapon can still be launched at this time (in each round of salvo), it will stop firing remaining bursts.In
rulesmd.ini: