Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

be_ai_weight.h

Go to the documentation of this file.
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_weight.h
00025  *
00026  * desc:        fuzzy weights
00027  *
00028  * $Archive: /source/code/botlib/be_ai_weight.h $
00029  *
00030  *****************************************************************************/
00031 
00032 #define WT_BALANCE          1
00033 #define MAX_WEIGHTS         128
00034 
00035 //fuzzy seperator
00036 typedef struct fuzzyseperator_s
00037 {
00038     int index;
00039     int value;
00040     int type;
00041     float weight;
00042     float minweight;
00043     float maxweight;
00044     struct fuzzyseperator_s *child;
00045     struct fuzzyseperator_s *next;
00046 } fuzzyseperator_t;
00047 
00048 //fuzzy weight
00049 typedef struct weight_s
00050 {
00051     char *name;
00052     struct fuzzyseperator_s *firstseperator;
00053 } weight_t;
00054 
00055 //weight configuration
00056 typedef struct weightconfig_s
00057 {
00058     int numweights;
00059     weight_t weights[MAX_WEIGHTS];
00060     char        filename[MAX_QPATH];
00061 } weightconfig_t;
00062 
00063 //reads a weight configuration
00064 weightconfig_t *ReadWeightConfig(char *filename);
00065 //free a weight configuration
00066 void FreeWeightConfig(weightconfig_t *config);
00067 //writes a weight configuration, returns true if successfull
00068 qboolean WriteWeightConfig(char *filename, weightconfig_t *config);
00069 //find the fuzzy weight with the given name
00070 int FindFuzzyWeight(weightconfig_t *wc, char *name);
00071 //returns the fuzzy weight for the given inventory and weight
00072 float FuzzyWeight(int *inventory, weightconfig_t *wc, int weightnum);
00073 float FuzzyWeightUndecided(int *inventory, weightconfig_t *wc, int weightnum);
00074 //scales the weight with the given name
00075 void ScaleWeight(weightconfig_t *config, char *name, float scale);
00076 //scale the balance range
00077 void ScaleBalanceRange(weightconfig_t *config, float scale);
00078 //evolves the weight configuration
00079 void EvolveWeightConfig(weightconfig_t *config);
00080 //interbreed the weight configurations and stores the interbreeded one in configout
00081 void InterbreedWeightConfigs(weightconfig_t *config1, weightconfig_t *config2, weightconfig_t *configout);
00082 //frees cached weight configurations
00083 void BotShutdownWeights(void);

Generated on Thu Aug 25 12:37:12 2005 for Quake III Arena by  doxygen 1.3.9.1