Pathfinding Routines
Toby
Member Posts: 478
Need some pathfinding behaviors. Currently my enemies get stuck behind scenery when chasing me. Can they search for the shortest path around the obstacle or keep going moving left or right until the object is passed?
Comments
Then a rule saying if enemy actor's motion is less than 50, move to vertical random(500,-500) and horizontal (500,-500). Eventually the enemy finds it's way past the wall object and continues toward the player target x,y.
hey toby, i read over your example a couple of times to get it into my head. i don't know if this is better or not but here it goes...
you could have four zones/buffers that surround the enemy actor. the enemy has a move/accelerate towards player rule that is interrupted only when one of the zones collides with anything other than the player. when it does, the player moves for a set time in one of the other three directions, then it continues it's move/accelerate towards the player.
i think this would make it bump around until it found open space to continue pursuing the player. you could even give it rules like remebering which buffers were recently hit and not going in that direction immediately again.
well, at least in my head it seems like that. i might have to try a mock up to see if it actually worked decently.
there ya go...my pinch of parsley...noodles