Quake3World.com Forums
     Programming Discussion
        BotPointAreaNum returns 0


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: BotPointAreaNum returns 0

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44138
PostPosted: 07-09-2012 11:43 PM           Profile   Send private message  E-mail  Edit post Reply with quote


In EntityPlus there's the possibility to add botspawn entities to a map which, when triggered, spawns a bot in that position. You can also have these botspawns target info_waypoint entities which should make the bot move towards that waypoint or along a (circular) path of waypoints.

So far, this has always worked out for me, but now I'm working on a new map and when spawning a bot I get the console message "no AAS area for waypoint at (x, y, z)". This is an EntityPlus specific message.

The code that emits this error message is as follows:

Code:
wpArea = BotPointAreaNum( curWpEnt->s.origin );   
if( !wpArea )
{
    G_Printf("no AAS area for waypoint at %s \n", vtos(curWpEnt->s.origin) );
    return;
}

curWpEnt is the current info_waypoint entity.

(full code viewable here).

So basically, the problem here is that BotPointAreaNum returns 0.

The BotPointAreaNum (which is as far as I know an unmodified function from the plain Q3 source code) is as follows:

Code:
int BotPointAreaNum(vec3_t origin) {
   int areanum, numareas, areas[10];
   vec3_t end;

   areanum = trap_AAS_PointAreaNum(origin);
   if (areanum) return areanum;
   VectorCopy(origin, end);
   end[2] += 10;
   numareas = trap_AAS_TraceAreas(origin, end, areas, NULL, 10);
   if (numareas > 0) return areas[0];
   return 0;
}


The code path it follows is all the way through the function up to the last return. My question is: what could cause BotPointAreaNum to return 0? I'm 100% sure the entities aren't (partially) inside solids or (bot)clips or unreachable. Is there something I could do in the map to fix this?




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 07-10-2012 06:06 PM           Profile Send private message  E-mail  Edit post Reply with quote


Put a breakpoint on AAS_TraceAreas (it's in botlib/be_aas_sample.c) and step through it. There are a couple of reasons it could return zero, hard to tell which one applies here.




Top
                 

Recruit
Recruit
Joined: 08 May 2011
Posts: 6
PostPosted: 07-11-2012 04:11 PM           Profile Send private message  E-mail  Edit post Reply with quote


Looks like bspc has decided that bots can't walk where you put the waypoint. It's origin is probably just a few units to low. You can also enable bot_testclusters and walk to the waypoint, to see if there is a valid AAS area.

Something like this can help with finding nearby AAS areas:
Code:
void FixGoalArea(bot_goal_t* goal){
   vec3_t start, end;
   int numareas, areas[10];

   VectorCopy(goal->origin, start);
   start[2] -= 32;
   VectorCopy(goal->origin, end);
   end[2] += 32;
   numareas = trap_AAS_TraceAreas(start, end, areas, NULL, 10);
   if (numareas)
      goal->areanum = areas[0];
   //else
   //   CheckMatrixForGoal(goal);
}

Although you'd probably want to also raycast along x and y and check to returned areas with trap_AAS_AreaReachability before picking one.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.