Character runs awkwardly only from AI Task

Having issues where my AI runs fine from its AI Blueprint but runs very weirdly when being ran from an AI Task. I am probably missing something critical here.

This is what it looks like: https://youtu.be/h2yQr3hULw4

Hey @ZeusXpress2!

Have you tried promoting that input float variable and seeing if that creates a more standard movement for you?

It’s possible that because both of these are tied to tick, one might be firing more often than the other.

Hope one of these things leads you to your answer!

Hi there, thank you for the reply, I am unsure what you may mean by promoting the float variable. Are you referring to promoting the delta seconds variable under the event tick in the AI BP?

I meant the scale value float here- that seemed to speed it up but only temporarily, it may be that the value is not held after it’s run which would be solved with right click-> promote to variable then change the value there.

Also you could try increasing the X value of the vector input? And instead of using tick try using a Timer with an event that moves the pawn so it’s frame independent! That could solve a lot of issues by itself. :slight_smile:

Hello, sorry I have been away for a bit. Tried everything, it still does not work even with promoting to a variable. I honestly think my engine instance is haunted based off the new result I am getting. The timer with event wasn’t working at all so I did a delay loop. Its only tied to a delay but moving weird when I move my mouse lol. I must be something or this is an engine bug.

Just so you know I am not messing with you lol, here is the project: Cardfront_Assault.zip - Google Drive

Did you do this part? It’s seeming like updates aren’t happening super actively and the mouse is forcing updates- theoretically a timer to run this would fix that!

Yes, this does work however it seems there is a cap to the movement and cannot move faster unless I switch the loop time to 0.001 but then it flies off screen.

Well, it’s just a matter of fine tuning at this point.

Because changing the loop speed of the timer from 0.02 to 0.001:
(.02/.001 = 20) so it is 20 times slower at .02 than at .001.

Your character speed is going to be World direction X times Scale divided by time, or this formula:
s = x * n / t

It is reacting correctly. Lower world direction x or scale and it will go slower accordingly, raise time between events and it will go slower, and vice versa. :slight_smile:

I found that the scale was increasing the speed as it was running so I switched scale to 1 and the X value to 1000 but I am also finding the mouse is still forcing updates?

Hold on, let’s check the FPS vs the mouse movement… Press the Ctrl+Shift+H shortcut, or select Show FPS from the hamburger menu found in the top left of your viewport so we can confirm whether the FPS is linked to it or not.

FPS flickers between 119 and 120 FPS in session. Doesn’t drop when I move my mouse, still not sure why it reacts that way.

And it still behaves this way when you’re locked in to the project?

This is bizarre but it has to have an explanation.
Do you have ANY OTHER AREA where mouse input might influence something? Can you show any and all relevant code? Because the mouse thing is definitely not being caused here. As much info as we can get, let’s get!

You are executing a task, finishing it, then checking the behavior tree next frame and running the same task. This is not the same as ticking even though it seems like it would be. It is best to avoid spamming tasks back to back in that way because if the ticks are not guaranteed to happen some things won’t work properly, like the add movement input node. Also with more developed AI you probably don’t want to run through the behavior tree every frame if not needed. If you use event receive tick without finishing the task then it should run every frame and look smooth. If you use a branch and a delay until next tick node to keep executing the task until a condition is met, it would tick smooth.

Edit: That’s the reason for the behavior tree setup not working. I’m not sure about the mouse issue but if you hover over any button in the editor while the game is running it does cause an fps drop. Idk if thats something to worry about yet.

Hold on here, is @jay001020 right in seeing that you’re using a Behavior tree? I thought that part was cut out and we were working with only a pawn, a lot of the problems could be that you’re trying to do the same thing in two separate places- like if you’re running a task that’s doing this on TOP of the normal pawn movement… But I don’t see any code posted of a Behavior Tree. If you’re still using it, for something this simple I would just use the pawn, and not run the tree.

I was using a behavior tree at the beginning because its an AI however upon experiencing issues I switched to just the pawn for simplicity and error testing which with only using the pawn, it was still moving weird. The image presented is the only code the AI is running, I deleted the Behavior Tree Task and the Behavior Tree because even though I am not using it, it may still be checking the tree every frame since its still applied to the character. However even though deleting it, still getting the issue where the AI moves faster when I move my mouse. Could it possibly be the “Add movement Input” node? Is there an alternative to try? I only say this because I made a integer variable and had it increment to see how fast the event was running and when moving my mouse, the variable does not increase significantly like the way my AI speed does.

Forgot to attach the image I refrenced

WOAH just made a break through, watch this. Any idea how this is happening??

I… Have no words. What in the world is going on here?

I hate to ask but I feel like I have to… What is the “Run” function over on the side there?

Also an idea- You can grab the FloatingPawnMovement component and set the max speed, then just adjust the max speed to whatever speed you want (using Get FloatingPawnMovement → Set MaxSpeed) it to be with a large acceleration for instant changes.

The only other code I have running is in the level blueprint, it spawns the AI and calls a custom function “Begin Play” which just shows the mouse curser and creates the UI. This is the only code I have regarding the mouse. The Run function is unpined and not being called. I also updated the version in the drive. There has to be some kind of setting that is not checked or the correct value or something. https://drive.google.com/drive/folders/1w9dzWAnHOcG3r9kPp3myU5BXhbPU8IYZ?usp=drive_link