00001 /* 00002 =========================================================================== 00003 Copyright (C) 1999-2005 Id Software, Inc. 00004 00005 This file is part of Quake III Arena source code. 00006 00007 Quake III Arena source code is free software; you can redistribute it 00008 and/or modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the License, 00010 or (at your option) any later version. 00011 00012 Quake III Arena source code is distributed in the hope that it will be 00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Foobar; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 =========================================================================== 00021 */ 00022 // 00023 /***************************************************************************** 00024 * name: be_ai_goal.h 00025 * 00026 * desc: goal AI 00027 * 00028 * $Archive: /source/code/botlib/be_ai_goal.h $ 00029 * 00030 *****************************************************************************/ 00031 00032 #define MAX_AVOIDGOALS 256 00033 #define MAX_GOALSTACK 8 00034 00035 #define GFL_NONE 0 00036 #define GFL_ITEM 1 00037 #define GFL_ROAM 2 00038 #define GFL_DROPPED 4 00039 00040 //a bot goal 00041 typedef struct bot_goal_s 00042 { 00043 vec3_t origin; //origin of the goal 00044 int areanum; //area number of the goal 00045 vec3_t mins, maxs; //mins and maxs of the goal 00046 int entitynum; //number of the goal entity 00047 int number; //goal number 00048 int flags; //goal flags 00049 int iteminfo; //item information 00050 } bot_goal_t; 00051 00052 //reset the whole goal state, but keep the item weights 00053 void BotResetGoalState(int goalstate); 00054 //reset avoid goals 00055 void BotResetAvoidGoals(int goalstate); 00056 //remove the goal with the given number from the avoid goals 00057 void BotRemoveFromAvoidGoals(int goalstate, int number); 00058 //push a goal onto the goal stack 00059 void BotPushGoal(int goalstate, bot_goal_t *goal); 00060 //pop a goal from the goal stack 00061 void BotPopGoal(int goalstate); 00062 //empty the bot's goal stack 00063 void BotEmptyGoalStack(int goalstate); 00064 //dump the avoid goals 00065 void BotDumpAvoidGoals(int goalstate); 00066 //dump the goal stack 00067 void BotDumpGoalStack(int goalstate); 00068 //get the name name of the goal with the given number 00069 void BotGoalName(int number, char *name, int size); 00070 //get the top goal from the stack 00071 int BotGetTopGoal(int goalstate, bot_goal_t *goal); 00072 //get the second goal on the stack 00073 int BotGetSecondGoal(int goalstate, bot_goal_t *goal); 00074 //choose the best long term goal item for the bot 00075 int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags); 00076 //choose the best nearby goal item for the bot 00077 //the item may not be further away from the current bot position than maxtime 00078 //also the travel time from the nearby goal towards the long term goal may not 00079 //be larger than the travel time towards the long term goal from the current bot position 00080 int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, 00081 bot_goal_t *ltg, float maxtime); 00082 //returns true if the bot touches the goal 00083 int BotTouchingGoal(vec3_t origin, bot_goal_t *goal); 00084 //returns true if the goal should be visible but isn't 00085 int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal); 00086 //search for a goal for the given classname, the index can be used 00087 //as a start point for the search when multiple goals are available with that same classname 00088 int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal); 00089 //get the next camp spot in the map 00090 int BotGetNextCampSpotGoal(int num, bot_goal_t *goal); 00091 //get the map location with the given name 00092 int BotGetMapLocationGoal(char *name, bot_goal_t *goal); 00093 //returns the avoid goal time 00094 float BotAvoidGoalTime(int goalstate, int number); 00095 //set the avoid goal time 00096 void BotSetAvoidGoalTime(int goalstate, int number, float avoidtime); 00097 //initializes the items in the level 00098 void BotInitLevelItems(void); 00099 //regularly update dynamic entity items (dropped weapons, flags etc.) 00100 void BotUpdateEntityItems(void); 00101 //interbreed the goal fuzzy logic 00102 void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child); 00103 //save the goal fuzzy logic to disk 00104 void BotSaveGoalFuzzyLogic(int goalstate, char *filename); 00105 //mutate the goal fuzzy logic 00106 void BotMutateGoalFuzzyLogic(int goalstate, float range); 00107 //loads item weights for the bot 00108 int BotLoadItemWeights(int goalstate, char *filename); 00109 //frees the item weights of the bot 00110 void BotFreeItemWeights(int goalstate); 00111 //returns the handle of a newly allocated goal state 00112 int BotAllocGoalState(int client); 00113 //free the given goal state 00114 void BotFreeGoalState(int handle); 00115 //setup the goal AI 00116 int BotSetupGoalAI(void); 00117 //shut down the goal AI 00118 void BotShutdownGoalAI(void);
1.3.9.1