AI programming terminology
November 18, 2004 9:20 PM Subscribe
I'm trying to read O'reilly's "AI for Game Developers," and it's a bit over my head. On page 17, there's an algorithm that moves a preditor towards a pray. There's a constant (or variable?) in the code called _TOL which isn't explained anywhere in the text. What is _TOL? Also, there's a variable (called v) that's defined buy never used. What gives?
Here's the code:
void DoLineOfSightChase (void)
{
Vector u, v;
bool left = false;
bool right = false;
u = VRotate(-Preditor.fOrientation, Prey.vPosition - Preditor.vPosition));
u.Normalize();
if (u.x < _tol) left=true;
else if (u.x > _TOL) right = true;
Preditor.setThruster(left,right);
}>
Here's the code:
void DoLineOfSightChase (void)
{
Vector u, v;
bool left = false;
bool right = false;
u = VRotate(-Preditor.fOrientation, Prey.vPosition - Preditor.vPosition));
u.Normalize();
if (u.x < _tol) left=true;
else if (u.x > _TOL) right = true;
Preditor.setThruster(left,right);
}>
Oops, forgot: as for v, probably just something the author originally used or was going to use and forgot to take out when it was no longer necessary.
posted by The Pusher Robot at 9:30 PM on November 18, 2004
posted by The Pusher Robot at 9:30 PM on November 18, 2004
_TOL would most certainly be a constant, so I'll bet Pusher Robat is right.
posted by SpecialK at 9:55 PM on November 18, 2004
posted by SpecialK at 9:55 PM on November 18, 2004
O'Reilly publishes the errata for all their books online, and allows you to report your own.
They don't mention this algorithm, but they might appreciate hearing about it.
posted by nev at 1:35 PM on November 19, 2004
They don't mention this algorithm, but they might appreciate hearing about it.
posted by nev at 1:35 PM on November 19, 2004
Looks like it's a global constant. It's being referenced as a variable, and since no definition exists for it in this function, it has to be global. If it's not, it should kick our an error.
posted by Civil_Disobedient at 5:25 PM on November 19, 2004
posted by Civil_Disobedient at 5:25 PM on November 19, 2004
« Older Gmail in Mozilla on OS9.2 is starting to freeze up... | US-Samoa cheap, reliable phone card? Newer »
This thread is closed to new comments.
That's what it looks like to me, anyway.
posted by The Pusher Robot at 9:28 PM on November 18, 2004