I've been puzzling over how to implement a fast pathfinding algorithm in assembly. Rather than finding a specific path, I want it to find all possible ending locations, given a certain move distance. For example, if the move distance is 9, we can move at most 9 spaces. I also want to include different terrain costs. For example, moving in a forest takes two moves.
I was thinking perhaps doing this:
.......... ....1..... ...121.... ..12321... .1234321.. 123454321. .1234321.. ..12321... ...121.... ....1.....
Where the move distance is 4. It starts at the five, and looks at each adjacent tile, and marks it with move distance - terrain cost. In this case terrain cost = 1, so 5-1=4. This is done for all the tiles.
With different terrain costs, it may be as shown below:
If the ? has a terrain cost of 1, then the 3->? would be 2, and the 2->? would be 1. So the ? would be replaced with a 2, since 2 is more optimal.
To retrace a path after locating the spaces, we take the last space, and add the move cost of that space. Locate an adjacent tile with the number on the space plus the movement cost of the space, and add that space to a list.
Hmm. Now that I have the general idea figured out, I'm not sure how to implement it into code.
EDIT: I was also wondering where the random numbers are stored? I wish to be able to access them with a seeded value.
Fire Emblem for TI 83/4+ Progress: Demo: 75% Total: 40% Postponed indefinitely