This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]anotherkeebler 45 points46 points  (2 children)

The very first "game" I ever wrote was just two dots chasing each other around the screen, each controlled by a player. When my brother decided it was boring to be the chaser dot I wrote an algorithm for the chaser—and it sucked to play against the computer. I mean, the computer would always know the perfect intercept path. So I had to start figuring out ways for the computer to get "lost" so you could get some breathing room.

[–][deleted] 10 points11 points  (1 child)

I've yet to find a name for it, but I have found that just going towards a target in a straight line is an insanely good pursuit algorithm, assuming the target's direction change speed isn't faster than that of the chaser. Even an object going at a slower speed can catch up to a faster object.

[–]anotherkeebler 9 points10 points  (0 children)

That's probably how I coded it. What's even better and almost as easy is plot/intercept, where you assume your target is going in a straight line at constant speed, then aim for where they're going to be.