Ships only take a direct route if the planet in question is orbiting or being orbited by their destination planet. However even when two planets are relatively close to one another they take an unnecessarily roundabout route, when a similarly orbiting planet or object is further away. this would add a level of strategy involving planets being close to one another by planning a quick attack based on when those planets will be close enough for a direct assault.