nocash wrote:
Magic Floor [...] is flagging map cells as "needed to be processed later", the drawback is that the later processing requires to search through all map cells to find out which ones were flagged that way.
My Game Boy port of
Magic Floor likewise marks cells as ready for evaluation and makes multiple passes until evaluation settles, as does indoor/outdoor testing in
RHDE. In both, it's subjectively "fast enough".
Ultimately, what makes "ready for evaluation"-based flood fill algorithms slow is that they behave like
bubble sort: they propagate reachability slowly in the direction opposite that of scanning the array. For example, scanning from top to bottom makes propagation up take longer. Filling to the left or right is iterative (and thus fast). When it marks cells in the previous and next rows as ready for evaluation, the cells in the next row are quickly taken care of during the same scan. These cells in the next row are analogous to "rabbits" in bubble sort. But cells in the previous row have to wait for the next scan, like "turtles" in bubble sort.
Two extensions to bubble sort address the problem of turtles. The first is to make evaluation passes in opposite directions each time, producing
cocktail sort. Applying bidirectional scanning to flood fill is also straightforward. Another is to compare cells several spaces apart, as in
comb sort. This doesn't extend so easily to flood fill in the typical 4-direction or 8-direction connectedness definitions.
Cocktail sort wouldn't help
Magic Floor though. In my tests, bidirectional scanning doesn't appreciably reduce the number of passes when determining reachability in this case. I implemented bidirectional reachability search in the Python prototype of floor generation. It didn't have noticeable effect on number of passes needed to solve reachability on smaller floors (2x8, 4x4, 6x4), where most floors are solved in 4 or 5 passes. For larger floors (6x6 or 8x6), the solution reduced from 5-7 passes to 4-6. I assume the improvement is so modest because the game defines connectedness to allow 2-cell moves, which reduces turtles anyway by allowing "ready for evaluation" state to propagate up two rows in one pass.
Puyo Puyo determines matches by a connected region of at least four cells of the same color. After a line clear and explosion,
Bombliss breaks the remaining mass of blocks into connected regions and applies gravity to those regions that have not yet landed. Both are on Famicom and Game Boy.
Rampart (Konami) for Famicom and
Rampart (Jaleco) for NES use 8-way connectivity for indoor/outdoor testing. Has anyone debugged into those to see whether they use recursion?