BotPointAreaNum returns 0

Locked
User avatar
Eraser
Posts: 19174
Joined: Fri Dec 01, 2000 8:00 am

BotPointAreaNum returns 0

Post 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?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: BotPointAreaNum returns 0

Post 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.
cyr
Posts: 6
Joined: Sun May 08, 2011 9:44 pm

Re: BotPointAreaNum returns 0

Post 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.
Locked