Well, at first this sounds reasonable and pretty simple. Yet, I doubt this simple approach works as good as you think it would. Simply because you have a dynamic environment with multiple moving agents and you don’t do pathfinding just once but every time tick of the game.
Because of this additional sentence: Do I get you right?
Variant 1: You want that the units actually walk directly to the target and only corrects the direction when it hits an obstacle? Thus, in a walled base for example, units walk in the worst case always towards some wall/building and then search for the gate / opening?
Variant 2: First I assumed that you propose that the path finding starts with a straight line, then avoids obstacles and then tries to optimize the trajectory with respect to shortest path. For example, if the obstacle avoidance algorithm produced a path that is shaped like the letter u (which represents only a part of the total path. Assume that the final destination is located somewhere below the letter u). Then the shortest path would be directly from the start point of the letter to the end point of the letter instead of following the letter u (assuming that there are no other obstacles between start and end point).
For areas not within the range of any of your units I’d also always prefere the straight line approach. Alone in order to not gain knowledge about (changed) terrain. Although one can argue here, whether one should not also allow exceptions e.g. for land units when there is an already discovered lake in the middle of the map: If I want to send them to the opposite location of the map. Should they really walk directly to the lake and then start to walk around it or should the algo be smart enough to know that lakes dont change and therefore already find better paths?
Challenge with above mentioned Variant 1:
Another challenge is that the units probably need some memory abouth their own path. Assume a unit hits an obstacle and decides to move in the opposite direction. What happens in the next time tick of the game? The unit walked in the opposite direction, thus, the straight line approach towards it’s actual destination is to turn around and directly walk to the very same obstacle again?
Challenge with above mentioned Variant 2:
Assume a unit within a walled base. The base can only be left by a gate at the north and a gate at the south. The unit gets the command to walk towards some destination north of the base, thus one would probably prefere that the unit leaves the base through north gate. What happens if the gate is currently blocked by other units? Should the unit leave the base through the south gate? What happens in the next time tick of the game? If the north gate is free now, should the unit turn back? What happens if the gate is blocked again some time later?
I guess, in this example I’d always prefere that the unit walks towards the north gate, nevertheless if it is blocked at some point or not. Thus, moving units are obstacles but still have to be treated somehow different than non-movable obstacles.
How to resolve a scenario where two movable units collide? How do you prevent them from wandering back and forth, always getting in each other’s way again and again? Once you have found a suitable algorithm, does it still work satisfactorily when dealing with a large group of agents rather than just two? Once you have found a suitable algorithm that works also for large groups, is it suitable for melee battles? (btw: I don’t know if the latter one is even important. It came to my mind because in this case for each player his units should ideally not block each other but “search” at the same time for collisions with enemy units in order to attack them)
These are just a few problems that come to my mind without thinking about them for long. And this altough I don’t even have theoretical or practical experience with pathfinding in a dynamic environment. When it comes to the actual implementation, I’m sure there will be many more challenges.