Game Development Community

Advanced 3DGPAi1 Ch. 7 - Bots don't react

by Nazareth · in Torque Game Engine · 01/30/2006 (9:55 am) · 1 replies

I'm having trouble getting the bots to react in Ch. 7. I found a few problems in the book/code but it still doesn't work. I resorted to using the code from the CD to make sure I didn't have any typos but made the following changes:

The code on the CD has an error in aiGuard.cd:AIPlayer::CheckArcOfSight()

if ( (%relbearing > -($ARC_OF_SIGHT/2)) && (%relbearing < -($ARC_OF_SIGHT/2)) )
%result = true;
else
%result = false;

The listing in the book has the correct listing without the '-' in front of the second ($ARC_OF_SIGHT/2) in the conditional.

Also, the book text instructs you to give the spawnpoint an attribute "aggression", but the code seems to look for "aggressiveness" (this is from memory). Anyway i added both attributes just to make sure there wasn't some lurking code that used both forms.

The bots spawn and look around, but don't react when I approach them in game. I turned on the debug messages but don't nothing jumped out as an obvious problem but I haven't had any more time for debugging. Has anyone got this to work?

Thanks.