Map Editor update, small pathfinding fixes
lotus xna rpg pathfinding astar enemies map editor
One of the main issues I was having with characters moving around was that when there was an obstacle exactly in the middle of the way, the character would try to move around it, constantly turning to the other side, creating a shaky effect.
To fix that I added a delay between turns. When a character turns to a direction, there is a small delay before he can turn in another direction. This avoids the shaky effect, and also helps the character to get around obstacles, as he will keep trying to go on that direction for a little longer.
Another little feature added to the pathfinding was to have the MovementEngine recalculate the path when the character can't reach a given waypoint for more than a given amount of time. In this case, one second. Also, when adding an object to the map editor, it will now instantly mark that tile as impassable on the collision map, avoiding having to move around the object on the fly, the pathfinding will already avoid that impassable tile.
I'm sorry that the video doesn't have a good quality, I'm facing some lag issues when trying to capture the screen, the fps drops from 60~ to 15-25 and the capture itself freezes sometime. But here is the last video, hope you enjoy it.
Check out my blog on http://en.lotusrpg.com.br