codemp/game/be_ai_goal.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 /*****************************************************************************
00004  * name:                be_ai_goal.h
00005  *
00006  * desc:                goal AI
00007  *
00008  * $Archive: /source/code/botlib/be_ai_goal.h $
00009  * $Author: osman $ 
00010  * $Revision: 1.4 $
00011  * $Modtime: 10/05/99 3:32p $
00012  * $Date: 2003/03/15 23:44:00 $
00013  *
00014  *****************************************************************************/
00015 
00016 #define MAX_AVOIDGOALS                  256
00017 #define MAX_GOALSTACK                   8
00018 
00019 #define GFL_NONE                                0
00020 #define GFL_ITEM                                1
00021 #define GFL_ROAM                                2
00022 #define GFL_DROPPED                             4
00023 
00024 //a bot goal
00025 typedef struct bot_goal_s
00026 {
00027         vec3_t origin;                          //origin of the goal
00028         int areanum;                            //area number of the goal
00029         vec3_t mins, maxs;                      //mins and maxs of the goal
00030         int entitynum;                          //number of the goal entity
00031         int number;                                     //goal number
00032         int flags;                                      //goal flags
00033         int iteminfo;                           //item information
00034 } bot_goal_t;
00035 
00036 //reset the whole goal state, but keep the item weights
00037 void BotResetGoalState(int goalstate);
00038 //reset avoid goals
00039 void BotResetAvoidGoals(int goalstate);
00040 //remove the goal with the given number from the avoid goals
00041 void BotRemoveFromAvoidGoals(int goalstate, int number);
00042 //push a goal onto the goal stack
00043 void BotPushGoal(int goalstate, bot_goal_t *goal);
00044 //pop a goal from the goal stack
00045 void BotPopGoal(int goalstate);
00046 //empty the bot's goal stack
00047 void BotEmptyGoalStack(int goalstate);
00048 //dump the avoid goals
00049 void BotDumpAvoidGoals(int goalstate);
00050 //dump the goal stack
00051 void BotDumpGoalStack(int goalstate);
00052 //get the name name of the goal with the given number
00053 void BotGoalName(int number, char *name, int size);
00054 //get the top goal from the stack
00055 int BotGetTopGoal(int goalstate, bot_goal_t *goal);
00056 //get the second goal on the stack
00057 int BotGetSecondGoal(int goalstate, bot_goal_t *goal);
00058 //choose the best long term goal item for the bot
00059 int BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
00060 //choose the best nearby goal item for the bot
00061 //the item may not be further away from the current bot position than maxtime
00062 //also the travel time from the nearby goal towards the long term goal may not
00063 //be larger than the travel time towards the long term goal from the current bot position
00064 int BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags,
00065                                                         bot_goal_t *ltg, float maxtime);
00066 //returns true if the bot touches the goal
00067 int BotTouchingGoal(vec3_t origin, bot_goal_t *goal);
00068 //returns true if the goal should be visible but isn't
00069 int BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, bot_goal_t *goal);
00070 //search for a goal for the given classname, the index can be used
00071 //as a start point for the search when multiple goals are available with that same classname
00072 int BotGetLevelItemGoal(int index, char *classname, bot_goal_t *goal);
00073 //get the next camp spot in the map
00074 int BotGetNextCampSpotGoal(int num, bot_goal_t *goal);
00075 //get the map location with the given name
00076 int BotGetMapLocationGoal(char *name, bot_goal_t *goal);
00077 //returns the avoid goal time
00078 float BotAvoidGoalTime(int goalstate, int number);
00079 //set the avoid goal time
00080 void BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
00081 //initializes the items in the level
00082 void BotInitLevelItems(void);
00083 //regularly update dynamic entity items (dropped weapons, flags etc.)
00084 void BotUpdateEntityItems(void);
00085 //interbreed the goal fuzzy logic
00086 void BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
00087 //save the goal fuzzy logic to disk
00088 void BotSaveGoalFuzzyLogic(int goalstate, char *filename);
00089 //mutate the goal fuzzy logic
00090 void BotMutateGoalFuzzyLogic(int goalstate, float range);
00091 //loads item weights for the bot
00092 int BotLoadItemWeights(int goalstate, char *filename);
00093 //frees the item weights of the bot
00094 void BotFreeItemWeights(int goalstate);
00095 //returns the handle of a newly allocated goal state
00096 int BotAllocGoalState(int client);
00097 //free the given goal state
00098 void BotFreeGoalState(int handle);
00099 //setup the goal AI
00100 int BotSetupGoalAI(void);
00101 //shut down the goal AI
00102 void BotShutdownGoalAI(void);