| 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: be_ai_goal.h |
| 25 |
* |
| 26 |
* desc: goal AI |
| 27 |
* |
| 28 |
* $Archive: /source/code/botlib/be_ai_goal.h $ |
| 29 |
* |
| 30 |
*****************************************************************************/ |
| 31 |
|
| 32 |
#define MAX_AVOIDGOALS 256 |
| 33 |
#define MAX_GOALSTACK 8 |
| 34 |
|
| 35 |
#define GFL_NONE 0 |
| 36 |
#define GFL_ITEM 1 |
| 37 |
#define GFL_ROAM 2 |
| 38 |
#define GFL_DROPPED 4 |
| 39 |
|
| 40 |
//a bot goal |
| 41 |
typedef struct bot_goal_s |
| 42 |
{ |
| 43 |
vec3_t origin; //origin of the goal |
| 44 |
int areanum; //area number of the goal |
| 45 |
vec3_t mins, maxs; //mins and maxs of the goal |
| 46 |
int entitynum; //number of the goal entity |
| 47 |
int number; //goal number |
| 48 |
int flags; //goal flags |
| 49 |
int iteminfo; //item information |
| 50 |
} bot_goal_t; |
| 51 |
|
| 52 |
//reset the whole goal state, but keep the item weights |
| 53 |
void BotResetGoalState(int goalstate); |
| 54 |
//reset avoid goals |
| 55 |
void BotResetAvoidGoals(int goalstate); |
| 56 |
//remove the goal with the given number from the avoid goals |
| 57 |
void BotRemoveFromAvoidGoals(int goalstate, int number); |
| 58 |
//push a goal onto the goal stack |
| 59 |
void BotPushGoal(int goalstate, bot_goal_t *goal); |
| 60 |
//pop a goal from the goal stack |
| 61 |
void BotPopGoal(int goalstate); |
| 62 |
//empty the bot's goal stack |
| 63 |
void BotEmptyGoalStack(int goalstate); |
| 64 |
//dump the avoid goals |
| 65 |
void BotDumpAvoidGoals(int goalstate); |
| 66 |
//dump the goal stack |
| 67 |
void BotDumpGoalStack(int goalstate); |
| 68 |
//get the name name of the goal with the given number |
| 69 |
void BotGoalName(int number, char *name, int size); |
| 70 |
//get the top goal from the stack |
| 71 |
int BotGetTopGoal(int goalstate, bot_goal_t *goal); |
| 72 |
//get the second goal on the stack |
| 73 |
int BotGetSecondGoal(int goalstate, bot_goal_t *goal); |
| 74 |
//choose the best long term goal item for the bot |
| 75 |
int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags); |
| 76 |
//choose the best nearby goal item for the bot |
| 77 |
//the item may not be further away from the current bot position than maxtime |
| 78 |
//also the travel time from the nearby goal towards the long term goal may not |
| 79 |
//be larger than the travel time towards the long term goal from the current bot position |
| 80 |
int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, |
| 81 |
bot_goal_t *ltg, float maxtime); |
| 82 |
//returns true if the bot touches the goal |
| 83 |
int BotTouchingGoal(vec3_t origin, bot_goal_t *goal); |
| 84 |
//returns true if the goal should be visible but isn't |
| 85 |
int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal); |
| 86 |
//search for a goal for the given classname, the index can be used |
| 87 |
//as a start point for the search when multiple goals are available with that same classname |
| 88 |
int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal); |
| 89 |
//get the next camp spot in the map |
| 90 |
int BotGetNextCampSpotGoal(int num, bot_goal_t *goal); |
| 91 |
//get the map location with the given name |
| 92 |
int BotGetMapLocationGoal(char *name, bot_goal_t *goal); |
| 93 |
//returns the avoid goal time |
| 94 |
float BotAvoidGoalTime(int goalstate, int number); |
| 95 |
//set the avoid goal time |
| 96 |
void BotSetAvoidGoalTime(int goalstate, int number, float avoidtime); |
| 97 |
//initializes the items in the level |
| 98 |
void BotInitLevelItems(void); |
| 99 |
//regularly update dynamic entity items (dropped weapons, flags etc.) |
| 100 |
void BotUpdateEntityItems(void); |
| 101 |
//interbreed the goal fuzzy logic |
| 102 |
void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child); |
| 103 |
//save the goal fuzzy logic to disk |
| 104 |
void BotSaveGoalFuzzyLogic(int goalstate, char *filename); |
| 105 |
//mutate the goal fuzzy logic |
| 106 |
void BotMutateGoalFuzzyLogic(int goalstate, float range); |
| 107 |
//loads item weights for the bot |
| 108 |
int BotLoadItemWeights(int goalstate, char *filename); |
| 109 |
//frees the item weights of the bot |
| 110 |
void BotFreeItemWeights(int goalstate); |
| 111 |
//returns the handle of a newly allocated goal state |
| 112 |
int BotAllocGoalState(int client); |
| 113 |
//free the given goal state |
| 114 |
void BotFreeGoalState(int handle); |
| 115 |
//setup the goal AI |
| 116 |
int BotSetupGoalAI(void); |
| 117 |
//shut down the goal AI |
| 118 |
void BotShutdownGoalAI(void); |