Comment 10 for bug 730070

Revision history for this message
Nicolai Hähnle (nha) wrote :

Some thoughts on soldier pathfinding.

1. This type of deadlock is best solved by taking a more global perspective on soldier pathfinding. Right now (bzr6539), soldiers individually find their own paths, and some heuristics are thrown in to allow soldiers to find their way around waiting allies. However, this type of deadlock can only be resolved if some soldiers voluntarily go _away_ from their preferred position. It seems easier to reason about this from a global perspective.

2. Given that every soldier has a position where they want to be, the goal of global soldier pathfinding should be to minimize the sum of distances of soldiers from their preferred positions. Furthermore, this sum of distances should be minimized quickly (in terms of gametime).

3. Minimizing this sum of distances as fast as possible is difficult to do, but we can settle for reasonable heuristics.

4. Unfortunately, it is possible to get stuck in local minima. By this, I mean a situation in which the minimum sum of distances to preferred positions has not been reached, but any further decrease requires the soldiers to make several steps, some of which may _increase_ the sum of distances in the meantime.

5. To solve this bug once and for all, we would have to identify a set of non-local moves that guarantee that we ultimately convergence on a global minimum. To avoid further bugs in the code, these non-local moves should have some sort of clean, non-hackish description.

So there are tough questions that still need answering, for a bug that is annoying but should rarely be a problem in practice.