I guess I’m starting to understand how RTS can afford to have so many unit moving and still having time to calculate all the path for those unit. The key seems to be in the AstarFlood algorithm, where you basically calculate the distance of each node relative to a certain one, but only when you need to use that node.
For example, if you take a Command Center in Starcraft II that has a shit load of SCV gathering mineral around it. It could possibly take a lot of time to calculate the path for all these SCV. (especially if the command center is not very close to the mineral). But, if you precalculate the distance map for the command center then all the path your SCV ask you are basically precalculate and take 0 time to return.
That was the first key. Now the second.
Starcraft map always seems to have a lot of level (cliff). Those level separate the map in a couple of different zone. Each of these zone can access other zone by ramps. Those ramps are the access point between each zone. Do you get where I want to go?
If you can split the map into smaller zone and get the access point between the different zone you can precalculate easily the movement of unit between the different zone. For example, if a unit is in Zone A and want to go to Zone C. Zone A connect to Zone B and Zone B connect to Zone C. You could precalculate the path for every place in Zone A in order to get to Zone B in the most efficient manner, and you could precalculate for every place in Zone B to get to Zone C in the most efficient manner. You could think than that look like a lot of calculation but it’s not the case. You just have to precalculate the distance map for the ramp between Zone A and Zone B and for the ramp between Zone B and Zone C. Then you have precalculate optimize path for every location in zone A to get to B and in every location in zone B to get to C.
The other benefits is that if you put a building in a certain zone, you only need to recalculate the distance maps for this zone as the other one are not affected :).
By the way, calculating a distance map take roughly the same time as calculating a long normal A* path. So it’s very cheap and done once.
N.B. : Moving object collision, moving unit of different size and realistic movement are still out of my league :(.