Page 1 of 1

BotPointAreaNum returns 0

Posted: Tue Jul 10, 2012 7:43 am
by Eraser
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: Select all

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: Select all

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?

Re: BotPointAreaNum returns 0

Posted: Wed Jul 11, 2012 2:06 am
by ^misantropia^
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.

Re: BotPointAreaNum returns 0

Posted: Thu Jul 12, 2012 12:11 am
by cyr
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: Select all

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.