Code:
mob
proc/AI()
ai
New()
..()
spawn(10) AI()
AI()
step_rand(src)
// There is a one second delay between AI cycles. It's important to have
// some delay, even if it's short.
spawn(10) AI()
enemy
icon = 'enemy.dmi'
Problem description: So i'm using forum_account's AI library/demo as a guide for my NPC AI. I'm only using the very basic AI at the moment as I don't have the need to adapt further yet. But for some reason when my NPC's move their movement is jerky and the icon's do have movement states. Any idea what the cause of this would be?
Code: mob |
Yes I'm using pixel movement. I'm not sure what you meant by the delay in the movement proc, but i'm assuming something like this.
AI() This makes it less jerky but the NPC takes tiny steps and I'm not quite sure how to get the right balance. players pixel_movement is set to 8. |
Have you redefined mob/Move() at all?
If not, I'm quite sure that changing the spawn()'s in your AI proc to 2 will make it significantly smoother. A full second of delay is kind of superfluous. |
Setting it to 2 made it smoother but moved around really fast. Setting spawn to 1 and playing around finally got a smooth and steady pace (thank god)
AI() Also i did redefine Move(). But nothing that I don't think would stop it from doing what it's supposed to do. Especially since i redefined Move() after I'd implemented the AI. |
Yeah, the pixel movement doesn't blend well with the delays. Glad you got it fixed. ^^
|
I find it's best to use the delay argument within whatever type of movement proc you're calling. For the smoothest transition, you'll want either 0 delay with a tiny step size(half the step size of players), or a tiny delay (1 or 2) with a large step size.