Im using an A-star algorithm for pathfinding for my units in my rts game. I didnt make the a-star code myself but rather a wrapper around some code i found. I want to add a cost for turning (changing direction between to nodes) so the pather will prefer to make straighter paths instead of zigzagging.
Units can move in 8 directions between the tiles. When moving NNW (direction 1/16th or 1.30 a'clock) it prefers to go up, up-right, up, up-right (turning 1/8th each tile) instead of going all up it needs, turn once, and then go the rest up-right.
Best way to solve this?