PeterScott
Platinum Member
- Jul 7, 2017
- 2,605
- 1,540
- 136
Except that those units are not moving in isolation, they are moving in conjunction with the other units - so they don't pass through each other, squads move together, units do smart stuff. So it's not actually a simple task at all as all the units pathfinding is effected by what the other units pathfinding is doing at exactly the same time. So you can't just parallelize it all. You can parallelize some aspects but ultimately you are not doing 10,000 independent moves, you are doing 1 very big complex move.
I never said pathfinding was a simple task. It's a very complex one, and there are many research papers on it. But typically the game logic does treat this as a series of individual tasks, that can be run fully parallel.
Pathfinding also often appears to be notoriously bad in games because it is a very complex problem when many independent units try cross choke points, which can often choke computer pathfinding to a near halt.
Units are moving in very small segments. Each unit during it's time slice will scan for obstacles in it's path, including other units, which in the simplest case are treated as stationary obstacles, at the next level they can do some simple predictions about where other units are going, and in more advanced algorithms, it can in fact query and exchange route information with other nearby units, to have some kind of cooperative algorithm. But these are still basically a multitude of units behaving individually deciding their path, and can be run as a fully parallel task.