Why can't Helen Keller drive? (pathfinding)

Because she's a woman.

Now, why can't ships drive? Exhibit the following example. Ship A wants to get to point B without crashing into planet C.

A.......
.C......
........
........
......B.

Fortunately, the vastness of space allows an optimal path without even scratching the ship's bumper:
A*...... or A**.....
.C*..... .C.*....
...*.... ....*...
....*... .....*..
.....*B. ......B. (each 5 asterisks, 6 moves, however you want to call it. Many times, including this one, there will be many "optimal: paths, but there's no need to exhibit all of them here.)

But... how does my ship fly? As long as the diagonal is longer than the straight portion of the movement, it moves like this:

A*......
.C*.....
..*.....
...*....
....**B. 6 asterisks, 7 moves. It moves around the star, on the diagonal.

The A* algorithm should avoid this. In a space where the blocking objects usually take up very little more than a square here and there (ship walls excluded), A* should find the optimal path very quickly, but in this case it never finds it, even though the correct solution isn't computationally expensive in such a sparse map.

This minor mod, plus the ability to have trade routes travel more predictably Bresenhamian (linear approximation, same algorithm for selecting which pixels on your screen make a line) line paths, would rule - it would make placing your starbases easier for trade upping, and it would also make the movement engine more realistic-ish.

-H Dill


~SDC~
437 views 6 replies
Reply #1 Top
Curse you, variable-width fonts. Don't know how HTML works in these posts, but I'll try posting the diagrams again:

A.......
.C......
........
........
......B.

Fortunately, the vastness of space allows an optimal path without even scratching the ship's bumper:

A*...... A**.....
.C*..... .C.*....
...*.... ....*...
....*... .....*..
.....*B. ......B.

(each 5 asterisks, 6 moves, however you want to call it. Many times, including this one, there will be many "optimal: paths, but there's no need to exhibit all of them here.)

But... how does my ship fly? As long as the diagonal is longer than the straight portion of the movement, it moves like this:


A*......
.C*.....
..*.....
...*....
....**B.



~SDC~
Reply #2 Top
Well, no dice on the fixed-width. Cut and paste those babies into notepad (or emacs, you freaks). I'm sure many people have seen the behavior I'm talking about here - it costs a point of movement and that's certainly frustrating sometimes.

Fortunately, on this board, things like this come up and the developers actually care!

~SDC~
Reply #3 Top
I just need a junk of time to tweak/test the pathfinding/movement code.
Reply #5 Top
:) I might take you up on that. You seem to have studied A*.
Reply #6 Top
I've implemented it in a TBS of my own. In Java, but that doesn't matter.

Do you have my email addy in your database? I forget what info it asked me for when I signed up.

~SDC~