Oh, yeah... multi-tile creatures can't path to the same places that normal ones can...
Alright, time to formally define/expand upon some of the idea. Multi-tile creatures will be defined as a directed tree of creatures, every creature (expect one -- the root creature) having a parent. The creatures, at all times, must satisfy two constraints:
- No two creatures can occupy the same position.
- Every creature, except the root, must always be adjacent (possibly diagonally) to its parent.
Then, define the width of a creature tree as:
- If the tree has one node, the width is 1.
- If the tree has more than one node, the width is the sum of widths of the sub-trees.
Let us suppose that all multi-tile creatures can fit through spaces that are at least as wide as the tree. (This is... not actually true, but let us assume it for the purpose of simplicity.)
Define w as the width of a particular creature tree. Then, it will probably be necessary to re-implement the A* search algorithm, which is the same as the original except it only allows tiles where the entirety of a w * w square centered on the tile is walkable. Then the rest of the multi-creature can be situated within the w-wide path that the root creature "sweeps out" as it moves.
Although the A* algorithm can work without storing information between runs, it might prove to be a performance benefit to maintain at least some sort of walkability cache for each type of multi-tile creature present on the map at any time. It will probably increase RAM usage by a lot, so maybe it could be enabled only when they are at most a certain number of types of multi-tile creatures present on the map. Though, as they say, premature optimization is the root of all evil, so this will only come much further into development.
EDIT: Come to think of it, the multi-tile cache could just consist of booleans instead of the full 16-bit integers of the original walkability cache, so RAM usage might not be all that bad.