Download

AI Move to moves at different speeds with different fps!

Hey so in my BT Task Node c++ class in the execute task function I’m calling AIController->MoveTo(Player) and it works perfectly fine but when I go to project settings–>Framerate and use a fixed frame of eg. 40fps, then my character moves at a different speed?

I want my character to move at the same speed no matter the framerate, please can someone tell me how I can achieve this, I’m really struggling!

Any help is much appreciated, thank you! :frowning:

If there’s an actual difference in velocities it’s hard to say what’s going wrong.

But is it just moving slower with the setting enabled? The fixed framerate setting fixes the delta-time between frames in the game. If the delta-time is shorter than the real world time that’s passed between frames (if fixed FPS is higher than the FPS your computer is capable of rendering), the game will run in slow motion. If that’s what’s happening, you should find the AI is still moving at roughly the same speed in game time.

1 Like

Well what I did was I wrote a little program that gives you the time it takes for the ai controlled character to reach a wall edge when it immediately starts moving when the game starts:

~120fps - TimeToGetToEdge = 0.85 seconds
30fps - TimeToGetToEdge = 2.6 seconds

My computer normally runs at 120fps as it is on the higher end so I don’t see that being the issue.
I’m so confused right now :frowning:

I’ll check the velocities difference now

Okay so the velocity for smooth frame rate tick (around 120fps) it’s constantly 600 for x
Then for 30fps theres weird results:
Note: MaxWalkSpeed = 600

Weird 30fps (set from project settings by ticking using fixed frame rate 30fps) velocity x:
OnPaste.20210621-223454

normal around 120fps velocity x:
OnPaste.20210621-223639

Is the MoveTo being triggered multiple times? I’ve seen stuttery behavior before when that’s happening

1 Like

Yes! When I used object finder it came up with two of the same bt task nodes found in the world! This must be whats causing it, do you have any idea of how i can remove one? Because idk