1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
#ifndef DEFINES_H
#define DEFINES_H
#include <bitset>
#include <string>
#include "../AIExport.h"
#define MAX_INT 2147483647
#define MAX_FLOAT float(MAX_INT)
#define EPS 0.0001f
#define ERRORVECTOR float3(-1.0f,0.0f,0.0f)
#define ZEROVECTOR float3(0.0f,0.0f,0.0f)
/* AI meta data */
#define AI_VERSION_NR aiexport_getVersion()
#define AI_NAME std::string("E323AI")
#define AI_VERSION AI_NAME + " " + AI_VERSION_NR + " - High Templar"
#define AI_CREDITS "Error323 & Simon Logic"
#define AI_NOTES "This A.I. mainly focusses on the XTA and BA mods"
/* Folders */
#define LOG_FOLDER "logs/"
#define CFG_FOLDER "configs/"
#define CACHE_FOLDER "cache/"
/* Templates */
#define CONFIG_TEMPLATE "template-config.cfg"
/* Misc macro's */
#define UD(udid) (ai->cb->GetUnitDef(udid))
#define UT(udid) (&(ai->unittable->units[udid]))
#define UC(udid) (ai->unittable->units[udid].cats)
#define ID(x,z) ((z)*X+(x))
#define ID_GRAPH(x,z) ((z)*XX+(x))
/* Metal to Energy ratio */
#define METAL2ENERGY 60
/* Max features for range scan */
#define MAX_FEATURES 15
/* Max enemies for range scan */
#define MAX_ENEMIES 30
/* Max enemy units (used by CThreatMap; TODO: avoid) */
#define MAX_UNITS_AI 500
/* Map ratios */
#define FOOTPRINT2REAL 8
#define HEIGHT2REAL FOOTPRINT2REAL
#define SLOPE2HEIGHT 2
#define PATH2SLOPE 8
#define PATH2REAL (PATH2SLOPE * SLOPE2HEIGHT * HEIGHT2REAL)
/* Max factory Assisters */
#define FACTORY_ASSISTERS 6
/* Max number of scouts per group */
#define MAX_SCOUTS_IN_GROUP 3
/* Max number of idle scout groups to prevent building unnecessary scouts */
#define MAX_IDLE_SCOUT_GROUPS 3
/* Critical number of units per group when regrouping for moving group
stalls the game */
#define GROUP_CRITICAL_MASS 20
/* Max unit weapon range to be considered by threatmap algo (a hack!) */
#define MAX_WEAPON_RANGE_FOR_TM 1200.0f
/* Max distance at which groups can merge */
#define MERGE_DISTANCE 1500.0f
/* Number of multiplex iterations */
#define MULTIPLEXER 10
/* Number of frames a new unit can not accept tasks */
#define IDLE_UNIT_TIMEOUT (5*30)
#define BAD_TARGET_TIMEOUT (60*30)
/* Number of unique tasks allowed to be executed per update */
#define MAX_TASKS_PER_UPDATE 3
/* Draw time */
#define DRAW_TIME MULTIPLEXER*30
/* Stats url (NOT used) */
#define UPLOAD_URL "http://fhuizing.pythonic.nl/ai-stats.php"
/* We gonna use math.h constants */
#define _USE_MATH_DEFINES
#define MIN_TECHLEVEL 1
#define MAX_TECHLEVEL 5
#define MAX_CATEGORIES 46
typedef std::bitset<MAX_CATEGORIES> unitCategory;
const unitCategory
TECH1 (1UL<<0), // hardcored techlevels for now
TECH2 (1UL<<1),
TECH3 (1UL<<2),
TECH4 (1UL<<3),
TECH5 (1UL<<4),
AIR (1UL<<5), // can fly
SEA (1UL<<6), // can float
LAND (1UL<<7), // can walk/drive
SUB (1UL<<8), // can dive
STATIC (1UL<<9),
MOBILE (1UL<<10),
FACTORY (1UL<<11),
BUILDER (1UL<<12),
ASSISTER (1UL<<13),
RESURRECTOR(1UL<<14),
COMMANDER (1UL<<15),
ATTACKER (1UL<<16),
ANTIAIR (1UL<<17),
SCOUTER (1UL<<18),
ARTILLERY (1UL<<19),
SNIPER (1UL<<20),
ASSAULT (1UL<<21),
MEXTRACTOR (1UL<<22),
MMAKER (1UL<<23),
EMAKER (1UL<<24),
MSTORAGE (1UL<<25),
ESTORAGE (1UL<<26),
DEFENSE (1UL<<27),
KBOT (1UL<<28), // produces kbots
VEHICLE (1UL<<29), // produces vehicles
HOVER (1UL<<30), // produces hovercraft
AIRCRAFT (1UL<<31), // produces aircraft
NAVAL ('1' + std::string(32, '0')), // produces naval units
JAMMER ('1' + std::string(33, '0')),
NUKE ('1' + std::string(34, '0')),
ANTINUKE ('1' + std::string(35, '0')),
PARALYZER ('1' + std::string(36, '0')),
TORPEDO ('1' + std::string(37, '0')),
TRANSPORT ('1' + std::string(38, '0')),
EBOOSTER ('1' + std::string(39, '0')),
MBOOSTER ('1' + std::string(40, '0')),
SHIELD ('1' + std::string(41, '0')),
NANOTOWER ('1' + std::string(42, '0')),
REPAIRPAD ('1' + std::string(43, '0')),
WIND ('1' + std::string(44, '0')),
TIDAL ('1' + std::string(45, '0'));
const unitCategory
CATS_ANY (std::string(MAX_CATEGORIES, '1')),
CATS_ENV (AIR|LAND|SEA|SUB),
CATS_ECONOMY (FACTORY|BUILDER|ASSISTER|RESURRECTOR|COMMANDER|MEXTRACTOR|MMAKER|EMAKER|MSTORAGE|ESTORAGE|EBOOSTER|MBOOSTER);
/* Build tasks */
enum buildType {
BUILD_MPROVIDER,
BUILD_EPROVIDER,
BUILD_AA_DEFENSE,
BUILD_AG_DEFENSE,
BUILD_UW_DEFENSE,
BUILD_FACTORY,
BUILD_MSTORAGE,
BUILD_ESTORAGE,
BUILD_MISC_DEFENSE,
BUILD_IMP_DEFENSE
};
enum difficultyLevel {
DIFFICULTY_EASY = 1,
DIFFICULTY_NORMAL,
DIFFICULTY_HARD
};
#endif
|