Skip to content

Port Vector effect system from KratosAI to PhobosAI#2265

Open
KenosisM wants to merge 11 commits into
Phobos-developers:developfrom
KenosisM:feature/vector-port
Open

Port Vector effect system from KratosAI to PhobosAI#2265
KenosisM wants to merge 11 commits into
Phobos-developers:developfrom
KenosisM:feature/vector-port

Conversation

@KenosisM

@KenosisM KenosisM commented Jun 22, 2026

Copy link
Copy Markdown

Ported from Kratos code base, the phobos ver of the all mighty vector attach effect. All by vibe coding (including this PR) so human review is very much needed.
preview gifs (kratos based):
https://www.bilibili.com/opus/1214163469064994817
https://www.bilibili.com/opus/1214494881641136144
https://www.bilibili.com/opus/1215222921544335378
The incredibly magical Vector class mechanism, capable of directly displacing projectiles and units.
Ported from Kratos by Deepusheek.

Function Description
Vector is a pure movement effector that forcibly modifies the coordinates of the attached object during the Duration.
Although it also works on Techno, its greatest use lies in:

Programmable, scriptable projectile trajectories.
You can use Vector to create incredibly stunning projectile flight paths.
After the Vector effect ends, the projectile will proceed to attack its original target. Therefore, it is recommended to use only ROT=100.
Each Vector can use a Next statement, allowing other Vectors to be activated after its own effect ends, enabling you to freely combine effects as you wish.

Vector abstracts "displacement" into five independent modes, with only one mode active per AE at a time.
Priority-based matching: Freeze > Circle > MoveTo > ReachTarget > Speed

Freeze: Frozen in mid-air, motionless.
Circle: Draws a circle. The center of the circle itself can also continue moving.
MoveTo: Directly provides a set of coordinates, moving frame by frame. For example, MoveTo=0,0,-10 is equivalent to the vanilla Vertical. If the effect ends halfway, the projectile will drop first, then charge toward the target.
ReachTarget: Takes the current coordinate difference and Duration, ensuring the projectile reaches the target exactly when Duration ends, ignoring speed settings. An arc height can be set. Adding an arc height makes it equivalent to the vanilla Arcing-type projectile.
Speed: Uses a custom speed setting or reads the original speed for straight-line flight.

The following image demonstrates the effects of the ReachTarget mode combined with random arc height, random arc rotation, and random arc vertices.
B

All tags are written under [AttachEffectSection], prefixed with "Vector."
As an AE, it needs to be registered under AttachEffectTypes.
Due to Phobos's AE underlying architecture, projectiles do not accept AEs. You can only write the Vector on the firer, indicating that projectiles fired by this firer will be subject to displacement.
For example:
[FV]
AttachEffect.AttachTypes=SomeVector

Comment thread src/Ext/Bullet/Body.cpp Outdated
@phoboscn-bot

Copy link
Copy Markdown

To Chinese users:
This pull request has been mentioned on Phobos CN. There might be relevant details there:

致中文用户:
此拉取请求已在 Phobos CN 上被提及。那里可能有相关详细信息:

https://www.phoboscn.top/t/topic/595/1

@NetsuNegi NetsuNegi added the ⚙️T2 T2 maintainer review is sufficient label Jun 22, 2026
Comment on lines +544 to +552
else
{
pObject->SetLocation({ currentPos.X + moveDisp.X, currentPos.Y + moveDisp.Y, currentPos.Z + moveDisp.Z });
if (pType->Vector_Freeze)
{
if (auto const pFoot = abstract_cast<FootClass*>(pObject))
pFoot->StopMoving();
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pretty sure these are not enough. Simply SetLocation may be good for BulletClass, but not for FootClass.
I suggest creating a Locomotor to handle this. From my understanding, many parts of the game access the Locomotor of FootClass. Moving characters without going through the Locomotor may cause inconsistencies at these access points.
See #2179. Due to the complexity of this section, I cannot guarantee that it is completely correct.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ofc. BTW I don't think vector on techno is good - maybe just keep the bullet part, or only support jumpjet&aircraft

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, @TaranDahl is completely correct. if you want to manipulate FootClass movement - you must do it through locomotors. Otherwise you're opening a can of worms and fighting the game design.

I did Techno Attachment this way first, it went completely bonkers on many locomotors and had inexplicable bugs, freezes and crashes. When I remade it to be a locomotor - everything got fine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Actually I dunno what the heck Deepusheek has written. It needs ofc serious redo - or at least give it stable examples of how things should work.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

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.

@KenosisM

Copy link
Copy Markdown
Author

Phobos_Vector_Manual.html
Phobos_Vector_Manual_CN.html
Added manual files

@mevitar

mevitar commented Jun 27, 2026

Copy link
Copy Markdown

I think it's better if this is separated from AttachEffect and instead made its own section, with a vector list also separated from AttachEffectTypes (and call it something like AttachVector and AttachVectorTypes).

@KenosisM

Copy link
Copy Markdown
Author

I think it's better if this is separated from AttachEffect and instead made its own section, with a vector list also separated from AttachEffectTypes (and call it something like AttachVector and AttachVectorTypes).

Perhaps. In kratos prototype it merges perfectly into AE infrastructure so the ported version is also started as AE. Maybe a new list, or better no listing at all. The more important part is let projectiles directly accept vector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs testing ⚙️T2 T2 maintainer review is sufficient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants