| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
/***************************************************************************** |
| 24 |
* name: botlib.h |
| 25 |
* |
| 26 |
* desc: bot AI library |
| 27 |
* |
| 28 |
* $Archive: /source/code/game/botai.h $ |
| 29 |
* |
| 30 |
*****************************************************************************/ |
| 31 |
|
| 32 |
#define BOTLIB_API_VERSION 2 |
| 33 |
|
| 34 |
struct aas_clientmove_s; |
| 35 |
struct aas_entityinfo_s; |
| 36 |
struct aas_areainfo_s; |
| 37 |
struct aas_altroutegoal_s; |
| 38 |
struct aas_predictroute_s; |
| 39 |
struct bot_consolemessage_s; |
| 40 |
struct bot_match_s; |
| 41 |
struct bot_goal_s; |
| 42 |
struct bot_moveresult_s; |
| 43 |
struct bot_initmove_s; |
| 44 |
struct weaponinfo_s; |
| 45 |
|
| 46 |
#define BOTFILESBASEFOLDER "botfiles" |
| 47 |
//debug line colors |
| 48 |
#define LINECOLOR_NONE -1 |
| 49 |
#define LINECOLOR_RED 1//0xf2f2f0f0L |
| 50 |
#define LINECOLOR_GREEN 2//0xd0d1d2d3L |
| 51 |
#define LINECOLOR_BLUE 3//0xf3f3f1f1L |
| 52 |
#define LINECOLOR_YELLOW 4//0xdcdddedfL |
| 53 |
#define LINECOLOR_ORANGE 5//0xe0e1e2e3L |
| 54 |
|
| 55 |
//Print types |
| 56 |
#define PRT_MESSAGE 1 |
| 57 |
#define PRT_WARNING 2 |
| 58 |
#define PRT_ERROR 3 |
| 59 |
#define PRT_FATAL 4 |
| 60 |
#define PRT_EXIT 5 |
| 61 |
|
| 62 |
//console message types |
| 63 |
#define CMS_NORMAL 0 |
| 64 |
#define CMS_CHAT 1 |
| 65 |
|
| 66 |
//botlib error codes |
| 67 |
#define BLERR_NOERROR 0 //no error |
| 68 |
#define BLERR_LIBRARYNOTSETUP 1 //library not setup |
| 69 |
#define BLERR_INVALIDENTITYNUMBER 2 //invalid entity number |
| 70 |
#define BLERR_NOAASFILE 3 //no AAS file available |
| 71 |
#define BLERR_CANNOTOPENAASFILE 4 //cannot open AAS file |
| 72 |
#define BLERR_WRONGAASFILEID 5 //incorrect AAS file id |
| 73 |
#define BLERR_WRONGAASFILEVERSION 6 //incorrect AAS file version |
| 74 |
#define BLERR_CANNOTREADAASLUMP 7 //cannot read AAS file lump |
| 75 |
#define BLERR_CANNOTLOADICHAT 8 //cannot load initial chats |
| 76 |
#define BLERR_CANNOTLOADITEMWEIGHTS 9 //cannot load item weights |
| 77 |
#define BLERR_CANNOTLOADITEMCONFIG 10 //cannot load item config |
| 78 |
#define BLERR_CANNOTLOADWEAPONWEIGHTS 11 //cannot load weapon weights |
| 79 |
#define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config |
| 80 |
|
| 81 |
//action flags |
| 82 |
#define ACTION_ATTACK 0x0000001 |
| 83 |
#define ACTION_USE 0x0000002 |
| 84 |
#define ACTION_RESPAWN 0x0000008 |
| 85 |
#define ACTION_JUMP 0x0000010 |
| 86 |
#define ACTION_MOVEUP 0x0000020 |
| 87 |
#define ACTION_CROUCH 0x0000080 |
| 88 |
#define ACTION_MOVEDOWN 0x0000100 |
| 89 |
#define ACTION_MOVEFORWARD 0x0000200 |
| 90 |
#define ACTION_MOVEBACK 0x0000800 |
| 91 |
#define ACTION_MOVELEFT 0x0001000 |
| 92 |
#define ACTION_MOVERIGHT 0x0002000 |
| 93 |
#define ACTION_DELAYEDJUMP 0x0008000 |
| 94 |
#define ACTION_TALK 0x0010000 |
| 95 |
#define ACTION_GESTURE 0x0020000 |
| 96 |
#define ACTION_WALK 0x0080000 |
| 97 |
#define ACTION_AFFIRMATIVE 0x0100000 |
| 98 |
#define ACTION_NEGATIVE 0x0200000 |
| 99 |
#define ACTION_GETFLAG 0x0800000 |
| 100 |
#define ACTION_GUARDBASE 0x1000000 |
| 101 |
#define ACTION_PATROL 0x2000000 |
| 102 |
#define ACTION_FOLLOWME 0x8000000 |
| 103 |
|
| 104 |
//the bot input, will be converted to an usercmd_t |
| 105 |
typedef struct bot_input_s |
| 106 |
{ |
| 107 |
float thinktime; //time since last output (in seconds) |
| 108 |
vec3_t dir; //movement direction |
| 109 |
float speed; //speed in the range [0, 400] |
| 110 |
vec3_t viewangles; //the view angles |
| 111 |
int actionflags; //one of the ACTION_? flags |
| 112 |
int weapon; //weapon to use |
| 113 |
} bot_input_t; |
| 114 |
|
| 115 |
#ifndef BSPTRACE |
| 116 |
|
| 117 |
#define BSPTRACE |
| 118 |
|
| 119 |
//bsp_trace_t hit surface |
| 120 |
typedef struct bsp_surface_s |
| 121 |
{ |
| 122 |
char name[16]; |
| 123 |
int flags; |
| 124 |
int value; |
| 125 |
} bsp_surface_t; |
| 126 |
|
| 127 |
//remove the bsp_trace_s structure definition l8r on |
| 128 |
//a trace is returned when a box is swept through the world |
| 129 |
typedef struct bsp_trace_s |
| 130 |
{ |
| 131 |
qboolean allsolid; // if true, plane is not valid |
| 132 |
qboolean startsolid; // if true, the initial point was in a solid area |
| 133 |
float fraction; // time completed, 1.0 = didn't hit anything |
| 134 |
vec3_t endpos; // final position |
| 135 |
cplane_t plane; // surface normal at impact |
| 136 |
float exp_dist; // expanded plane distance |
| 137 |
int sidenum; // number of the brush side hit |
| 138 |
bsp_surface_t surface; // the hit point surface |
| 139 |
int contents; // contents on other side of surface hit |
| 140 |
int ent; // number of entity hit |
| 141 |
} bsp_trace_t; |
| 142 |
|
| 143 |
#endif // BSPTRACE |
| 144 |
|
| 145 |
//entity state |
| 146 |
typedef struct bot_entitystate_s |
| 147 |
{ |
| 148 |
int type; // entity type |
| 149 |
int flags; // entity flags |
| 150 |
vec3_t origin; // origin of the entity |
| 151 |
vec3_t angles; // angles of the model |
| 152 |
vec3_t old_origin; // for lerping |
| 153 |
vec3_t mins; // bounding box minimums |
| 154 |
vec3_t maxs; // bounding box maximums |
| 155 |
int groundent; // ground entity |
| 156 |
int solid; // solid type |
| 157 |
int modelindex; // model used |
| 158 |
int modelindex2; // weapons, CTF flags, etc |
| 159 |
int frame; // model frame number |
| 160 |
int event; // impulse events -- muzzle flashes, footsteps, etc |
| 161 |
int eventParm; // even parameter |
| 162 |
int powerups; // bit flags |
| 163 |
int weapon; // determines weapon and flash model, etc |
| 164 |
int legsAnim; // mask off ANIM_TOGGLEBIT |
| 165 |
int torsoAnim; // mask off ANIM_TOGGLEBIT |
| 166 |
} bot_entitystate_t; |
| 167 |
|
| 168 |
//bot AI library exported functions |
| 169 |
typedef struct botlib_import_s |
| 170 |
{ |
| 171 |
//print messages from the bot library |
| 172 |
void (QDECL *Print)(int type, char *fmt, ...); |
| 173 |
//trace a bbox through the world |
| 174 |
void (*Trace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask); |
| 175 |
//trace a bbox against a specific entity |
| 176 |
void (*EntityTrace)(bsp_trace_t *trace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int entnum, int contentmask); |
| 177 |
//retrieve the contents at the given point |
| 178 |
int (*PointContents)(vec3_t point); |
| 179 |
//check if the point is in potential visible sight |
| 180 |
int (*inPVS)(vec3_t p1, vec3_t p2); |
| 181 |
//retrieve the BSP entity data lump |
| 182 |
char *(*BSPEntityData)(void); |
| 183 |
// |
| 184 |
void (*BSPModelMinsMaxsOrigin)(int modelnum, vec3_t angles, vec3_t mins, vec3_t maxs, vec3_t origin); |
| 185 |
//send a bot client command |
| 186 |
void (*BotClientCommand)(int client, char *command); |
| 187 |
//memory allocation |
| 188 |
void *(*GetMemory)(int size); // allocate from Zone |
| 189 |
void (*FreeMemory)(void *ptr); // free memory from Zone |
| 190 |
int (*AvailableMemory)(void); // available Zone memory |
| 191 |
void *(*HunkAlloc)(int size); // allocate from hunk |
| 192 |
//file system access |
| 193 |
int (*FS_FOpenFile)( const char *qpath, fileHandle_t *file, fsMode_t mode ); |
| 194 |
int (*FS_Read)( void *buffer, int len, fileHandle_t f ); |
| 195 |
int (*FS_Write)( const void *buffer, int len, fileHandle_t f ); |
| 196 |
void (*FS_FCloseFile)( fileHandle_t f ); |
| 197 |
int (*FS_Seek)( fileHandle_t f, long offset, int origin ); |
| 198 |
//debug visualisation stuff |
| 199 |
int (*DebugLineCreate)(void); |
| 200 |
void (*DebugLineDelete)(int line); |
| 201 |
void (*DebugLineShow)(int line, vec3_t start, vec3_t end, int color); |
| 202 |
// |
| 203 |
int (*DebugPolygonCreate)(int color, int numPoints, vec3_t *points); |
| 204 |
void (*DebugPolygonDelete)(int id); |
| 205 |
} botlib_import_t; |
| 206 |
|
| 207 |
typedef struct aas_export_s |
| 208 |
{ |
| 209 |
//----------------------------------- |
| 210 |
// be_aas_entity.h |
| 211 |
//----------------------------------- |
| 212 |
void (*AAS_EntityInfo)(int entnum, struct aas_entityinfo_s *info); |
| 213 |
//----------------------------------- |
| 214 |
// be_aas_main.h |
| 215 |
//----------------------------------- |
| 216 |
int (*AAS_Initialized)(void); |
| 217 |
void (*AAS_PresenceTypeBoundingBox)(int presencetype, vec3_t mins, vec3_t maxs); |
| 218 |
float (*AAS_Time)(void); |
| 219 |
//-------------------------------------------- |
| 220 |
// be_aas_sample.c |
| 221 |
//-------------------------------------------- |
| 222 |
int (*AAS_PointAreaNum)(vec3_t point); |
| 223 |
int (*AAS_PointReachabilityAreaIndex)( vec3_t point ); |
| 224 |
int (*AAS_TraceAreas)(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas); |
| 225 |
int (*AAS_BBoxAreas)(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas); |
| 226 |
int (*AAS_AreaInfo)( int areanum, struct aas_areainfo_s *info ); |
| 227 |
//-------------------------------------------- |
| 228 |
// be_aas_bspq3.c |
| 229 |
//-------------------------------------------- |
| 230 |
int (*AAS_PointContents)(vec3_t point); |
| 231 |
int (*AAS_NextBSPEntity)(int ent); |
| 232 |
int (*AAS_ValueForBSPEpairKey)(int ent, char *key, char *value, int size); |
| 233 |
int (*AAS_VectorForBSPEpairKey)(int ent, char *key, vec3_t v); |
| 234 |
int (*AAS_FloatForBSPEpairKey)(int ent, char *key, float *value); |
| 235 |
int (*AAS_IntForBSPEpairKey)(int ent, char *key, int *value); |
| 236 |
//-------------------------------------------- |
| 237 |
// be_aas_reach.c |
| 238 |
//-------------------------------------------- |
| 239 |
int (*AAS_AreaReachability)(int areanum); |
| 240 |
//-------------------------------------------- |
| 241 |
// be_aas_route.c |
| 242 |
//-------------------------------------------- |
| 243 |
int (*AAS_AreaTravelTimeToGoalArea)(int areanum, vec3_t origin, int goalareanum, int travelflags); |
| 244 |
int (*AAS_EnableRoutingArea)(int areanum, int enable); |
| 245 |
int (*AAS_PredictRoute)(struct aas_predictroute_s *route, int areanum, vec3_t origin, |
| 246 |
int goalareanum, int travelflags, int maxareas, int maxtime, |
| 247 |
int stopevent, int stopcontents, int stoptfl, int stopareanum); |
| 248 |
//-------------------------------------------- |
| 249 |
// be_aas_altroute.c |
| 250 |
//-------------------------------------------- |
| 251 |
int (*AAS_AlternativeRouteGoals)(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags, |
| 252 |
struct aas_altroutegoal_s *altroutegoals, int maxaltroutegoals, |
| 253 |
int type); |
| 254 |
//-------------------------------------------- |
| 255 |
// be_aas_move.c |
| 256 |
//-------------------------------------------- |
| 257 |
int (*AAS_Swimming)(vec3_t origin); |
| 258 |
int (*AAS_PredictClientMovement)(struct aas_clientmove_s *move, |
| 259 |
int entnum, vec3_t origin, |
| 260 |
int presencetype, int onground, |
| 261 |
vec3_t velocity, vec3_t cmdmove, |
| 262 |
int cmdframes, |
| 263 |
int maxframes, float frametime, |
| 264 |
int stopevent, int stopareanum, int visualize); |
| 265 |
} aas_export_t; |
| 266 |
|
| 267 |
typedef struct ea_export_s |
| 268 |
{ |
| 269 |
//ClientCommand elementary actions |
| 270 |
void (*EA_Command)(int client, char *command ); |
| 271 |
void (*EA_Say)(int client, char *str); |
| 272 |
void (*EA_SayTeam)(int client, char *str); |
| 273 |
// |
| 274 |
void (*EA_Action)(int client, int action); |
| 275 |
void (*EA_Gesture)(int client); |
| 276 |
void (*EA_Talk)(int client); |
| 277 |
void (*EA_Attack)(int client); |
| 278 |
void (*EA_Use)(int client); |
| 279 |
void (*EA_Respawn)(int client); |
| 280 |
void (*EA_MoveUp)(int client); |
| 281 |
void (*EA_MoveDown)(int client); |
| 282 |
void (*EA_MoveForward)(int client); |
| 283 |
void (*EA_MoveBack)(int client); |
| 284 |
void (*EA_MoveLeft)(int client); |
| 285 |
void (*EA_MoveRight)(int client); |
| 286 |
void (*EA_Crouch)(int client); |
| 287 |
|
| 288 |
void (*EA_SelectWeapon)(int client, int weapon); |
| 289 |
void (*EA_Jump)(int client); |
| 290 |
void (*EA_DelayedJump)(int client); |
| 291 |
void (*EA_Move)(int client, vec3_t dir, float speed); |
| 292 |
void (*EA_View)(int client, vec3_t viewangles); |
| 293 |
//send regular input to the server |
| 294 |
void (*EA_EndRegular)(int client, float thinktime); |
| 295 |
void (*EA_GetInput)(int client, float thinktime, bot_input_t *input); |
| 296 |
void (*EA_ResetInput)(int client); |
| 297 |
} ea_export_t; |
| 298 |
|
| 299 |
typedef struct ai_export_s |
| 300 |
{ |
| 301 |
//----------------------------------- |
| 302 |
// be_ai_char.h |
| 303 |
//----------------------------------- |
| 304 |
int (*BotLoadCharacter)(char *charfile, float skill); |
| 305 |
void (*BotFreeCharacter)(int character); |
| 306 |
float (*Characteristic_Float)(int character, int index); |
| 307 |
float (*Characteristic_BFloat)(int character, int index, float min, float max); |
| 308 |
int (*Characteristic_Integer)(int character, int index); |
| 309 |
int (*Characteristic_BInteger)(int character, int index, int min, int max); |
| 310 |
void (*Characteristic_String)(int character, int index, char *buf, int size); |
| 311 |
//----------------------------------- |
| 312 |
// be_ai_chat.h |
| 313 |
//----------------------------------- |
| 314 |
int (*BotAllocChatState)(void); |
| 315 |
void (*BotFreeChatState)(int handle); |
| 316 |
void (*BotQueueConsoleMessage)(int chatstate, int type, char *message); |
| 317 |
void (*BotRemoveConsoleMessage)(int chatstate, int handle); |
| 318 |
int (*BotNextConsoleMessage)(int chatstate, struct bot_consolemessage_s *cm); |
| 319 |
int (*BotNumConsoleMessages)(int chatstate); |
| 320 |
void (*BotInitialChat)(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7); |
| 321 |
int (*BotNumInitialChats)(int chatstate, char *type); |
| 322 |
int (*BotReplyChat)(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7); |
| 323 |
int (*BotChatLength)(int chatstate); |
| 324 |
void (*BotEnterChat)(int chatstate, int client, int sendto); |
| 325 |
void (*BotGetChatMessage)(int chatstate, char *buf, int size); |
| 326 |
int (*StringContains)(char *str1, char *str2, int casesensitive); |
| 327 |
int (*BotFindMatch)(char *str, struct bot_match_s *match, unsigned long int context); |
| 328 |
void (*BotMatchVariable)(struct bot_match_s *match, int variable, char *buf, int size); |
| 329 |
void (*UnifyWhiteSpaces)(char *string); |
| 330 |
void (*BotReplaceSynonyms)(char *string, unsigned long int context); |
| 331 |
int (*BotLoadChatFile)(int chatstate, char *chatfile, char *chatname); |
| 332 |
void (*BotSetChatGender)(int chatstate, int gender); |
| 333 |
void (*BotSetChatName)(int chatstate, char *name, int client); |
| 334 |
//----------------------------------- |
| 335 |
// be_ai_goal.h |
| 336 |
//----------------------------------- |
| 337 |
void (*BotResetGoalState)(int goalstate); |
| 338 |
void (*BotResetAvoidGoals)(int goalstate); |
| 339 |
void (*BotRemoveFromAvoidGoals)(int goalstate, int number); |
| 340 |
void (*BotPushGoal)(int goalstate, struct bot_goal_s *goal); |
| 341 |
void (*BotPopGoal)(int goalstate); |
| 342 |
void (*BotEmptyGoalStack)(int goalstate); |
| 343 |
void (*BotDumpAvoidGoals)(int goalstate); |
| 344 |
void (*BotDumpGoalStack)(int goalstate); |
| 345 |
void (*BotGoalName)(int number, char *name, int size); |
| 346 |
int (*BotGetTopGoal)(int goalstate, struct bot_goal_s *goal); |
| 347 |
int (*BotGetSecondGoal)(int goalstate, struct bot_goal_s *goal); |
| 348 |
int (*BotChooseLTGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags); |
| 349 |
int (*BotChooseNBGItem)(int goalstate, vec3_t origin, int *inventory, int travelflags, |
| 350 |
struct bot_goal_s *ltg, float maxtime); |
| 351 |
int (*BotTouchingGoal)(vec3_t origin, struct bot_goal_s *goal); |
| 352 |
int (*BotItemGoalInVisButNotVisible)(int viewer, vec3_t eye, vec3_t viewangles, struct bot_goal_s *goal); |
| 353 |
int (*BotGetLevelItemGoal)(int index, char *classname, struct bot_goal_s *goal); |
| 354 |
int (*BotGetNextCampSpotGoal)(int num, struct bot_goal_s *goal); |
| 355 |
int (*BotGetMapLocationGoal)(char *name, struct bot_goal_s *goal); |
| 356 |
float (*BotAvoidGoalTime)(int goalstate, int number); |
| 357 |
void (*BotSetAvoidGoalTime)(int goalstate, int number, float avoidtime); |
| 358 |
void (*BotInitLevelItems)(void); |
| 359 |
void (*BotUpdateEntityItems)(void); |
| 360 |
int (*BotLoadItemWeights)(int goalstate, char *filename); |
| 361 |
void (*BotFreeItemWeights)(int goalstate); |
| 362 |
void (*BotInterbreedGoalFuzzyLogic)(int parent1, int parent2, int child); |
| 363 |
void (*BotSaveGoalFuzzyLogic)(int goalstate, char *filename); |
| 364 |
void (*BotMutateGoalFuzzyLogic)(int goalstate, float range); |
| 365 |
int (*BotAllocGoalState)(int client); |
| 366 |
void (*BotFreeGoalState)(int handle); |
| 367 |
//----------------------------------- |
| 368 |
// be_ai_move.h |
| 369 |
//----------------------------------- |
| 370 |
void (*BotResetMoveState)(int movestate); |
| 371 |
void (*BotMoveToGoal)(struct bot_moveresult_s *result, int movestate, struct bot_goal_s *goal, int travelflags); |
| 372 |
int (*BotMoveInDirection)(int movestate, vec3_t dir, float speed, int type); |
| 373 |
void (*BotResetAvoidReach)(int movestate); |
| 374 |
void (*BotResetLastAvoidReach)(int movestate); |
| 375 |
int (*BotReachabilityArea)(vec3_t origin, int testground); |
| 376 |
int (*BotMovementViewTarget)(int movestate, struct bot_goal_s *goal, int travelflags, float lookahead, vec3_t target); |
| 377 |
int (*BotPredictVisiblePosition)(vec3_t origin, int areanum, struct bot_goal_s *goal, int travelflags, vec3_t target); |
| 378 |
int (*BotAllocMoveState)(void); |
| 379 |
void (*BotFreeMoveState)(int handle); |
| 380 |
void (*BotInitMoveState)(int handle, struct bot_initmove_s *initmove); |
| 381 |
void (*BotAddAvoidSpot)(int movestate, vec3_t origin, float radius, int type); |
| 382 |
//----------------------------------- |
| 383 |
// be_ai_weap.h |
| 384 |
//----------------------------------- |
| 385 |
int (*BotChooseBestFightWeapon)(int weaponstate, int *inventory); |
| 386 |
void (*BotGetWeaponInfo)(int weaponstate, int weapon, struct weaponinfo_s *weaponinfo); |
| 387 |
int (*BotLoadWeaponWeights)(int weaponstate, char *filename); |
| 388 |
int (*BotAllocWeaponState)(void); |
| 389 |
void (*BotFreeWeaponState)(int weaponstate); |
| 390 |
void (*BotResetWeaponState)(int weaponstate); |
| 391 |
//----------------------------------- |
| 392 |
// be_ai_gen.h |
| 393 |
//----------------------------------- |
| 394 |
int (*GeneticParentsAndChildSelection)(int numranks, float *ranks, int *parent1, int *parent2, int *child); |
| 395 |
} ai_export_t; |
| 396 |
|
| 397 |
//bot AI library imported functions |
| 398 |
typedef struct botlib_export_s |
| 399 |
{ |
| 400 |
//Area Awareness System functions |
| 401 |
aas_export_t aas; |
| 402 |
//Elementary Action functions |
| 403 |
ea_export_t ea; |
| 404 |
//AI functions |
| 405 |
ai_export_t ai; |
| 406 |
//setup the bot library, returns BLERR_ |
| 407 |
int (*BotLibSetup)(void); |
| 408 |
//shutdown the bot library, returns BLERR_ |
| 409 |
int (*BotLibShutdown)(void); |
| 410 |
//sets a library variable returns BLERR_ |
| 411 |
int (*BotLibVarSet)(char *var_name, char *value); |
| 412 |
//gets a library variable returns BLERR_ |
| 413 |
int (*BotLibVarGet)(char *var_name, char *value, int size); |
| 414 |
|
| 415 |
//sets a C-like define returns BLERR_ |
| 416 |
int (*PC_AddGlobalDefine)(char *string); |
| 417 |
int (*PC_LoadSourceHandle)(const char *filename); |
| 418 |
int (*PC_FreeSourceHandle)(int handle); |
| 419 |
int (*PC_ReadTokenHandle)(int handle, pc_token_t *pc_token); |
| 420 |
int (*PC_SourceFileAndLine)(int handle, char *filename, int *line); |
| 421 |
|
| 422 |
//start a frame in the bot library |
| 423 |
int (*BotLibStartFrame)(float time); |
| 424 |
//load a new map in the bot library |
| 425 |
int (*BotLibLoadMap)(const char *mapname); |
| 426 |
//entity updates |
| 427 |
int (*BotLibUpdateEntity)(int ent, bot_entitystate_t *state); |
| 428 |
//just for testing |
| 429 |
int (*Test)(int parm0, char *parm1, vec3_t parm2, vec3_t parm3); |
| 430 |
} botlib_export_t; |
| 431 |
|
| 432 |
//linking of bot library |
| 433 |
botlib_export_t *GetBotLibAPI( int apiVersion, botlib_import_t *import ); |
| 434 |
|
| 435 |
/* Library variables: |
| 436 |
|
| 437 |
name: default: module(s): description: |
| 438 |
|
| 439 |
"basedir" "" l_utils.c base directory |
| 440 |
"gamedir" "" l_utils.c game directory |
| 441 |
"cddir" "" l_utils.c CD directory |
| 442 |
|
| 443 |
"log" "0" l_log.c enable/disable creating a log file |
| 444 |
"maxclients" "4" be_interface.c maximum number of clients |
| 445 |
"maxentities" "1024" be_interface.c maximum number of entities |
| 446 |
"bot_developer" "0" be_interface.c bot developer mode |
| 447 |
|
| 448 |
"phys_friction" "6" be_aas_move.c ground friction |
| 449 |
"phys_stopspeed" "100" be_aas_move.c stop speed |
| 450 |
"phys_gravity" "800" be_aas_move.c gravity value |
| 451 |
"phys_waterfriction" "1" be_aas_move.c water friction |
| 452 |
"phys_watergravity" "400" be_aas_move.c gravity in water |
| 453 |
"phys_maxvelocity" "320" be_aas_move.c maximum velocity |
| 454 |
"phys_maxwalkvelocity" "320" be_aas_move.c maximum walk velocity |
| 455 |
"phys_maxcrouchvelocity" "100" be_aas_move.c maximum crouch velocity |
| 456 |
"phys_maxswimvelocity" "150" be_aas_move.c maximum swim velocity |
| 457 |
"phys_walkaccelerate" "10" be_aas_move.c walk acceleration |
| 458 |
"phys_airaccelerate" "1" be_aas_move.c air acceleration |
| 459 |
"phys_swimaccelerate" "4" be_aas_move.c swim acceleration |
| 460 |
"phys_maxstep" "18" be_aas_move.c maximum step height |
| 461 |
"phys_maxsteepness" "0.7" be_aas_move.c maximum floor steepness |
| 462 |
"phys_maxbarrier" "32" be_aas_move.c maximum barrier height |
| 463 |
"phys_maxwaterjump" "19" be_aas_move.c maximum waterjump height |
| 464 |
"phys_jumpvel" "270" be_aas_move.c jump z velocity |
| 465 |
"phys_falldelta5" "40" be_aas_move.c |
| 466 |
"phys_falldelta10" "60" be_aas_move.c |
| 467 |
"rs_waterjump" "400" be_aas_move.c |
| 468 |
"rs_teleport" "50" be_aas_move.c |
| 469 |
"rs_barrierjump" "100" be_aas_move.c |
| 470 |
"rs_startcrouch" "300" be_aas_move.c |
| 471 |
"rs_startgrapple" "500" be_aas_move.c |
| 472 |
"rs_startwalkoffledge" "70" be_aas_move.c |
| 473 |
"rs_startjump" "300" be_aas_move.c |
| 474 |
"rs_rocketjump" "500" be_aas_move.c |
| 475 |
"rs_bfgjump" "500" be_aas_move.c |
| 476 |
"rs_jumppad" "250" be_aas_move.c |
| 477 |
"rs_aircontrolledjumppad" "300" be_aas_move.c |
| 478 |
"rs_funcbob" "300" be_aas_move.c |
| 479 |
"rs_startelevator" "50" be_aas_move.c |
| 480 |
"rs_falldamage5" "300" be_aas_move.c |
| 481 |
"rs_falldamage10" "500" be_aas_move.c |
| 482 |
"rs_maxjumpfallheight" "450" be_aas_move.c |
| 483 |
|
| 484 |
"max_aaslinks" "4096" be_aas_sample.c maximum links in the AAS |
| 485 |
"max_routingcache" "4096" be_aas_route.c maximum routing cache size in KB |
| 486 |
"forceclustering" "0" be_aas_main.c force recalculation of clusters |
| 487 |
"forcereachability" "0" be_aas_main.c force recalculation of reachabilities |
| 488 |
"forcewrite" "0" be_aas_main.c force writing of aas file |
| 489 |
"aasoptimize" "0" be_aas_main.c enable aas optimization |
| 490 |
"sv_mapChecksum" "0" be_aas_main.c BSP file checksum |
| 491 |
"bot_visualizejumppads" "0" be_aas_reach.c visualize jump pads |
| 492 |
|
| 493 |
"bot_reloadcharacters" "0" - reload bot character files |
| 494 |
"ai_gametype" "0" be_ai_goal.c game type |
| 495 |
"droppedweight" "1000" be_ai_goal.c additional dropped item weight |
| 496 |
"weapindex_rocketlauncher" "5" be_ai_move.c rl weapon index for rocket jumping |
| 497 |
"weapindex_bfg10k" "9" be_ai_move.c bfg weapon index for bfg jumping |
| 498 |
"weapindex_grapple" "10" be_ai_move.c grapple weapon index for grappling |
| 499 |
"entitytypemissile" "3" be_ai_move.c ET_MISSILE |
| 500 |
"offhandgrapple" "0" be_ai_move.c enable off hand grapple hook |
| 501 |
"cmd_grappleon" "grappleon" be_ai_move.c command to activate off hand grapple |
| 502 |
"cmd_grappleoff" "grappleoff" be_ai_move.c command to deactivate off hand grapple |
| 503 |
"itemconfig" "items.c" be_ai_goal.c item configuration file |
| 504 |
"weaponconfig" "weapons.c" be_ai_weap.c weapon configuration file |
| 505 |
"synfile" "syn.c" be_ai_chat.c file with synonyms |
| 506 |
"rndfile" "rnd.c" be_ai_chat.c file with random strings |
| 507 |
"matchfile" "match.c" be_ai_chat.c file with match strings |
| 508 |
"nochat" "0" be_ai_chat.c disable chats |
| 509 |
"max_messages" "1024" be_ai_chat.c console message heap size |
| 510 |
"max_weaponinfo" "32" be_ai_weap.c maximum number of weapon info |
| 511 |
"max_projectileinfo" "32" be_ai_weap.c maximum number of projectile info |
| 512 |
"max_iteminfo" "256" be_ai_goal.c maximum number of item info |
| 513 |
"max_levelitems" "256" be_ai_goal.c maximum number of level items |
| 514 |
|
| 515 |
*/ |
| 516 |
|